-
Notifications
You must be signed in to change notification settings - Fork 41
170 lines (163 loc) · 5.27 KB
/
ci-workflow.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: native-metrics CI
on:
pull_request:
push:
branches:
- '**'
tags-ignore: # Do not run for tags
- '**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [lts/*]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
- name: Run Linting
run: npm run lint
- name: Inspect Lockfile
run: npm run lint:lockfile
# test_x86_x64:
# strategy:
# matrix:
# os: [ ubuntu-latest, windows-latest, windows-2019 ]
# node: [ 16, 18, 20 ]
# arch: [ x86, x64 ]
# exclude:
# # Ubuntu does not ship x86 builds.
# - { os: ubuntu-latest, arch: x86 }
# runs-on: ${{ matrix.os }}
# name: ${{ matrix.os }} / Node ${{ matrix.node }} ${{ matrix.arch }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Use node ${{ matrix.node }}
# uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node }}
# architecture: ${{ matrix.arch }}
# - name: Install
# run: npm install
# - name: Unit Test
# run: npm run unit
# - name: Post Unit Test Coverage
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# directory: ./coverage/unit/
# files: lcov.info
# flags: unit-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix.arch }}
# - name: Integration Test
# run: npm run integration
# - name: Post Integration Test Coverage
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# directory: ./coverage/integration/
# files: lcov.info
# flags: integration-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix.arch }}
#
#
# test_macos_arm:
# strategy:
# matrix:
# os: [ macos-14 ]
# node: [ 16, 18, 20 ]
# arch: [ arm64 ]
# runs-on: ${{ matrix.os }}
# name: ${{ matrix.os }} / Node ${{ matrix.node }} ${{ matrix.arch }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Use node ${{ matrix.node }}
# uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node }}
# architecture: ${{ matrix.arch }}
# - name: Install
# run: npm install
# - name: Unit Test
# run: npm run unit
# - name: Post Unit Test Coverage
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# directory: ./coverage/unit/
# files: lcov.info
# flags: unit-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix.arch }}
# - name: Integration Test
# run: npm run integration
# - name: Post Integration Test Coverage
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# directory: ./coverage/integration/
# files: lcov.info
# flags: integration-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix.arch }}
test_linux_arm:
# Skip this group if the PR doesn't originate from the main repo.
# Trying to run this on standard runners is just going to fail due to
# lack of CPU resources.
if: ${{ vars.NR_RUNNER != '' }}
strategy:
max-parallel: 1
matrix:
node: [ 16, 18, 20 ]
runs-on: ${{ vars.NR_RUNNER }}
name: Linux / Node ${{ matrix.node }} arm64
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore modules cache
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/node_modules
key: linux-arm-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
context: .
build-args: |
NODE_VERSION=${{ matrix.node }}
file: linux_arm.dockerfile
tags: linux_arm:node-${{ matrix.node }}
load: true
push: false
platforms: linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run test
uses: addnab/docker-run-action@v3
with:
image: linux_arm:node-${{ matrix.node }}
options: --platform linux/arm64 -v ${{ github.workspace }}:/host
run: |
cp -R /host/node_modules . 2>/dev/null
rm -rf /host/node_modules 2>/dev/null
npm install --verbose
cp -R node_modules /host/
npm run unit
npm run integration
- name: Update modules cache
uses: actions/cache/save@v4
# We always want to run this step even if the "test" step failed.
if: '!cancelled()'
with:
path: ${{ github.workspace }}/node_modules
key: linux-arm-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}