diff --git a/.github/travis-deploy-key.enc b/.github/travis-deploy-key.enc deleted file mode 100644 index eeac961..0000000 Binary files a/.github/travis-deploy-key.enc and /dev/null differ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c3e1123 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,87 @@ +name: CI + +on: + push: + paths-ignore: + - '*.md' + pull_request: + branches: [$default-branch] + schedule: + - cron: '0 12 * * 0' + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Use Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: 'npm' + + - name: Install + run: npm ci + + - name: Run lint tests + run: npm run test-lint + + browser-tests: + name: Browser Tests + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Use Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: 'npm' + + - name: Install + run: npm ci + + - name: Run browser tests + run: npm run test-browser + + tests: + name: Tests + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + node-version: [10, 12] + os: [ubuntu-latest, windows-latest] + include: + - coverage: true + node-version: 16 + os: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install + run: npm ci + + - name: Run system tests + run: npm run test-system + + - name: Run unit tests + run: npm run test-unit + + - if: ${{ matrix.coverage }} + name: Upload coverage + run: npm run codecov -- -c -Z -f .coverage/coverage-final.json -F unit diff --git a/.npmignore b/.npmignore index 0ccaa06..bee0184 100644 --- a/.npmignore +++ b/.npmignore @@ -48,6 +48,5 @@ test/ .eslintrc .nycrc.js codecov.yml -.travis.yml .editorconfig .jsdoc-config.json diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 25b8b53..0000000 --- a/.travis.yml +++ /dev/null @@ -1,96 +0,0 @@ -language: node_js - -# 2*2 matrix for tests -os: - - linux - - windows -node_js: - - 10 - - 12 - -jobs: - include: - # run tests in latest LTS Node.js release and publish code coverage - - name: 'Coverage' - os: linux - node_js: lts/* - script: - - npm run test-unit - - npm run codecov -- -c -Z -f .coverage/coverage-final.json -F unit - - # create a new release if $CREATE_RELEASE is set - - stage: Create Release - if: env(CREATE_RELEASE) = true AND type = api AND tag IS blank - os: linux - node_js: 12 - git: - depth: false # disable --depth - script: - # fail-fast using set -e - - set -e - # decrypt and ssh-add the deploy-key - - openssl aes-256-cbc -K $encrypted_05f822b6caa8_key -iv $encrypted_05f822b6caa8_iv - -in .github/travis-deploy-key.enc -out /tmp/travis-deploy-key -d - - chmod 600 /tmp/travis-deploy-key - - eval "$(ssh-agent -s)" - - ssh-add /tmp/travis-deploy-key - - rm /tmp/travis-deploy-key - # convert remote URL from HTTPS to SSH - - git remote set-url origin $(git config --get remote.origin.url | sed -E 's#(http.*://)([^/]+)/(.+)$#git@\2:\3#g') - - ssh-keyscan github.com >> ~/.ssh/known_hosts - # create release - - npm run release $PUSH_TO_ORIGIN $PRERELEASE_SUFFIX - - set +e - - # publish npm package on tagged builds - - stage: Publish Package - if: tag IS present - os: linux - node_js: 12 - git: - depth: false # disable --depth - script: - # fail-fast using set -e - - set -e - # get prerelease suffix from version tag - - TAG=$(echo $TRAVIS_TAG | sed 's/^.*-\([a-z]*\).*$/\1/') - # set to `latest` in case of no suffix - - TAG=$([ "${TAG}" = "$TRAVIS_TAG" ] && echo "latest" || echo $TAG) - # make sure `latest` tag is create from main branch - - '[ "$TAG" = "latest" ] && [ $(git rev-parse HEAD) != $(git rev-parse origin/main) ] && return 1 || return 0' - - set +e - deploy: - edge: true # opt in to dpl v2 - provider: npm - tag: $TAG - on: - tags: true - all_branches: true - - # update gh-pages docs on main - - stage: Publish Docs - if: branch = main - script: npm run build-docs - before_deploy: openssl aes-256-cbc -K $encrypted_05f822b6caa8_key -iv $encrypted_05f822b6caa8_iv - -in .github/travis-deploy-key.enc -out /tmp/travis-deploy-key -d - deploy: - edge: true # opt in to dpl v2 - provider: pages:git - local_dir: out/docs - keep_history: false - deploy_key: /tmp/travis-deploy-key - commit_message: Deploy to %{target_branch} - on: - branch: main - -before_install: - - '[[ "$CREATE_RELEASE" == "true" || "$TRAVIS_BRANCH" == "main" ]] && true || unset encrypted_05f822b6caa8_key' - - '[[ "$CREATE_RELEASE" == "true" || "$TRAVIS_BRANCH" == "main" ]] && true || unset encrypted_05f822b6caa8_iv' - - '[[ -z "$TRAVIS_TAG" ]] && unset NPM_API_TOKEN || true' - -notifications: - slack: - secure: PuYBCkRXgUKxoFMyTZdYcxplpgW+T/hxq54gsFOcAxN079i7PTD/GmGIgKM1RviCocvroUst5bW3ULk3haYUb8gQSCyAeHzRl00DaoOXshTRjFzJyU6m5wbT/R45dh6ZO2BT6uwlVU95KznieCC+yjlbppPOis8bwxra08ODnsA1L7OeI7fVlKjyh+lPA4qnmuYpNtMfTO5mmHroHBS5nWoB1WctWuZQGSfDYLUr/XrhKkJOBbv7FI7setTroIRF4Rs9nIFEF3mzTuUK5VV6lQAZRzNHKmgD9DmGVeaB5Y4fWEznocV1d6cInsjMr4EyMYziyOFnnPZAk8GZapMDwD0/5E9L5+Q8uXhFhVHYurpZnP+wylqZmnfb4UaFcP96BBaavhfF/ai+LWlLbHiL5b1HX4dlauNfHdq1W1YCILI2Atfr+36rqu3102S6HHkOssoTw09ftLfQHuF6CNYnVE5cS40pupwFZj3o0h9yQnCFDPxlq2ls+hon+PKL9wCHL5MlG+jQZDDL8eZC8F9CoZUyVIxNhoh0fnZ+t4bIlGW5eB8f8oMCxcnjocxZpichfAsmuaPh/e2KfdoF/B7ce6+Tb3/YXqo5QVTsJ1Vzi4I7c3jx1Q0DAyZODsBKyE0y7NfmeVNap0WIgajiJBoKji8Fjw+tDfa3hSb4yyPSG6w= - webhooks: - urls: - secure: vT8yu7tdMzqXk0PHzXyH6vOlU4WnJbfMe0IvlJcwgc/OUdOQaSdAGcBSbAgy3fDk7Ya/WLSAwSzBTLJ6SFXE7UFp0Govu7aSoS/33Xi5GLrS10CA8QPqRbj8cJRLin0WSs0R3vP4F52dSdsE9D281eu6KDFuMNz/St63dSVde+9i5RgVWvTDCNBiLkAMTWgy+B41kVBOaajK/cXjzzAMxzHrMEX/v9GUkrSMyTJ+GWdS3m2cAjaRI/loKDD0SZqdGpeg9ZTRBSBCUaPjYLHe/7eVBGWitn4WgJP81ZmtukjIUi1WuEN6lrX67pNEWXI2TJqaCY/a57Nq9ikVW3w0GRnHBfUb/PYwebTCSSUUmvCdTVuH9x5fnZhnHo7f3yODT8p7G//hfEZ8Pd6FTRULOyxSnc1mqnKusqqFjPX4l8RbG43hWy/ch7xW8/AP7MjiIG69YNrjm/FEfQ3qId6EACL9lzIwS4au2FKvjiXyNAWBoNbUmwDLu95y5HSxl+/E5KIN+S/37NhFQTwUFzXKscrEe9dmaeaGYWlYyyTmSw8eh65wQm9jN1iUfy8xhrZZYm5mFH1oKAYpOtUtMVEa0ofS6tfhRKb05qJxihcudcuQYgpuYYoWmK1xU18HAe6WnLiZ/1DP+aUeZY12DZFaAZzFt0DzIsCLQmiu1CrRItM= diff --git a/CHANGELOG.yaml b/CHANGELOG.yaml index 09e5857..0274a94 100644 --- a/CHANGELOG.yaml +++ b/CHANGELOG.yaml @@ -1,6 +1,8 @@ unreleased: new feature: - Replaced Node VM with Worker threads + chores: + - Add GitHub CI and remove Travis 2.1.1: date: 2022-07-12 diff --git a/README.md b/README.md index 93b709a..b3e5d8f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# UVM [![Build Status](https://travis-ci.com/postmanlabs/uvm.svg?branch=develop)](https://travis-ci.com/postmanlabs/uvm) [![codecov](https://codecov.io/gh/postmanlabs/uvm/branch/develop/graph/badge.svg)](https://codecov.io/gh/postmanlabs/uvm) +# UVM [![CI](https://github.com/postmanlabs/uvm/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/postmanlabs/uvm/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/postmanlabs/uvm/branch/develop/graph/badge.svg)](https://codecov.io/gh/postmanlabs/uvm) Module that exposes an event emitter to send data across contexts ([Worker threads](https://nodejs.org/api/worker_threads.html) in Node.js and [Web Workers](https://www.w3.org/TR/workers/) in browser). diff --git a/npm/test-browser.js b/npm/test-browser.js index 586907d..3ec214f 100644 --- a/npm/test-browser.js +++ b/npm/test-browser.js @@ -11,10 +11,6 @@ const path = require('path'), KARMA_CONFIG_PATH = path.join(__dirname, '..', 'test', 'karma.conf'); module.exports = function (exit) { - if (process.env.TRAVIS_OS_NAME === 'windows') { // eslint-disable-line no-process-env - return console.info(chalk.yellow.bold('Skipping browser tests on windows...')); - } - console.info(chalk.yellow.bold('Running unit tests within browser...')); (new KarmaServer({ // eslint-disable no-new diff --git a/test/system/travis-yml.test.js b/test/system/travis-yml.test.js deleted file mode 100644 index bb3b76c..0000000 --- a/test/system/travis-yml.test.js +++ /dev/null @@ -1,35 +0,0 @@ -const fs = require('fs'), - yaml = require('js-yaml'), - expect = require('chai').expect; - -describe('travis.yml', function () { - let travisYAML, - travisYAMLError; - - try { - travisYAML = yaml.load(fs.readFileSync('.travis.yml').toString()); - } - catch (e) { - travisYAMLError = e; - } - - it('should exist', function (done) { - fs.stat('.travis.yml', done); - }); - - it('should be a valid yml', function () { - expect(travisYAMLError && travisYAMLError.message || travisYAMLError).to.be.undefined; - }); - - describe('structure', function () { - it('should have the language set to node', function () { - expect(travisYAML.language).to.equal('node_js'); - expect(travisYAML.node_js).to.eql([10, 12]); - }); - - it('should have a valid Slack notification token', function () { - expect(travisYAML.notifications.slack.secure, - '"secure" not configured in incoming_webhook').to.be.ok; - }); - }); -});