CI: Switch publish workflow tooling setup to Nix

This commit is contained in:
Juno Takano 2026-06-29 04:44:45 -03:00
commit ac33bb207e
No known key found for this signature in database

View file

@ -28,40 +28,48 @@ jobs:
container: container:
image: rust:slim image: rust:slim
steps: steps:
- name: Install action dependencies - name: Set up action dependencies
run: apt-get install --no-install-recommends --update -y nodejs curl git run: |
apt-get install --no-install-recommends --update -y nodejs git nix
echo experimental-features = nix-command flakes >> /etc/nix/nix.conf
nix profile install nixpkgs#just # trixie is on nix 2.26
- name: Checkout code - name: Checkout code
uses: actions/checkout@v6 uses: actions/checkout@v6
with: with:
fetch-tags: true fetch-tags: true
- name: Set up Rust toolchain - name: Cleanup checkout action dependencies
run: | run: apt-get purge -y nodejs git
rustup component add llvm-tools
rustup component add --toolchain nightly rustfmt clippy
rustup target add x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-linux-musl
- name: Set up additional tooling
run: .forgejo/workflows/setup-tools.sh
- name: Set up CI user - name: Set up CI user
run: | run: useradd -m ci && chown -R ci /nix .
useradd -m ci && chown -R ci:ci .
git config --global --add safe.directory "$PWD"
- name: Run all assessments - name: Set up Rust toolchain
run: just ci verify run: |
rust_version=$(sed -nE 's/^rust-version = "(.*)"$/\1/p' Cargo.toml)
su ci -c "
rustup default '$rust_version'
rustup toolchain install nightly
rustup component add llvm-tools
rustup component add --toolchain nightly rustfmt clippy
rustup target add \
x86_64-unknown-linux-musl \
x86_64-unknown-linux-gnu
"
- name: Assess
run: /root/.nix-profile/bin/just ci-nix "$PATH" verify
- name: Build x64 Linux glibc release binary - name: Build x64 Linux glibc release binary
run: just release-build-gnu run: /root/.nix-profile/bin/just ci-nix "$PATH" release-build-gnu
- name: Build x64 Linux musl release binary - name: Build x64 Linux musl release binary
run: just release-build-musl run: /root/.nix-profile/bin/just ci-nix "$PATH" release-build-musl
- name: Calculate SHA-256 hashes - name: Calculate SHA-256 hashes
run: just shasum run: /root/.nix-profile/bin/just ci-nix "$PATH" shasum
- name: Publish x64 Linux musl binary to git.jutty.dev registry - name: Publish x64 Linux musl binary to git.jutty.dev registry
if: ${{ inputs.upload }} if: ${{ inputs.upload }}
@ -95,42 +103,44 @@ jobs:
XWIN_CACHE_DIR: /tmp XWIN_CACHE_DIR: /tmp
steps: steps:
- name: Install action dependencies - name: Install action dependencies
run: apt-get install --no-install-recommends --update -y nodejs curl git run: |
apt-get install --no-install-recommends --update -y nodejs git nix
echo experimental-features = nix-command flakes >> /etc/nix/nix.conf
nix profile install nixpkgs#just # trixie is on nix 2.26
- name: Checkout code - name: Checkout code
uses: actions/checkout@v6 uses: actions/checkout@v6
with: with:
fetch-tags: true fetch-tags: true
- name: Cleanup checkout action dependencies
run: apt-get purge -y nodejs git
- name: Set up CI user
run: useradd -m ci && chown -R ci /nix .
- name: Set up Rust toolchain - name: Set up Rust toolchain
run: | run: |
version=$(cat Cargo.toml | grep '^rust-version' | cut -d \" -f 2) rust_version=$(grep '^rust-version' Cargo.toml | cut -d \" -f 2)
rustup set auto-self-update disable
rustup toolchain install "$version-x86_64-unknown-linux-gnu"
rustup default "$version-x86_64-unknown-linux-gnu"
rustup target add x86_64-pc-windows-msvc
- name: Set up additional tooling su ci -c "
run: .forgejo/workflows/setup-tools.sh rustup default '$rust_version'
rustup target add x86_64-pc-windows-msvc
"
- name: Cache MSVC CRT and SDK - name: Cache MSVC CRT and SDK
run: cargo-xwin cache xwin run: cargo-xwin cache xwin
- name: Set up CI user
run: |
useradd -m ci && chown -R ci:ci .
git config --global --add safe.directory "$PWD"
- name: Run Windows tests - name: Run Windows tests
run: just ci test-windows run: /root/.nix-profile/bin/just ci-nix "$PATH" test-windows
- name: Build x64 Windows MSVC release binary - name: Build x64 Windows MSVC release binary
run: | run: |
rm -v /usr/bin/clang rm -v /usr/bin/clang
just release-build-msvc /root/.nix-profile/bin/just ci-nix "$PATH" release-build-msvc
- name: Calculate SHA-256 hashes - name: Calculate SHA-256 hashes
run: just shasum run: /root/.nix-profile/bin/just shasum
- name: Publish x64 Windows MSVC binary to git.jutty.dev registry - name: Publish x64 Windows MSVC binary to git.jutty.dev registry
if: ${{ inputs.upload }} if: ${{ inputs.upload }}