-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (111 loc) · 3.66 KB
/
pr-test.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: pr-test
on:
pull_request:
paths-ignore:
- "docs/"
- "**.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
# Stop remaining runs when a build fails that is not experimental
fail-fast: true
matrix:
# Run the pipeline on all the currently supported OS versions
os: [ubuntu-latest]
# Run the pipeline on all the currently supported LTS versions and the upcoming version
node-version: [lts/*]
# Run the pipeline on all the currently supported architectures
architecture: [x64]
include:
# Report coverage for only one configuration
- os: ubuntu-latest
node-version: lts/*
architecture: x64
report_coverage: true
steps:
# Cloning
- uses: actions/checkout@v3
# Setup and Caching
- name: Use Node.js ${{ matrix.node-version }} (${{ matrix.architecture }})
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
architecture: ${{ matrix.architecture }}
# NPM Cache using all package-lock files as hash
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
# Dependencies
- name: Core - Install Dependencies
run: npm ci
# Testing
- name: Core - Run Tests
id: test
# Generate lcov.info file and Mocha test report
run: npm run test:coverage:ci
# Artifact
- name: Core - Upload Test Results
if: ${{ matrix.report_coverage }}
uses: actions/upload-artifact@v3
with:
name: coverage-results
path: ${{ github.workspace }}/**/coverage/lcov.info
# Test Report
- name: Test Report
uses: dorny/test-reporter@v1
if: ${{ matrix.report_coverage }}
with:
name: Mocha Tests
path: ${{ github.workspace }}/**/test-results.json
reporter: mocha-json
# Mark job as successful even if the artifact or test report fails
- run: exit 0
if: ${{ steps.test.outcome == 'success' }}
# Send coverage information to Coveralls
coverage:
name: Coverage(${{ matrix.package }}) - Collection
needs: test
runs-on: ubuntu-latest
defaults:
run:
working-directory: "."
strategy:
# Keep running other versions when a job fails
fail-fast: false
matrix:
# Collect coverage for all packages and plugins
package:
- libraries/analysis-javascript
- libraries/ast-visitor-javascript
- libraries/instrumentation-javascript
- libraries/search-javascript
- tools/javascript
steps:
# Download test results
- uses: actions/download-artifact@v3
with:
name: coverage-results
# Run the Coveralls action which uploads the lcov.info file
- name: Coveralls(${{ matrix.package }})
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# We collect all coverages in parallel
parallel: true
flag-name: ${{ matrix.package }}
path-to-lcov: ${{ github.workspace }}/${{ matrix.package }}/coverage/lcov.info
# Indicate sending coverage to Coveralls is finished
coverage-finished:
name: Coverage - Finish
needs: coverage
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true