-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (71 loc) · 2.55 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: CI
on:
workflow_dispatch:
push:
branches:
- master
- develop
- 'run-ci/**'
pull_request:
branches: [ master, develop, test-pr ]
types: [opened, synchronize, reopened, labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
NODE_ENV: test
jobs:
buildAndTest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Yarn setup (caching yarn dependencies)
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
- run: yarn install --immutable
- name: Build
run: yarn run build
- name: Save status of build
run: echo "package_built=true" >> $GITHUB_ENV
# == run and report tests ==
- name: Tests
run: yarn run test
- name: Test Report
uses: dorny/test-reporter@v1
if: ${{ env.package_built && (success() || failure()) }}
with:
name: Tests # Name of the check run which will be created
path: unit-tests-report.json # Path to test results
reporter: mocha-json # Format of test results
fail-on-error: 'false' # Don't mark this step as failed if tests fail - the test step itself will be marked as failed
# == Send coverage report to Coveralls ==
# Coverallsapp by default uses GITHUB_SHA but that does not necessarily correspond
# to HEAD because a branch is checked out. We here find the actual SHA for HEAD.
- name: Set Coveralls vars
id: coveralls_vars
if: github.event_name != 'pull_request'
run: echo "::set-output name=sha_for_head::$(git rev-parse HEAD)"
- name: Upload to Coveralls
uses: coverallsapp/github-action@master
if: github.event_name != 'pull_request'
with:
git-commit: ${{ steps.coveralls_vars.outputs.sha_for_head }}
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/lcov.info
base-path : .
flag-name: js
# ==== final "check" job, using alls-green to have one single job to check for green workflow ====
# see https://github.com/re-actors/alls-green
check:
if: always()
needs:
- buildAndTest
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}