-
Notifications
You must be signed in to change notification settings - Fork 13
182 lines (170 loc) · 6.24 KB
/
main.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: Build
on: [push, pull_request]
jobs:
linux:
name: Build (${{ matrix.os }}, OTP-${{ matrix.otp_version }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
otp_version: [20, 21, 22, 23, 24, 25, 26]
os: [ubuntu-latest]
container:
image: erlang:${{ matrix.otp_version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get branch name
id: branch-name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- name: Get some info
run: |
pwd
whoami
- name: Install system packages
run: |
apt update
apt install stockfish -y
apt install socat -y
- name: Run Stockfish as TCP service
run: |
export STOCKFISH_EXEC_PATH=/usr/games/stockfish
ls -l ${STOCKFISH_EXEC_PATH}
socat TCP-LISTEN:9010,reuseaddr,fork EXEC:${STOCKFISH_EXEC_PATH} &
- name: Cache Dialyzer PLTs
uses: actions/cache@v3
with:
path: |
~/.cache/rebar3/rebar3_*_plt
_build/default/rebar3_*_plt
key: ${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-otp-${{ matrix.otp_version }}-plt-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.config')) }}
restore-keys: |
${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-otp-${{ matrix.otp_version }}-plt-
- name: Cache Hex packages
uses: actions/cache@v3
with:
path: ~/.cache/rebar3/hex/hexpm/packages
key: ${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-otp-${{ matrix.otp_version }}-hex-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.lock')) }}
restore-keys: |
${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-otp-${{ matrix.otp_version }}-hex-
- name: Compile
run: rebar3 compile
- name: CT tests
run: |
export BINBO_UCI_ENGINE_PATH=/usr/games/stockfish
export BINBO_UCI_ENGINE_HOST=localhost
export BINBO_UCI_ENGINE_PORT=9010
rebar3 ct
- name: Dialyzer
run: rebar3 dialyzer
- name: Code coverage
run: rebar3 cover
- name: Generate coverage report
run: rebar3 covertool generate
- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash) -f _build/test/covertool/binbo.covertool.xml
macos:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
os: [macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get branch name
id: branch-name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- name: Install Erlang
run: brew install erlang
- name: Install rebar3
run: brew install rebar3
- name: Install Stockfish
run: brew install stockfish
- name: Start Stockfish TCP Server
run: launchctl load test/helper-files/org.stockfish.x86.plist
- name: Cache Dialyzer PLTs
uses: actions/cache@v3
with:
path: |
~/.cache/rebar3/rebar3_*_plt
_build/default/rebar3_*_plt
key: ${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-plt-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.config')) }}
restore-keys: |
${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-plt-
- name: Cache Hex packages
uses: actions/cache@v3
with:
path: ~/.cache/rebar3/hex/hexpm/packages
key: ${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-hex-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.lock')) }}
restore-keys: |
${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-hex-
- name: Compile
run: rebar3 compile
- name: CT tests
run: |
export BINBO_UCI_ENGINE_PATH=/usr/local/bin/stockfish
export BINBO_UCI_ENGINE_HOST=localhost
export BINBO_UCI_ENGINE_PORT=9010
rebar3 ct
- name: Code coverage
run: rebar3 cover
windows:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: powershell
strategy:
matrix:
os: [windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get branch name
id: branch-name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- name: Install Erlang
run: choco install erlang -y
- name: Install rebar3
run: |
mkdir ~/rebar3-dl
Invoke-WebRequest -Uri https://github.com/erlang/rebar3/releases/download/3.18.0/rebar3 -OutFile ~/rebar3-dl/rebar3
Copy-Item -Path .\test\helper-files\rebar3.cmd -Destination ~/rebar3-dl/rebar3.cmd
- name: Install Stockfish
run: |
Invoke-WebRequest -Uri https://github.com/official-stockfish/Stockfish/releases/download/sf_16/stockfish-windows-x86-64.zip -OutFile ~/stockfish-windows-x86-64.zip
Expand-Archive -LiteralPath '~/stockfish-windows-x86-64.zip' -DestinationPath ~/
- name: Cache Dialyzer PLTs
uses: actions/cache@v3
with:
path: |
~/.cache/rebar3/rebar3_*_plt
_build/default/rebar3_*_plt
key: ${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-plt-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.config')) }}
restore-keys: |
${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-plt-
- name: Cache Hex packages
uses: actions/cache@v3
with:
path: ~/.cache/rebar3/hex/hexpm/packages
key: ${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-hex-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.lock')) }}
restore-keys: |
${{ runner.os }}-${{ steps.branch-name.outputs.branch }}-hex-
- name: Compile
run: ~/rebar3-dl/rebar3.cmd compile
- name: CT tests
run: |
$env:BINBO_UCI_ENGINE_PATH = (Resolve-Path '~/stockfish/stockfish-windows-x86-64.exe').Path.replace('\', '/')
echo "BINBO_UCI_ENGINE_PATH=$env:BINBO_UCI_ENGINE_PATH"
~/rebar3-dl/rebar3.cmd ct
- name: Code coverage
run: ~/rebar3-dl/rebar3.cmd cover