Repository navigation
90 lines (77 loc) · 2.72 KB
/
Copy pathtest.yml
File metadata and controls
90 lines (77 loc) · 2.72 KB
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
name: Unit Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
# Permissions are required to post comments on the PR
permissions:
pull-requests: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 26
cache: 'npm' # or 'yarn' / 'pnpm'
- name: Install dependencies
run: |
npm install -g node-gyp
npm ci
env:
# This ensures native modules like isolated-vm build correctly if
# there are versioning quirks with node-gyp
npm_config_build_from_source: true
# Formatting is checked on its own, over the same files `npm run lint` reads; test fixtures are
# decoder inputs and expected outputs, kept byte-exact.
- name: Check formatting
run: npm run format
# The limits and module dependencies in CONTRIBUTING.md.
- name: Lint
run: npm run lint
# Generated VM cells: each suite defines its cells in
# test/vm/jsconfuser-vm/cell-suites/<suite>/suite.js; the pinned encoder is
# cloned with its runtime dependencies, and its output is cached per cell.
# Closure Compiler, used by minify cells, needs a JDK.
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Cache the encoder checkout
uses: actions/cache@v4
with:
path: sandbox-tests/js-confuser-vm
key: vm-encoder-${{ hashFiles('scripts/jsconfuser-vm-cells/audit.mjs', 'scripts/jsconfuser-vm-cells/fetch-encoder.mjs') }}
# Each cell lives under its own key directory, so an older cache entry is
# reused for every cell whose inputs did not change.
- name: Cache generated VM cells
uses: actions/cache@v4
with:
path: sandbox-tests/vm-cells
key: vm-cells-${{ github.run_id }}
restore-keys: vm-cells-
- name: Run Vitest
# We use 'always()' so the report is posted even if tests fail
run: npx vitest run
if: always()
env:
VM_FRESH_SEEDS: 1
- name: Upload generated VM cells
uses: actions/upload-artifact@v4
if: always()
with:
name: vm-cells
path: sandbox-tests/vm-cells
retention-days: 90
- name: Vitest Pull Request Report
uses: davelosert/vitest-coverage-report-action@v2
if: always()
with:
json-summary-path: './coverage/coverage-summary.json'
json-final-path: './coverage/coverage-final.json'