Skip to content

Commit 8832c45

Browse files
authored
build(ci): migrate linux tests to GitHub workflow actions (#2092)
1 parent 7361e8b commit 8832c45

File tree

3 files changed

+99
-32
lines changed

3 files changed

+99
-32
lines changed

.github/workflows/ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: ci
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
pull_request:
11+
branches:
12+
- '**'
13+
14+
env:
15+
CI: true
16+
17+
jobs:
18+
cleanup-runs:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: rokroskar/workflow-run-cleanup-action@master
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
25+
26+
lint:
27+
name: Running ESLint
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v2
31+
- name: Get npm cache
32+
id: npm-cache
33+
run: echo "::set-output name=dir::$(npm config get cacheFolder)"
34+
- uses: actions/cache@v2
35+
with:
36+
path: ${{ steps.npm-cache.outputs.dir }}
37+
key: ubuntu-latest-node-12.x-npm-${{ hashFiles('**/package-lock.json') }}
38+
restore-keys: |
39+
ubuntu-latest-node-12.x-npm-
40+
- uses: actions/[email protected]
41+
with:
42+
node-version: 12.x
43+
- name: Install and build
44+
run: npm ci
45+
- name: Run eslint
46+
run: npm run lint
47+
48+
test:
49+
name: Node v${{ matrix.node-version }} on ${{ matrix.os }}
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
node-version: [10.x, 12.x, 14.x]
54+
os: [ ubuntu-latest ]
55+
runs-on: ${{ matrix.os }}
56+
57+
steps:
58+
- name: Set git config
59+
shell: bash
60+
run: |
61+
git config --global core.autocrlf false
62+
git config --global core.symlinks true
63+
if: runner.os == 'Windows'
64+
- uses: actions/checkout@v2
65+
- name: Get npm cache
66+
id: npm-cache
67+
run: echo "::set-output name=dir::$(npm config get cacheFolder)"
68+
- uses: actions/cache@v2
69+
with:
70+
path: ${{ steps.npm-cache.outputs.dir }}
71+
key: ${{ runner.os }}-node-${{ matrix.node-version }}-npm-${{ hashFiles('**/package-lock.json') }}
72+
restore-keys: |
73+
${{ runner.os }}-node-${{ matrix.node-version }}-npm-
74+
- name: Use Node.js ${{ matrix.node-version }}
75+
uses: actions/[email protected]
76+
with:
77+
node-version: ${{ matrix.node-version }}
78+
- name: Install and build
79+
run: npm ci
80+
- name: Run tests with coverage
81+
run: npm run test -- --coverage && cat ./coverage/lcov.info
82+
- name: Run real repo tests
83+
run: npm run test:external-repos
84+
- name: Coveralls parallel
85+
uses: coverallsapp/github-action@master
86+
with:
87+
github-token: ${{ secrets.github_token }}
88+
flag-name: run-${{ matrix.node-version }}
89+
parallel: true
90+
91+
finish:
92+
needs: test
93+
runs-on: ubuntu-latest
94+
steps:
95+
- name: Coveralls finished
96+
uses: coverallsapp/github-action@master
97+
with:
98+
github-token: ${{ secrets.github_token }}
99+
parallel-finished: true

.travis.yml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,3 @@ jobs:
2626
script:
2727
- npm run clean -- --when-ci-commit-message
2828
- npm run test:external-repos
29-
- os: linux
30-
node_js: 12
31-
env: TS_JEST_E2E_WORKDIR=/tmp/ts-jest-e2e-workdir TS_JEST_E2E_OPTIMIZATIONS=1
32-
before_install:
33-
# Disabled, randomly works :-/
34-
# https://github.com/scikit-learn/scikit-learn/issues/10927
35-
# - |
36-
# set -e
37-
# # fail loudly when force-pushed, that is why there is the `|| 'dummy.js'` part
38-
# MODIFIED_FILES=$(git diff --name-only $TRAVIS_COMMIT_RANGE || echo 'dummy.js')
39-
# # waiting for native solution https://github.com/travis-ci/travis-ci/issues/6301
40-
# if ! echo ${MODIFIED_FILES} | grep -qvE '^docs/|^\.gitignore|^\.gitattributes|\.md$|^appveyor\.yml$|^icon\.png$|^commitlint\.config\.js$'; then
41-
# echo "Only docs were updated, stopping build process."
42-
# exit
43-
# fi
44-
# we report coverages only within node 10, ensure we have the coveralls bin installed
45-
- npm i -g coveralls
46-
cache:
47-
npm: true
48-
yarn: true
49-
directories:
50-
- .cache
51-
- /tmp/ts-jest-e2e-workdir/__templates__
52-
script:
53-
- npm run clean -- --when-ci-commit-message
54-
# only grab coverage data on node 10
55-
- npm run test -- --runInBand --coverage
56-
- npm run test:external-repos
57-
after_success:
58-
# report coverages to coveralls
59-
- if [[ -s coverage/lcov.info ]]; then cat coverage/lcov.info | coveralls; fi

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"build": "tsc -p tsconfig.build.json",
1111
"postbuild": "node scripts/post-build.js",
1212
"clean": "node scripts/clean.js",
13-
"pretest": "npm run lint",
1413
"test": "run-s -s test:e2e \"test:unit -- {@}\" --",
1514
"test:prepare": "npm run test:e2e -- --prepareOnly",
1615
"test:e2e": "node scripts/e2e.js",

0 commit comments

Comments
 (0)