-
Notifications
You must be signed in to change notification settings - Fork 3
238 lines (232 loc) · 8.94 KB
/
test.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
name: "Test"
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
graalvm:
strategy:
matrix:
os: [ubuntu-latest, macos-13, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Cache SBT
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
~/.cache/coursier
~/.ivy2/cache
~/.ivy2/local
~/.sbt/boot
~/.sbt/launchers
key: ${{ runner.os }}-sbt-${{ hashFiles('build.sbt', 'project/plugins.sbt') }}
- name: "Install Nix ❄"
uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: "Install Cachix ❄"
uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15
with:
name: cbley
extraPullNames: pre-commit-hooks
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
pushFilter: '[-](source|nixpkgs-src)$'
- run: git branch PR-${{ github.event.number }}
- run: nix develop '.#graalVM' --command sbt 'scalalsJVM / GraalVMNativeImage / packageBin'
- run: jvm/target/graalvm-native-image/scalals
package:
name: Nix ❄
strategy:
matrix:
os: [ubuntu-latest, macos-13, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 2
persist-credentials: false
- name: "Install Nix ❄"
uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
- name: "Install Cachix ❄"
uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15
with:
name: cbley
extraPullNames: pre-commit-hooks
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
pushFilter: '[-](source|nixpkgs-src)$'
- name: Update scalals.dependencies hash
id: hash-update
if: github.event_name == 'pull_request' && github.repository == 'avdv/scalals'
run: |-
nix develop --command .github/update-hash scalals.dependencies
echo exit=$( git diff --quiet flake.nix ; echo $? ) >> "$GITHUB_OUTPUT"
- name: Set author identity and push url
run: |-
git config user.email '${{ github.actor }}@users.noreply.github.com'
git config user.name '${{ github.actor }}'
git remote set-url --push origin https://x-access-token:${{ secrets.PR_TOKEN }}@github.com/${{ github.repository }}
- name: Push changes to PR
if: steps.hash-update.outputs.exit != '0'
run: |-
git switch -c pr-branch ${{ github.event.pull_request.head.sha }}
git commit -m 'Update scalals.dependencies hash' flake.nix
git push origin HEAD:${{ github.head_ref }}
exit 1
- run: nix flake check
- run: nix build --print-build-logs
- run: nix run
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Cache SBT
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
~/.cache/coursier
~/.ivy2/cache
~/.ivy2/local
~/.sbt/boot
~/.sbt/launchers
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt', '.travis.yml') }}
- name: "Install Nix ❄"
uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
with:
#install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
#install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve'
extra_nix_config: |
experimental-features = nix-command flakes
- name: "Install Cachix ❄"
uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15
with:
name: cbley
extraPullNames: pre-commit-hooks
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
pushFilter: '[-](source|nixpkgs-src)$'
# Only needed for private caches
#authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Determine zig env
run: |
nix develop --ignore-environment --keep HOME --command bash -c \
"( echo 'env<<EOF' ; zig env ; echo EOF ) >> '$GITHUB_OUTPUT'"
id: nix-zig
- name: Cache zig ${{ fromJson(steps.nix-zig.outputs.env).version }}
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
${{ fromJson(steps.nix-zig.outputs.env).global_cache_dir }}
key: zig-${{ fromJson(steps.nix-zig.outputs.env).zig_exe }}
restore-keys: |
zig-
- run: git branch PR-${{ github.event.number }}
- name: Test
run: nix develop --ignore-environment --keep HOME --command sbt tpolecatCiMode 'scalalsNative / test'
- name: Cross Compile
run: nix develop --ignore-environment --keep HOME --keep SCALANATIVE_MODE --command '.github/crosscompile'
env:
SCALANATIVE_MODE: ${{ github.ref == 'refs/heads/main' && 'release-full' || 'debug' }}
- name: qemu-aarch64 scalals
run: nix shell --inputs-from . 'nixpkgs#qemu' --command qemu-aarch64 scalals-linux-aarch64
- name: qemu-risc64 scalals
run: nix shell --inputs-from . 'nixpkgs#qemu' --command qemu-riscv64 scalals-linux-riscv64
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4
with:
path: scalals-*
run:
name: Run
strategy:
matrix:
os:
- ubuntu-latest
- macos-14
needs:
- tests
runs-on:
${{ matrix.os }}
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
id: download
- run: |
ls -lh
chmod +x scalals-*
working-directory: ${{steps.download.outputs.download-path}}/artifact
- run: ./scalals-${{ runner.os == 'Linux' && 'linux' || 'darwin' }}-x86_64
working-directory: ${{steps.download.outputs.download-path}}/artifact
- run: ./scalals-${{ runner.os == 'Linux' && 'linux' || 'darwin' }}-aarch64
if: ${{ runner.arch == 'ARM64' }}
working-directory: ${{steps.download.outputs.download-path}}/artifact
release:
name: Prepare release
if: github.ref == 'refs/heads/main'
needs:
- run
runs-on: ubuntu-latest
permissions:
# write permission is required to create a github release
contents: write
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
- name: Rename binaries
run: |
mv artifact/scalals-linux-aarch64 scalals-arm64-linux
mv artifact/scalals-linux-riscv64 scalals-riscv64-linux
mv artifact/scalals-linux-x86_64 scalals-x86_64-linux
mv artifact/scalals-darwin-aarch64 scalals-arm64-darwin
mv artifact/scalals-darwin-x86_64 scalals-x86_64-darwin
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload binaries
run: |
gh release upload '${{ steps.release.outputs.tag_name }}' \
scalals-arm64-linux \
scalals-arm64-darwin \
scalals-riscv64-linux \
scalals-x86_64-linux \
scalals-x86_64-darwin \
--clobber --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
benchmark:
name: Benchmark
if: github.ref == 'refs/heads/main'
needs:
- run
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
- name: ⚙ Install hyperfine
run: |-
sudo apt-get update
sudo apt-get install -y hyperfine
- run: |-
mv artifact/scalals-linux-x86_64 scalals-x86_64-linux
chmod +x scalals-x86_64-linux
- uses: bencherdev/bencher@main
- name: Track base branch benchmarks with Bencher
run: |
bencher run \
--project scalals \
--token '${{ secrets.BENCHER_API_TOKEN }}' \
--branch ${{ github.head_ref || github.ref_name }} \
--testbed ubuntu-latest \
--threshold-measure latency \
--threshold-test t_test \
--threshold-max-sample-size 64 \
--threshold-upper-boundary 0.99 \
--thresholds-reset \
--err \
--adapter shell_hyperfine \
--file ../results.json \
--github-actions '${{ secrets.GITHUB_TOKEN }}' \
"hyperfine -w 2 --export-json ../results.json './scalals-x86_64-linux --tree --color'"