Skip to content

Commit

Permalink
build(ci): migrate linux tests to GitHub workflow actions (#2092)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl committed Nov 4, 2020
1 parent 7361e8b commit 8832c45
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 32 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 0 additions & 31 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8832c45

Please sign in to comment.