-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (82 loc) · 2.58 KB
/
ci.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
name: Project build
on:
pull_request:
release:
types: [released]
jobs:
build:
name: Build the project
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup Emscripten SDK
uses: mymindstorm/setup-emsdk@v14
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Print used libsodium revision
run: |
git -C libsodium rev-parse HEAD
- name: Build libsodium for WASM
run: ./scripts/build-libsodium.sh
- name: Upload the WASM binaries as an artifact
uses: actions/upload-artifact@v4
id: upload-libsodium
with:
name: libsodium-wasm-build
path:
wasm/*
test:
name: Test the project
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Checkout the repository
uses: actions/checkout@v4
- name: Download the WASM binaries
uses: actions/download-artifact@v4
with:
name: libsodium-wasm-build
- name: Install dependencies
run: npm install
- name: Run the tests
# we're forcing the spec reporter to get a human friendly output as there's no GHA-specific reporter in node:test
run: node --test --test-reporter=spec test.js
release:
name: ${{ github.event_name == 'release' && 'Release' || 'Pack' }} the project
runs-on: ubuntu-latest
needs: [build, test]
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Checkout the repository
uses: actions/checkout@v4
- name: Download the WASM binaries
uses: actions/download-artifact@v4
with:
name: libsodium-wasm-build
- name: Package the project
run: |
mkdir -p ${{ runner.temp }}/gha-dist
npm pack . --pack-destination ${{ runner.temp }}/gha-dist/
- name: Upload the built package as an artifact
uses: actions/upload-artifact@v4
with:
name: npm-package
path:
${{ runner.temp }}/gha-dist/*.tgz
- name: Publish the package to NPM
if: github.event_name == 'release'
env:
NPM_TOKEN: ${{ github.event_name == 'release' && secrets.NPM_TOKEN || '' }}
run: npm publish --provenance --access public ${{ runner.temp }}/gha-dist/*.tgz