Repository navigation
69 lines (65 loc) · 2.33 KB
/
Copy pathrun_test.yml
File metadata and controls
69 lines (65 loc) · 2.33 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
name: Test JData
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [ "12", "14", "16", "18", "20", "22" ]
steps:
- uses: actions/checkout@v4
- name: Check out bjd (for the BJData tests)
uses: actions/checkout@v4
with:
repository: NeuroJSON/js-bjdata
path: bjd-src
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Build bjd
run: |
cd bjd-src
npm ci
npm run build
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Unit tests
run: BJD=bjd-src/dist/bjdata.cjs npm test
- name: Install the packed package as users do, then load it
run: |
npm pack
mkdir "$RUNNER_TEMP/user" && cd "$RUNNER_TEMP/user"
npm init -y > /dev/null
npm install "$GITHUB_WORKSPACE"/jda-*.tgz
node -e "const jd = require('jda'); const v = new Float32Array(300000).map((x, i) => Math.sin(i)); jd.parseAsync(jd.stringify({v}, {compression: 'zlib'})).then((r) => { if (r.v.data[12345] !== v[12345] || r.v.shape[0] !== 300000) process.exit(1); console.log('jda', jd.version, 'ok'); })"
deploy:
runs-on: ubuntu-22.04
needs: test
permissions:
contents: read
id-token: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Update npm (trusted publishing needs npm 11.5.1 or later)
run: npm install -g npm@latest
- name: Install dependencies and build
run: |
npm ci
npm run build
- name: Check If the Version Exists on npm
id: perform_npm_upload_check
shell: bash
run: |
$GITHUB_WORKSPACE/.github/check-npm-upload.sh
- name: Upload package to npm (trusted publishing through OIDC, no token; with provenance)
if: ${{ github.actor == 'fangq' && steps.perform_npm_upload_check.outputs.perform_npm_upload == 1 && github.event_name != 'pull_request' }}
run: npm publish --access public