Skip to content

Commit 5b1fb16

Browse files
committed
ci: improve github actions
1 parent c6c0ae0 commit 5b1fb16

File tree

2 files changed

+59
-40
lines changed

2 files changed

+59
-40
lines changed

.github/workflows/nodejs.yml

Lines changed: 56 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,66 @@
1-
name: Build CI
2-
on: [push]
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: Node.js CI
5+
6+
on: [push, pull_request]
7+
38
jobs:
49
tests:
510
runs-on: ubuntu-latest
611
strategy:
712
matrix:
8-
node-version: [10.x, 12.x, 13.x]
13+
node-version: [10, 12, 14, 16]
14+
fail-fast: false
915
steps:
10-
- uses: actions/checkout@v1
11-
- name: Use Node.js ${{ matrix.node-version }}
12-
uses: actions/setup-node@v1
13-
with:
14-
node-version: ${{ matrix.node-version }}
15-
- name: Install node_modules
16-
run: yarn install
17-
- name: Test
18-
run: yarn test
19-
env:
20-
CI: true
21-
- name: Build
22-
run: yarn build
23-
- name: Send coverage (only Node 12.x)
24-
if: startsWith(matrix.node-version, '12.')
25-
run: bash <(curl -s https://codecov.io/bash)
26-
env:
27-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
28-
29-
16+
- uses: actions/checkout@v2
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
- name: Install node_modules
22+
run: yarn
23+
- name: Test – Jest
24+
run: yarn coverage
25+
env:
26+
CI: true
27+
- name: Test – Eslint
28+
if: ${{ always() && matrix.node-version == '12' }}
29+
run: yarn eslint
30+
- name: Test – TSCheck
31+
if: ${{ always() && matrix.node-version == '12' }}
32+
run: yarn tscheck
33+
- name: Publish Test Report
34+
if: ${{ always() && matrix.node-version == '12' }}
35+
uses: mikepenz/action-junit-report@v2
36+
with:
37+
check_name: JUnit Annotations for Node ${{ matrix.node-version }}
38+
report_paths: '**/coverage/junit/**/*.xml'
39+
- name: Testing with previous graphql versions
40+
run: yarn test-prev-vers
41+
env:
42+
CI: true
43+
- name: Send codecov.io stats
44+
if: matrix.node-version == '12'
45+
run: bash <(curl -s https://codecov.io/bash) || echo ''
46+
3047
publish:
31-
if: github.ref == 'refs/heads/master'
48+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta'
3249
needs: [tests]
3350
runs-on: ubuntu-latest
3451
steps:
35-
- uses: actions/checkout@v1
36-
- name: Use Node.js 12
37-
uses: actions/setup-node@v1
38-
with:
39-
node-version: 12.x
40-
- name: Install node_modules
41-
run: yarn install
42-
- name: Build
43-
run: yarn build
44-
- name: Semantic Release (publish to npm)
45-
run: yarn semantic-release
46-
env:
47-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52+
- uses: actions/checkout@v2
53+
- name: Use Node.js 12
54+
uses: actions/setup-node@v2
55+
with:
56+
node-version: 12
57+
- name: Install node_modules
58+
run: yarn install
59+
- name: Build
60+
run: yarn build
61+
- name: Semantic Release (publish to npm)
62+
run: yarn semantic-release
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
66+

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@
4343
"watch": "jest --watch",
4444
"coverage": "jest --coverage",
4545
"build": "rimraf ./lib && tsc --build tsconfig.build.json",
46-
"lint": "eslint --ext .ts ./src",
47-
"test": "npm run lint && npm run tscheck && npm run coverage",
46+
"lint": "yarn eslint",
47+
"eslint": "eslint --ext .ts ./src",
48+
"test": "yarn lint && yarn tscheck && yarn coverage",
4849
"tscheck": "tsc --noEmit",
4950
"semantic-release": "semantic-release",
5051
"start-example1": "cd ./examples/simple && yarn install && yarn watch",

0 commit comments

Comments
 (0)