Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Builds Linux and Windows binaries when a version tag (v1.2.0, ...) is pushed and attaches them to a draft release,
# which is published by hand. CUDA kernels compile at run time through NVRTC and the Vulkan shaders are committed,
# so the build needs neither the CUDA toolkit nor a Vulkan SDK.
# Builds Linux (x86_64 & aarch64) and Windows binaries when a version tag (v1.2.0, ...) is pushed and attaches them
# to a draft release, which is published by hand. CUDA kernels compile at run time through NVRTC and the Vulkan shaders
# are committed, so the build needs neither the CUDA toolkit nor a Vulkan SDK.
name: release
on:
push:
Expand All @@ -21,29 +21,50 @@ jobs:
matrix:
include:
- os: ubuntu-22.04 # the oldest glibc the binary will need
target: x86_64-unknown-linux-gnu
rustflags: -C target-cpu=x86-64-v3
bin: rustingstrata
asset: rustingstrata-linux-x86_64
cross: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low · Maintainability · 1 of 3

Matrix rustflags values are never read; the same flags are hardcoded again in the job env. Someone edits rustflags in a matrix entry, expecting the Jetson or x86 build to change, but the build still uses the hardcoded CARGO_TARGET_*_RUSTFLAGS env values. The two copies drift and the release binary silently keeps the old target-cpu.

Prompt for your AI agent
File: .github/workflows/release.yml
Line: 28
Issue: Matrix `rustflags` values are never read; the same flags are hardcoded again in the job env. Someone edits `rustflags` in a matrix entry, expecting the Jetson or x86 build to change, but the build still uses the hardcoded CARGO_TARGET_*_RUSTFLAGS env values. The two copies drift and the release binary silently keeps the old target-cpu.
Make the smallest change that fixes this, add a test, and change nothing unrelated.

Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.

- os: ubuntu-22.04 # matches JetPack 6 glibc (2.35) on NVIDIA Jetson AGX Orin
target: aarch64-unknown-linux-gnu
rustflags: -C target-cpu=cortex-a78ae
bin: rustingstrata
asset: rustingstrata-linux-aarch64
cross: true
- os: windows-latest
target: x86_64-pc-windows-msvc
rustflags: -C target-cpu=x86-64-v3
bin: rustingstrata.exe
asset: rustingstrata-windows-x86_64.exe
cross: false
runs-on: ${{ matrix.os }}
permissions:
contents: write
env:
# .cargo/config.toml builds for the local CPU; release binaries target x86-64-v3 (AVX2 and FMA: Intel Haswell,
# AMD Zen and later) instead, without debug info.
RUSTFLAGS: -C target-cpu=x86-64-v3
CARGO_PROFILE_RELEASE_DEBUG: '0'
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS: -C target-cpu=x86-64-v3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low · Maintainability · 2 of 3

Per-target rustflags and the cross flag are spread across env and matrix instead of being derived from one place. Adding a fourth target requires editing the matrix, a new env var with a mangled triple name, and a separate cross boolean. Forgetting any one of these produces a build with the wrong CPU flags or a missing cross toolchain, and nothing reports the mismatch.

Prompt for your AI agent
File: .github/workflows/release.yml
Line: 46
Issue: Per-target rustflags and the `cross` flag are spread across env and matrix instead of being derived from one place. Adding a fourth target requires editing the matrix, a new env var with a mangled triple name, and a separate `cross` boolean. Forgetting any one of these produces a build with the wrong CPU flags or a missing cross toolchain, and nothing reports the mismatch.
Make the smallest change that fixes this, add a test, and change nothing unrelated.

Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.

CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS: -C target-cpu=x86-64-v3
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS: -C target-cpu=cortex-a78ae
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low · Maintainability · 3 of 3

Cross-compiler env vars (CC/CXX/LINKER for aarch64) are set job-wide, including for the x86_64 and Windows entries that never use them. On the native x86_64 and Windows jobs the aarch64-linux-gnu-gcc variables are set but the compiler is absent. Any build script that checks CC_<target> for a different target can pick up a wrong compiler, and a future change that adds a native target inherits cross settings it does not need.

Prompt for your AI agent
File: .github/workflows/release.yml
Line: 49
Issue: Cross-compiler env vars (CC/CXX/LINKER for aarch64) are set job-wide, including for the x86_64 and Windows entries that never use them. On the native x86_64 and Windows jobs the aarch64-linux-gnu-gcc variables are set but the compiler is absent. Any build script that checks CC_<target> for a different target can pick up a wrong compiler, and a future change that adds a native target inherits cross settings it does not need.
Make the smallest change that fixes this, add a test, and change nothing unrelated.

Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.

CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- run: rustup update stable
- run: cargo build --release --locked
- if: matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- run: |
rustup update stable
rustup target add ${{ matrix.target }}
- run: cargo build --release --locked --target ${{ matrix.target }}
# Only the upload step gets the token, so build scripts of dependencies cannot read it.
- env:
GH_TOKEN: ${{ github.token }}
run: |
cp target/release/${{ matrix.bin }} ${{ matrix.asset }}
cp target/${{ matrix.target }}/release/${{ matrix.bin }} ${{ matrix.asset }}
gh release upload "$GITHUB_REF_NAME" ${{ matrix.asset }} --repo "$GITHUB_REPOSITORY"
shell: bash