diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4982771 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,91 @@ +name: CI + +on: + push: + paths-ignore: + - 'docs/**' + - '*.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 + + - name: Run integration tests + run: npm run test-integration diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 43d61e6..0000000 --- a/.travis.yml +++ /dev/null @@ -1,97 +0,0 @@ -language: node_js - -# 2*2 matrix for tests -os: - - linux - - windows -node_js: - - 10 - - 12 - -jobs: - include: - # run tests in Node.js stable and publish code coverage - - name: 'Coverage' - os: linux - node_js: stable - 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: tCxMtu8e+dqVnqGeVfsU4TCi+6ZbC75kAsiumWNdMoBd5bcleTCeh4ZpLnK+zNgGpI5FJanwQvK/kvlM5JiwgA+mA+srqZf6iO12Aw/TKpXWvL8kSjvAFxzyVL+03UTVHzCdbkqZFtH29gKsRTZ5d574zKNDmpwRL5fyRNxWekQRDUf1zH7kSGCFEqklWeYf8/lqNT+PzCBSHDc7+/KicY008Z4A8tqnp3XM8S7CvJfXQXDaDd0q+LVqdymlG90JATxBLJKZ7PH81KGwcsFQeALnUhlIWqVFvvxTJlBAkRebPlCNq5qKR3An7EB55vAMaxXI9zuEQnjo3xrSl5NaCRpxHQ2TYdLFld7NFVhpgw/cvaWn5gynPYYThVZ0QFC7VZ9iCVaZfM3mxT4nt95RCOskPE549sxEJuu0TlEPlx2NASGfKSEKmxY1D4yglG6dr9p5yakzv1GLhyexXAGOfudGZGc0MiK/A7mewGl1vmFU2/yp92uuXqQpZ4wgGIDkjlfVQuwry/2EeQp5A4HZBJmNiPwGEhN0rQBtsgD8Hpxtsn3ED914JP3j/+7X66WG6n+bwO1+ihv9+GPHEwyO9/jPelpbUoSlMyzpNCHfN8EfbFfD8lDTtU9WXTyfIvuPGg/jEC82EfUUf2WYMFrIowAfnc7yTWb6MXHvC90NGPQ= - diff --git a/README.md b/README.md index 9ca5fc9..7dfead0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Uniscope [![Build Status](https://travis-ci.com/postmanlabs/uniscope.svg?branch=develop)](https://travis-ci.com/postmanlabs/uniscope) [![codecov](https://codecov.io/gh/postmanlabs/uniscope/branch/develop/graph/badge.svg)](https://codecov.io/gh/postmanlabs/uniscope) +# Uniscope [![CI](https://github.com/postmanlabs/uniscope/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/postmanlabs/uniscope/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/postmanlabs/uniscope/branch/develop/graph/badge.svg)](https://codecov.io/gh/postmanlabs/uniscope) The goal of this module is to provide a uniform execution environment to a JavaScript code between browser and NodeJS.
For example, global functions and objects in NodeJS such as `setImmediate` and `global` are not easily available to the script. And on the other hand, browser-specific global properties such as `requestAnimationFrame` and `window` is not available as well. 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 ac8e257..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 () { - var 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; - }); - }); -});