Skip to content

Commit 94265ce

Browse files
committed
feat: create ci.yml
1 parent c834d95 commit 94265ce

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

.github/workflows/ci.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Continuous Integration
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
tests:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
node-version: [14, 16]
11+
fail-fast: false
12+
steps:
13+
- name: Checkout ${{ matrix.node-version }}
14+
uses: actions/checkout@v2
15+
16+
- name: Get yarn cache
17+
id: yarn-cache
18+
run: |
19+
echo "::set-output name=path::$(yarn cache dir)"
20+
echo "::set-output name=version::$(yarn -v)"
21+
22+
- name: Setup Node.js ${{ matrix.node }}
23+
uses: actions/setup-node@v2
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
27+
- name: Cache dependencies ${{ matrix.node-version }}
28+
uses: actions/cache@v2
29+
env:
30+
key-prefix: ${{ runner.os }}-node-${{ matrix.node-version }}
31+
with:
32+
path: |
33+
**/node_modules
34+
**/.eslintcache
35+
${{ steps.yarn-cache.outputs.path }}
36+
key: ${{ env.key-prefix }}-${{ hashFiles('**/yarn.lock') }}
37+
restore-keys: |
38+
${{ env.key-prefix }}-
39+
40+
- name: Install node_modules
41+
run: yarn && npx lerna bootstrap
42+
43+
- name: Test – unit tests
44+
run: yarn test:unit --coverage
45+
env:
46+
CI: true
47+
48+
- name: Test – integration
49+
run: yarn test:integration
50+
51+
- name: Test – Eslint
52+
if: ${{ always() && matrix.node-version == '14' }}
53+
run: yarn eslint
54+
55+
- name: Test – TSCheck
56+
#if: ${{ always() && matrix.node-version == '14' }}
57+
if: false
58+
run: yarn tscheck
59+
60+
- name: Publish Test Report
61+
if: ${{ always() && matrix.node-version == '14' }}
62+
uses: mikepenz/action-junit-report@v2
63+
with:
64+
check_name: JUnit Annotations for Node ${{ matrix.node-version }}
65+
report_paths: '**/coverage/*.xml'
66+
67+
- name: Send codecov.io stats
68+
if: matrix.node-version == '14'
69+
run: bash <(curl -s https://codecov.io/bash) || echo ''
70+
71+
publish:
72+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta'
73+
needs: [tests]
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Checkout 14
77+
uses: actions/checkout@v2
78+
79+
- name: Setup Node.js 14
80+
uses: actions/setup-node@v2
81+
with:
82+
node-version: 14
83+
84+
- name: Cache dependencies 14
85+
uses: actions/cache@v2
86+
env:
87+
key-prefix: ${{ runner.os }}-node-14
88+
with:
89+
path: |
90+
**/node_modules
91+
**/.eslintcache
92+
${{ steps.yarn-cache.outputs.path }}
93+
key: ${{ env.key-prefix }}-${{ hashFiles('**/yarn.lock') }}
94+
restore-keys: |
95+
${{ env.key-prefix }}-
96+
97+
- name: Install node_modules
98+
run: yarn
99+
100+
- name: Build
101+
if: false
102+
run: yarn build
103+
104+
- name: Semantic Release
105+
run: yarn release
106+
env:
107+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
108+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"example:aliasex:test": "cd example/above && yarn test --watchAll=false",
1313
"example:install": "yarn example:alias:install && yarn example:aliasex:install",
1414
"example:test": "yarn example:alias:test && yarn example:aliasex:test",
15+
"coverage": "jest --coverage",
1516
"test:unit": "jest",
1617
"test:integration": "yarn example:alias:test && yarn example:aliasex:test",
1718
"test": "yarn test:unit && yarn test:integration"

0 commit comments

Comments
 (0)