From 8832c45c7dbd179a81364dd45c6d98abec170739 Mon Sep 17 00:00:00 2001 From: Ahn Date: Wed, 4 Nov 2020 14:01:03 +0100 Subject: [PATCH] build(ci): migrate linux tests to GitHub workflow actions (#2092) --- .github/workflows/ci.yml | 99 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 31 ------------- package.json | 1 - 3 files changed, 99 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..2d5b150c35 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,99 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: ci + +on: + push: + branches: + - master + pull_request: + branches: + - '**' + +env: + CI: true + +jobs: + cleanup-runs: + runs-on: ubuntu-latest + steps: + - uses: rokroskar/workflow-run-cleanup-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'" + + lint: + name: Running ESLint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Get npm cache + id: npm-cache + run: echo "::set-output name=dir::$(npm config get cacheFolder)" + - uses: actions/cache@v2 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ubuntu-latest-node-12.x-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ubuntu-latest-node-12.x-npm- + - uses: actions/setup-node@v2.1.2 + with: + node-version: 12.x + - name: Install and build + run: npm ci + - name: Run eslint + run: npm run lint + + test: + name: Node v${{ matrix.node-version }} on ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + node-version: [10.x, 12.x, 14.x] + os: [ ubuntu-latest ] + runs-on: ${{ matrix.os }} + + steps: + - name: Set git config + shell: bash + run: | + git config --global core.autocrlf false + git config --global core.symlinks true + if: runner.os == 'Windows' + - uses: actions/checkout@v2 + - name: Get npm cache + id: npm-cache + run: echo "::set-output name=dir::$(npm config get cacheFolder)" + - uses: actions/cache@v2 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ matrix.node-version }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-npm- + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2.1.2 + with: + node-version: ${{ matrix.node-version }} + - name: Install and build + run: npm ci + - name: Run tests with coverage + run: npm run test -- --coverage && cat ./coverage/lcov.info + - name: Run real repo tests + run: npm run test:external-repos + - name: Coveralls parallel + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + flag-name: run-${{ matrix.node-version }} + parallel: true + + finish: + needs: test + runs-on: ubuntu-latest + steps: + - name: Coveralls finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true diff --git a/.travis.yml b/.travis.yml index 187f7f739a..8b0b48e2af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,34 +26,3 @@ jobs: script: - npm run clean -- --when-ci-commit-message - npm run test:external-repos - - os: linux - node_js: 12 - env: TS_JEST_E2E_WORKDIR=/tmp/ts-jest-e2e-workdir TS_JEST_E2E_OPTIMIZATIONS=1 - before_install: - # Disabled, randomly works :-/ - # https://github.com/scikit-learn/scikit-learn/issues/10927 - # - | - # set -e - # # fail loudly when force-pushed, that is why there is the `|| 'dummy.js'` part - # MODIFIED_FILES=$(git diff --name-only $TRAVIS_COMMIT_RANGE || echo 'dummy.js') - # # waiting for native solution https://github.com/travis-ci/travis-ci/issues/6301 - # if ! echo ${MODIFIED_FILES} | grep -qvE '^docs/|^\.gitignore|^\.gitattributes|\.md$|^appveyor\.yml$|^icon\.png$|^commitlint\.config\.js$'; then - # echo "Only docs were updated, stopping build process." - # exit - # fi - # we report coverages only within node 10, ensure we have the coveralls bin installed - - npm i -g coveralls - cache: - npm: true - yarn: true - directories: - - .cache - - /tmp/ts-jest-e2e-workdir/__templates__ - script: - - npm run clean -- --when-ci-commit-message - # only grab coverage data on node 10 - - npm run test -- --runInBand --coverage - - npm run test:external-repos - after_success: - # report coverages to coveralls - - if [[ -s coverage/lcov.info ]]; then cat coverage/lcov.info | coveralls; fi diff --git a/package.json b/package.json index c593164ce3..d1a4007dee 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ "build": "tsc -p tsconfig.build.json", "postbuild": "node scripts/post-build.js", "clean": "node scripts/clean.js", - "pretest": "npm run lint", "test": "run-s -s test:e2e \"test:unit -- {@}\" --", "test:prepare": "npm run test:e2e -- --prepareOnly", "test:e2e": "node scripts/e2e.js",