Skip to content

Commit 206cceb

Browse files
authored
Merge pull request #38 from COMBINE-lab/main
merge main back into dev
2 parents 0e8ba08 + 6b7a976 commit 206cceb

18 files changed

Lines changed: 3238 additions & 1313 deletions

.cargo/config-portable.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# inspired by https://curiouscoding.nl/posts/release-flow/#avx2
2+
3+
# .cargo/config-portable.toml
4+
[target.x86_64-unknown-linux-gnu]
5+
rustflags = ["-C", "target-cpu=x86-64-v3", "-C", "target-feature=+avx2"]
6+
7+
[target.aarch64-unknown-linux-gnu]
8+
rustflags = ["-C", "target-cpu=neoverse-n1"]
9+
10+
[target.aarch64-apple-darwin]
11+
rustflags = ["-C", "target-cpu=apple-a14"]
12+
13+
[target.x86_64-apple-darwin]
14+
rustflags = ["-C", "target-cpu=x86-64-v3", "-C", "target-feature=+avx2"]

.cargo/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# taken from https://curiouscoding.nl/posts/release-flow/#avx2
2+
[build]
3+
# By default, we want maximum performance rather than portability.
4+
rustflags = ["-C", "target-cpu=native"]

.github/build-setup.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
- name: Use portable Cargo config for CI builds
2+
shell: bash
3+
run: |
4+
set -euo pipefail
5+
cp .cargo/config-portable.toml .cargo/config.toml
6+
7+
- name: Force AVX2 for x86_64 (via RUSTFLAGS)
8+
if: contains(join(matrix.targets, ','), 'x86_64-')
9+
shell: bash
10+
run: |
11+
set -euo pipefail
12+
echo 'RUSTFLAGS=-C target-cpu=x86-64-v3 -C target-feature=+avx2' >> "$GITHUB_ENV"
13+
14+
- name: Show effective x86_64 rustflags (proof)
15+
if: contains(join(matrix.targets, ','), 'x86_64-')
16+
shell: bash
17+
run: |
18+
set -euo pipefail
19+
echo "RUSTFLAGS=${RUSTFLAGS-}"

.github/workflows/release.yml

