-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (88 loc) · 3 KB
/
nodejs.yml
File metadata and controls
104 lines (88 loc) · 3 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Node.js (jacsnpm)
on:
push:
branches: ["main"]
paths:
- 'jacsnpm/**'
- 'jacs/**' # jacsnpm depends on jacs
- 'binding-core/**' # jacsnpm verifyStandalone depends on binding-core
- '.github/workflows/nodejs.yml'
pull_request:
branches: ["main"]
paths:
- 'jacsnpm/**'
- 'jacs/**' # jacsnpm depends on jacs
- 'binding-core/**' # jacsnpm verifyStandalone depends on binding-core
- '.github/workflows/nodejs.yml'
workflow_dispatch: # Allows manual triggering
env:
CARGO_TERM_COLOR: always
concurrency:
group: node-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test-jacsnpm:
name: Test jacsnpm (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: ['20']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.93"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: jacsnpm/package-lock.json
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2
- name: Install dependencies
working-directory: jacsnpm
run: npm ci
- name: Run npm audit
working-directory: jacsnpm
run: npm audit --audit-level=high || true
- name: Build native module
working-directory: jacsnpm
run: npm run build
- name: Run cross-language tests (hermetic env)
working-directory: jacsnpm
env:
JACS_DATA_DIRECTORY: /tmp/does-not-exist
JACS_KEY_DIRECTORY: /tmp/does-not-exist
JACS_DEFAULT_STORAGE: memory
JACS_KEY_RESOLUTION: local
run: npm run test:cross-language
- name: Run tests (parallel, excluding cross-language already covered above)
working-directory: jacsnpm
run: npm run test:ci
- name: Run parity tests (binding contract conformance)
working-directory: jacsnpm
run: node --test tests/test_parity.js
- name: Smoke test quickstart example
working-directory: jacsnpm
env:
JACS_PRIVATE_KEY_PASSWORD: TestP@ss123!#
run: |
set -euo pipefail
TMP_EXAMPLE_DIR=$(mktemp -d)
cd "${TMP_EXAMPLE_DIR}"
node "${GITHUB_WORKSPACE}/jacsnpm/examples/quickstart.js"
- name: Smoke test packed npm install
working-directory: jacsnpm
run: |
set -euo pipefail
PACKAGE_TGZ=$(npm pack | tail -n 1)
mkdir -p /tmp/jacs-npm-smoke
cd /tmp/jacs-npm-smoke
npm init -y >/dev/null
npm install "${GITHUB_WORKSPACE}/jacsnpm/${PACKAGE_TGZ}" --ignore-scripts
ls node_modules/@hai.ai/jacs/package.json && echo "smoke install ok"