Skip to content

Commit

Permalink
Merge pull request #193 from Mr0grog/add-a-little-ci-please
Browse files Browse the repository at this point in the history
Add basic CI workflow on GitHub Actions
  • Loading branch information
pimterry authored Jan 16, 2024
2 parents 45c5600 + 0a4a408 commit 1f67f49
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ indent_size = 2

[*.json]
indent_size = 2

[*.{yaml,yml}]
indent_size = 2
110 changes: 110 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Continuous Integration

on:
pull_request: {}
push:
branches:
- master
# Allow manual runs if needed.
workflow_dispatch: {}

jobs:
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 10
cache: npm
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm install

- name: JSHint
run: npm run lint

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 10
cache: npm
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm install

- name: Build
run: npm run dist-build

node-tests:
runs-on: ubuntu-latest
strategy:
matrix:
# Ideally we'd also test on [12, 14, 16, 18, 20], but the current
# tooling does not support them.
node_version: [6, 8, 10]

steps:
- uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
cache: npm
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm install

- name: Unit Tests
run: npm run test-node

browser-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 8
cache: npm
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm install

- name: Unit Tests
run: npm run test-browser

types:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 10
cache: npm
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm install

- name: Typescript Tests
run: npm run test-types
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

7 changes: 5 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,13 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');

// Build a distributable release
grunt.registerTask('dist', ['test', 'concat', 'uglify']);
grunt.registerTask('dist', ['test', 'dist-build']);
grunt.registerTask('dist-build', ['concat', 'uglify']);

// Check everything is good
grunt.registerTask('test', ['jshint', 'jasmine:requirejs', 'jasmine:global', 'preprocess', 'jasmine:context', 'clean:test', 'jasmine_node', 'jasmine:withCoverage', 'qunit']);
grunt.registerTask('test', ['jshint', 'test-browser', 'test-node']);
grunt.registerTask('test-browser', ['jasmine:requirejs', 'jasmine:global', 'preprocess', 'jasmine:context', 'clean:test', 'jasmine:withCoverage', 'qunit']);
grunt.registerTask('test-node', ['jasmine_node']);

// Test with a live server and an actual browser
grunt.registerTask('integration-test', ['jasmine:requirejs:src:build', 'open:jasmine', 'connect:test:keepalive']);
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@
"node": ">= 0.6.0"
},
"scripts": {
"test": "grunt test && tsc --noEmit ./test/type-test.ts",
"lint": "grunt jshint",
"test": "grunt test && npm run test-types",
"test-browser": "grunt test-browser",
"test-node": "grunt test-node",
"test-types": "tsc --noEmit ./test/type-test.ts",
"ci": "grunt ci",
"dist": "grunt dist",
"dist-build": "grunt dist-build",
"watch": "grunt watch"
},
"dependencies": {},
Expand Down

0 comments on commit 1f67f49

Please sign in to comment.