Lines changed: 56 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/
1+
# This file was autogenerated by dist: https://axodotdev.github.io/cargo-dist
22
#
33
# Copyright 2022-2024, axodotdev
44
# SPDX-License-Identifier: MIT or Apache-2.0
@@ -47,7 +47,7 @@ on:
4747
jobs:
4848
# Run 'dist plan' (or host) to determine what tasks we need to do
4949
plan:
50-
runs-on: "ubuntu-20.04"
50+
runs-on: "ubuntu-22.04"
5151
outputs:
5252
val: ${{ steps.plan.outputs.manifest }}
5353
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
@@ -56,16 +56,17 @@ jobs:
5656
env:
5757
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5858
steps:
59-
- uses: actions/checkout@v4
59+
- uses: actions/checkout@v6
6060
with:
61+
persist-credentials: false
6162
submodules: recursive
6263
- name: Install dist
6364
# we specify bash to get pipefail; it guards against the `curl` command
6465
# failing. otherwise `sh` won't catch that `curl` returned non-0
6566
shell: bash
66-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.24.1/cargo-dist-installer.sh | sh"
67+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.31.0/cargo-dist-installer.sh | sh"
6768
- name: Cache dist
68-
uses: actions/upload-artifact@v4
69+
uses: actions/upload-artifact@v6
6970
with:
7071
name: cargo-dist-cache
7172
path: ~/.cargo/bin/dist
@@ -81,7 +82,7 @@ jobs:
8182
cat plan-dist-manifest.json
8283
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
8384
- name: "Upload dist-manifest.json"
84-
uses: actions/upload-artifact@v4
85+
uses: actions/upload-artifact@v6
8586
with:
8687
name: artifacts-plan-dist-manifest
8788
path: plan-dist-manifest.json
@@ -107,21 +108,47 @@ jobs:
107108
# - N "local" tasks that build each platform's binaries and platform-specific installers
108109
matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
109110
runs-on: ${{ matrix.runner }}
111+
container: ${{ matrix.container && matrix.container.image || null }}
110112
env:
111113
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112114
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
113115
steps:
114116
- name: enable windows longpaths
115117
run: |
116118
git config --global core.longpaths true
117-
- uses: actions/checkout@v4
119+
- uses: actions/checkout@v6
118120
with:
121+
persist-credentials: false
119122
submodules: recursive
123+
- name: Install Rust non-interactively if not already installed
124+
if: ${{ matrix.container }}
125+
run: |
126+
if ! command -v cargo > /dev/null 2>&1; then
127+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
128+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
129+
fi
130+
- name: "Use portable Cargo config for CI builds"
131+
run: |
132+
set -euo pipefail
133+
cp .cargo/config-portable.toml .cargo/config.toml
134+
shell: "bash"
135+
- name: "Force AVX2 for x86_64 (via RUSTFLAGS)"
136+
if: "contains(join(matrix.targets, ','), 'x86_64-')"
137+
run: |
138+
set -euo pipefail
139+
echo 'RUSTFLAGS=-C target-cpu=x86-64-v3 -C target-feature=+avx2' >> "$GITHUB_ENV"
140+
shell: "bash"
141+
- name: "Show effective x86_64 rustflags (proof)"
142+
if: "contains(join(matrix.targets, ','), 'x86_64-')"
143+
run: |
144+
set -euo pipefail
145+
echo "RUSTFLAGS=${RUSTFLAGS-}"
146+
shell: "bash"
120147
- name: Install dist
121-
run: ${{ matrix.install_dist }}
148+
run: ${{ matrix.install_dist.run }}
122149
# Get the dist-manifest
123150
- name: Fetch local artifacts
124-
uses: actions/download-artifact@v4
151+
uses: actions/download-artifact@v7
125152
with:
126153
pattern: artifacts-*
127154
path: target/distrib/
@@ -143,12 +170,12 @@ jobs:
143170
run: |
144171
# Parse out what we just built and upload it to scratch storage
145172
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
146-
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
173+
dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
147174
echo "EOF" >> "$GITHUB_OUTPUT"
148175
149176
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
150177
- name: "Upload artifacts"
151-
uses: actions/upload-artifact@v4
178+
uses: actions/upload-artifact@v6
152179
with:
153180
name: artifacts-build-local-${{ join(matrix.targets, '_') }}
154181
path: |
@@ -160,23 +187,24 @@ jobs:
160187
needs:
161188
- plan
162189
- build-local-artifacts
163-
runs-on: "ubuntu-20.04"
190+
runs-on: "ubuntu-22.04"
164191
env:
165192
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
166193
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
167194
steps:
168-
- uses: actions/checkout@v4
195+
- uses: actions/checkout@v6
169196
with:
197+
persist-credentials: false
170198
submodules: recursive
171199
- name: Install cached dist
172-
uses: actions/download-artifact@v4
200+
uses: actions/download-artifact@v7
173201
with:
174202
name: cargo-dist-cache
175203
path: ~/.cargo/bin/
176204
- run: chmod +x ~/.cargo/bin/dist
177205
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
178206
- name: Fetch local artifacts
179-
uses: actions/download-artifact@v4
207+
uses: actions/download-artifact@v7
180208
with:
181209
pattern: artifacts-*
182210
path: target/distrib/
@@ -194,7 +222,7 @@ jobs:
194222
195223
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
196224
- name: "Upload artifacts"
197-
uses: actions/upload-artifact@v4
225+
uses: actions/upload-artifact@v6
198226
with:
199227
name: artifacts-build-global
200228
path: |
@@ -206,26 +234,27 @@ jobs:
206234
- plan
207235
- build-local-artifacts
208236
- build-global-artifacts
209-
# Only run if we're "publishing", and only if local and global didn't fail (skipped is fine)
210-
if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
237+
# Only run if we're "publishing", and only if plan, local and global didn't fail (skipped is fine)
238+
if: ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
211239
env:
212240
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
213-
runs-on: "ubuntu-20.04"
241+
runs-on: "ubuntu-22.04"
214242
outputs:
215243
val: ${{ steps.host.outputs.manifest }}
216244
steps:
217-
- uses: actions/checkout@v4
245+
- uses: actions/checkout@v6
218246
with:
247+
persist-credentials: false
219248
submodules: recursive
220249
- name: Install cached dist
221-
uses: actions/download-artifact@v4
250+
uses: actions/download-artifact@v7
222251
with:
223252
name: cargo-dist-cache
224253
path: ~/.cargo/bin/
225254
- run: chmod +x ~/.cargo/bin/dist
226255
# Fetch artifacts from scratch-storage
227256
- name: Fetch artifacts
228-
uses: actions/download-artifact@v4
257+
uses: actions/download-artifact@v7
229258
with:
230259
pattern: artifacts-*
231260
path: target/distrib/
@@ -238,14 +267,14 @@ jobs:
238267
cat dist-manifest.json
239268
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
240269
- name: "Upload dist-manifest.json"
241-
uses: actions/upload-artifact@v4
270+
uses: actions/upload-artifact@v6
242271
with:
243272
# Overwrite the previous copy
244273
name: artifacts-dist-manifest
245274
path: dist-manifest.json
246275
# Create a GitHub Release while uploading all files to it
247276
- name: "Download GitHub Artifacts"
248-
uses: actions/download-artifact@v4
277+
uses: actions/download-artifact@v7
249278
with:
250279
pattern: artifacts-*
251280
path: artifacts
@@ -274,10 +303,11 @@ jobs:
274303
# still allowing individual publish jobs to skip themselves (for prereleases).
275304
# "host" however must run to completion, no skipping allowed!
276305
if: ${{ always() && needs.host.result == 'success' }}
277-
runs-on: "ubuntu-20.04"
306+
runs-on: "ubuntu-22.04"
278307
env:
279308
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
280309
steps:
281-
- uses: actions/checkout@v4
310+
- uses: actions/checkout@v6
282311
with:
312+
persist-credentials: false
283313
submodules: recursive
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Sanitize Cargo
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions:
8+
"contents": "write"
9+
10+
jobs:
11+
sanitize_cargo_file:
12+
if: "contains(github.event.head_commit.message, '[do_tag]')"
13+
runs-on: ubuntu-latest
14+
# This is optional; it exposes the plan to your job as an environment variable
15+
#env:
16+
# PLAN: ${{ inputs.plan }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.PAT_TOK }}
21+
- uses: dtolnay/rust-toolchain@stable
22+
- name: Install cargo-sanitize
23+
run: |
24+
cargo install cargo-sanitize
25+
- name: Sanitize Cargo.toml file
26+
run: |
27+
cp Cargo.toml Cargo.toml.cs_orig
28+
cargo-sanitize -i Cargo.toml.cs_orig -o Cargo.toml
29+
- name: Tag and push new commit
30+
run: |
31+
export VERSION_TAG=`cargo read-manifest | jq ".version" | tr -d '"'`
32+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
33+
git config --local user.name "github-actions[bot]"
34+
git add Cargo.toml.cs_orig
35+
git add Cargo.toml
36+
git commit -m "create sanitized release"
37+
git tag --force -a v${VERSION_TAG} -m "version ${VERSION_TAG}"
38+
git push --force origin v${VERSION_TAG}

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,14 @@ Cargo.lock
88

99
# These are backup files generated by rustfmt
1010
**/*.rs.bk
11+
12+
# Local cargo config (contains dev-only [patch] overrides)
13+
# .cargo/config.toml
14+
radtk/
15+
gencode_v49/
16+
gencode_v49_new/
17+
piscem-cpp/
18+
sshash/
19+
sample_quant_new/
20+
sample_quant/
21+

.gitmodules

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)