-
Notifications
You must be signed in to change notification settings - Fork 1
195 lines (178 loc) Β· 5.89 KB
/
build-wasm.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: Build WASM
env:
V8_BRANCH: 11.2.60
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- v1.x
- v2.x
jobs:
check-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: node scripts/version-checker.js
- run: node scripts/check_licenses.js
test-native:
strategy:
matrix:
target:
- name: linux 64 bits
os: ubuntu-latest
- name: windows 64 bits
os: windows-latest
- name: macos 64 bits
os: macos-latest
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v3
- name: test
run: |
cargo check
cargo test
wasm-pack:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- name: linux 64 bits
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: |
cargo install [email protected]
npm ci --ignore-scripts
npm run build
rm wasm/README.md wasm/package.json wasm/.gitignore
npm pack
- uses: codex-team/[email protected]
id: package
- uses: actions/upload-artifact@v3
with:
name: datadog-native-iast-rewriter-${{ steps.package.outputs.version }}
path: '*.tgz'
static-checks:
strategy:
matrix:
run:
- lint
- clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm ci
- run: npm run ${{ matrix.run }}
test-native-js:
needs: ['wasm-pack']
strategy:
matrix:
target:
- name: linux 64 bits
os: ubuntu-latest
architecture: x64
- name: windows 64 bits
os: windows-latest
architecture: x64
- name: windows 32 bits
os: windows-latest
architecture: x86
- name: macos 64 bits
os: macos-latest
architecture: x64
runs-on: ${{ matrix.target.os }}
permissions:
checks: write
env:
NPM_REWRITER: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
architecture: ${{ matrix.target.arch }}
- run: npm ci --ignore-scripts
- uses: codex-team/[email protected]
id: package
- uses: actions/download-artifact@v3
with:
name: datadog-native-iast-rewriter-${{ steps.package.outputs.version }}
- run: npm i datadog-native-iast-rewriter-${{ steps.package.outputs.version }}.tgz
- run: npm run test:junit
- run: npm run test:integration:ci
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/build/junit*.xml'
check_name: junit test report ${{ matrix.target.name }}
test-docker:
needs: ['wasm-pack']
runs-on: ubuntu-latest
permissions:
checks: write
strategy:
matrix:
target:
- name: alpine 64 bits
dockerfile: test.alpine.Dockerfile
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- uses: codex-team/[email protected]
id: package
- uses: actions/download-artifact@v3
with:
name: datadog-native-iast-rewriter-${{ steps.package.outputs.version }}
- run: docker build -t test -f ./docker/${{ matrix.target.dockerfile }} --build-arg NPM_VERSION=${{ steps.package.outputs.version }} .
- run: docker run --name tester test
- run: docker cp tester:/test/build/junit.xml ./junit.xml
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/junit.xml'
check_name: junit test report ${{ matrix.target.name }}
compile-v8-and-run-tests:
needs: ['wasm-pack']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: codex-team/[email protected]
id: package
- uses: actions/download-artifact@v3
with:
name: datadog-native-iast-rewriter-${{ steps.package.outputs.version }}
- name: Restore v8 builder Image
id: cache-docker-v8
uses: actions/cache@v3
with:
path: ci/cache/docker/v8builder
key: cache-docker-v8builder-${{ env.V8_BRANCH }}
- name: Update v8 builder Image Cache if cache miss
if: steps.cache-docker-v8.outputs.cache-hit != 'true'
run: docker build -t v8builder:${{ env.V8_BRANCH }} --build-arg V8_BRANCH=${{ env.V8_BRANCH }} -f ./docker/v8test-builder.Dockerfile . && mkdir -p ci/cache/docker/v8builder && docker image save v8builder:${{ env.V8_BRANCH }} --output ./ci/cache/docker/v8builder/v8builder-${{ env.V8_BRANCH }}.tar
- name: Use v8 builder Image Cache if cache hit
if: steps.cache-docker-v8.outputs.cache-hit == 'true'
run: docker image load --input ./ci/cache/docker/v8builder/v8builder-${{ env.V8_BRANCH }}.tar
- name: Rewrite and run v8 tests
id: run-tests
run: docker build -t v8tester:${{ env.V8_BRANCH }} --build-arg V8_BRANCH=${{ env.V8_BRANCH }} -f ./docker/v8test.Dockerfile . && docker run --name v8tester v8tester:${{ env.V8_BRANCH }}
- name: Rewrite summary
id: rewrite-summary
run: docker cp v8tester:/build/out/rewritingErrors.log ./rewritingErrors.log && cat ./rewritingErrors.log >> $GITHUB_STEP_SUMMARY
all-good:
needs: ['static-checks', 'test-native', 'test-native-js', 'test-docker', 'compile-v8-and-run-tests']
runs-on: ubuntu-latest
steps:
- run: echo 'πππππ'