forked from lichess-org/stockfish.wasm
-
-
Notifications
You must be signed in to change notification settings - Fork 9
119 lines (99 loc) · 3.69 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: CI
on: [push]
jobs:
lint:
runs-on: ubuntu-20.04
defaults:
run:
working-directory: src/emscripten
steps:
- uses: actions/checkout@v2
- run: npm install prettier
- run: npm run format:check
- run: npm run shellcheck
test:
runs-on: ubuntu-20.04
defaults:
run:
working-directory: src/emscripten
strategy:
matrix:
wasm_simd: ['yes', 'no']
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: docker-compose pull
- name: Extract bench signature from git log
run: echo "sign_ref=$(bash misc/git-log-bench-signature.sh)" >> $GITHUB_ENV
- name: Build Stockfish
run: >
DOCKER_USER=$(id -u):$(id -g) docker-compose run emscripten
make -C .. emscripten_build ARCH=wasm wasm_simd=${{ matrix.wasm_simd }}
- name: Test bench signature (Node)
run: >
docker-compose run -e uci_exe="node public/uci.js" -e sign_ref=${{ env.sign_ref }} node
bash tests/bench-signature.sh
- name: Test bench NPS (Node)
if: ${{ matrix.wasm_simd == 'yes' }}
run: >
docker-compose run -e uci_exe="node public/uci.js" node
bash tests/bench-nps.sh
- name: Run server for headless testing
run: npm install serve && (npm run serve & sleep 5)
- name: Test bench signature (Browser)
run: >
docker-compose run -e uci_exe="node public/uci-puppeteer.js" -e sign_ref=${{ env.sign_ref }} browser
bash tests/bench-signature.sh
- name: Test bench NPS (Browser)
if: ${{ matrix.wasm_simd == 'yes' }}
run: >
docker-compose run -e uci_exe="node public/uci-puppeteer.js" -e nps_target=100000 browser
bash tests/bench-nps.sh
- name: Test stress (Node)
if: ${{ matrix.wasm_simd == 'yes' }}
run: >
docker-compose run -e uci_exe="node public/uci.js" -e n=30 node
bash tests/stress.sh
- name: Test stress (Browser)
if: ${{ matrix.wasm_simd == 'yes' }}
run: >
docker-compose run -e uci_exe="node public/uci-puppeteer.js" -e n=15 browser
bash tests/stress.sh
test-no-embedded-nnue:
runs-on: ubuntu-20.04
defaults:
run:
working-directory: src/emscripten
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: docker-compose pull emscripten node
- name: Extract bench signature from git log
run: echo "sign_ref=$(bash misc/git-log-bench-signature.sh)" >> $GITHUB_ENV
- name: Extract default net name
run: echo "default_net=$(make -C .. net | grep "Default net" | awk '{ print $NF }')" >> $GITHUB_ENV
- name: Build Stockfish
run: >
DOCKER_USER=$(id -u):$(id -g) docker-compose run emscripten
make -C .. emscripten_build ARCH=wasm embedded_nnue=no
- name: Verify stockfish.wasm < 2MB
run: >
[ $(wc -c public/stockfish.wasm | awk '{ print $1 }') -lt 2000000 ]
- name: Test bench signature (Node)
run: >
docker-compose run -e uci_exe="node public/uci.js" -e sign_ref=${{ env.sign_ref }} -e UCI_NNUE_FILE="../${{ env.default_net }}" node
bash tests/bench-signature.sh
- uses: actions/upload-artifact@v3
with:
name: no-embedded-nnue
path: src/emscripten/public/stockfish*
- name: Publish to NPM
if: startsWith(github.ref, 'refs/tags/')
working-directory: src/emscripten/public
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}