-
Notifications
You must be signed in to change notification settings - Fork 67
79 lines (68 loc) · 2.76 KB
/
shared-ci.yml
File metadata and controls
79 lines (68 loc) · 2.76 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
name: Shared CI Tests
on:
workflow_call:
inputs:
test-published-packages:
description: 'Test against published packages instead of checked out code'
required: false
type: boolean
default: false
env:
NODE_OPTIONS: "--max-old-space-size=4096"
NPM_CONFIG_UNSAFE_PERM: true
jobs:
test:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
node-version: ['18.x', '20.x', '22.x', 'latest']
test-type: ['node', 'browser']
# Determine test categories based on whether testing published packages or source code:
# - Testing published packages: only run vector tests (don't have build artifacts to test coverage or compliance)
# - Testing source code: run coverage, vector, and compliance tests
test-category: ${{ fromJSON(inputs['test-published-packages'] && '["vectors"]' || '["coverage", "vectors", "compliance"]') }}
name: test-${{ matrix.test-category }}-${{ matrix.test-type }}-${{ matrix.node-version }}
steps:
- name: Checkout code
# Always need repo for test scripts and configuration, even when testing published packages
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Configure AWS Credentials for Tests
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-MPL-Dafny-Role-us-west-2
role-session-name: JavaScriptTests
- name: Install dependencies
run: npm ci --unsafe-perm
- name: Build (for source code testing)
if: ${{ !inputs.test-published-packages }}
run: npm run build
- name: Run coverage tests (${{ matrix.test-type }})
if: ${{ matrix.test-category == 'coverage' }}
run: npm run coverage-${{ matrix.test-type }}
- name: Publish locally for vector tests
if: ${{ matrix.test-category == 'vectors' && !inputs.test-published-packages }}
run: npm run verdaccio-publish
- name: Run vector tests (${{ matrix.test-type }})
if: ${{ matrix.test-category == 'vectors' }}
run: |
npm run verdaccio-${{ matrix.test-type }}-decrypt
npm run verdaccio-${{ matrix.test-type }}-encrypt
- name: Run compliance tests
# Don't run linting or check Duvet requirements for published packages
if: ${{ matrix.test-category == 'compliance'}}
run: |
npm run lint
npm run test_conditions