From 4415ced2c49007f097627515806553e7f649c293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Sun, 26 Sep 2021 14:29:19 +0100 Subject: [PATCH] Add a GitHub action for CI (#147) --- .github/workflows/nodejs.yml | 44 ++++++++++++++++++++++ .travis.yml | 71 ------------------------------------ README.md | 4 +- karma.conf.js | 8 +--- 4 files changed, 47 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/nodejs.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 0000000..d53f316 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,44 @@ +name: Build + +on: + pull_request: + push: + branches: + - master + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Get sources + uses: actions/checkout@v1 + + - name: Restore npm cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-modules- + - name: Use Node.js 14 + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Test + run: npm run test + env: + CI: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a6c08af..0000000 --- a/.travis.yml +++ /dev/null @@ -1,71 +0,0 @@ -sudo: false - -dist: trusty - -language: node_js - -cache: - directories: - - node_modules - - ~/.npm - -node_js: 8 - -jobs: - include: - - stage: lint - script: npm run lint - - stage: test - addons: - chrome: stable - firefox: latest - script: npm run test:browser - env: - - QUICKLY_TEST_BROWSERS_AVAILABLE_IN_CI=1 # kept here for easier reading of build log - - stage: test - addons: - sauce_connect: - username: "chaijs-type-detect" - jwt: - secure: "GhkIK785QJbB1G5qwf51zpoJkHibS8wBhibID2jCL6TmQ8ZUHmihN2qnjuRvCI80uosHqkCBi3CeBYZIika5QFsg6LVVf5dnme7Qs0UkG+mw45yO6vcKycxbn1Bo5X8hqdtSjF/x+C91Wr4lelr5w/Sq2X7RokfE0fDVdklE5xQ=" - script: - - npm run test:browser - env: - - TEST_BROWSERS_IN_SAUCELABS=1 # kept here for easier reading of build log - - SAUCE_USERNAME="chaijs-type-detect" - - SAUCE_CONNECT_READY_FILE=/tmp/sauce-connect-ready - - stage: test - node_js: 8 # to be removed 2019-12-01 - script: npm run test:node - - stage: test - node_js: 7 # to be removed 2017-06-30 - before_install: npm i -g npm@5 - script: npm run test:node - - stage: test - node_js: 6 # to be removed 2019-04-01 - before_install: npm i -g npm@5 - script: npm run test:node - - stage: test - node_js: 4 # to be removed 2018-04-01 - before_install: npm i -g npm@5 - script: npm run test:node - - stage: test - node_js: lts/* # safety net; don't remove - script: npm run test:node - - stage: test - node_js: node # safety net; don't remove - script: npm run test:node - - stage: semantic-release - script: - - if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ "$TRAVIS_BRANCH" != "master" ]; then echo "the deploy job only runs for the master branch. This build will now exit"; exit 0; fi - - if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then npm run semantic-release; fi - env: - - BUILD_LEADER_ID=10 - # GH_TOKEN type-detect travis - - secure: "MPzfTVm7U1Q/eYhHT3DXwZki5Xn4ODNs/uXEM5PB2m+BxbytaAgU+3JSI0ZREv+JLk9CRnj2yWebaQkm+0ompkPRus0pEFuwEsMJ3HqV4ISj6zWGLPNjeJqy6kGa+m1WlkfHM+Spj7vrmk2yclZsmke4xpeQy9W8nnPDEHe6uoQ=" - # NPM_TOKEN …7f80442b - - secure: "EM+nNOeL3X6Cz5u5aaBKZU6FqXrQVgKO543zy6CL3+Im/Esz2um9S2Ymgw9nzBH35SczhJh4Avfw7sujRdyHPL5XLbCWj2954TThsO8Ue62Xs/K3lQT6x8+iQc0jRZFtBkwX2sQjWFah04j381sKeTFFH94jifeW8dFOXXtWZfs=" - -env: - global: - - LOGS_DIR=/tmp/chai-build/logs diff --git a/README.md b/README.md index 4311bf3..beb645e 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,10 @@ src="https://img.shields.io/npm/v/type-detect.svg?style=flat-square" /> - + build:? diff --git a/karma.conf.js b/karma.conf.js index 871d350..fc7b372 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -17,7 +17,7 @@ if (process.env.SAUCE_USERNAME) { startConnect = true; } else if (process.env.APPVEYOR) { browsers = [ 'Firefox', 'ChromeHeadless', 'IE' ]; -} else if (process.env.TRAVIS) { +} else if (process.env.CI) { browsers = [ 'FirefoxHeadless', 'ChromeHeadlessNoSandbox' ]; } else if (!process.env.KARMA_MANUAL) { browsers = []; @@ -28,12 +28,6 @@ if (process.env.APPVEYOR) { branch = process.env.APPVEYOR_REPO_BRANCH; build = `appveyor@${ process.env.APPVEYOR_JOB_NUMBER }`; job = process.env.APPVEYOR_JOB_NUMBER; -} else if (process.env.TRAVIS) { - branch = process.env.TRAVIS_BRANCH; - build = `travis@${ process.env.TRAVIS_JOB_NUMBER }`; - job = process.env.TRAVIS_JOB_NUMBER; - // Travis has its own saucelabs connect process, so ensure karma won't run it - startConnect = false; } /* eslint-enable */