Skip to content

Commit b30b040

Browse files
AzathothasQaidVoid
andauthored
build: switch to cross & create attestation (#6)
Co-authored-by: Rabindra Dhakal <[email protected]>
1 parent 46a087d commit b30b040

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

.github/workflows/nightly.yaml

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
name: soarql
2-
2+
concurrency:
3+
group: "${{ github.workflow }}-${{ github.ref }}"
4+
cancel-in-progress: true
5+
36
on:
47
push:
58
branches:
69
- main
710
workflow_dispatch:
811

912
permissions:
13+
attestations: write
1014
contents: write
15+
id-token: write
1116

1217
jobs:
1318
remove-nightly-tag:
@@ -57,30 +62,39 @@ jobs:
5762
- name: Install dependencies
5863
shell: bash
5964
run: |
60-
sudo apt-get update
61-
sudo apt-get install -y --no-install-recommends \
62-
--allow-unauthenticated musl-tools b3sum
65+
sudo apt update -y
66+
sudo apt install b3sum findutils file -y
6367
6468
- name: Install Rust toolchain
6569
uses: dtolnay/rust-toolchain@nightly
6670
with:
6771
targets: ${{ matrix.build.TARGET }}
6872

69-
- name: Install cross-compilation tools
70-
uses: taiki-e/setup-cross-toolchain-action@v1
71-
with:
72-
target: ${{ matrix.build.TARGET }}
73-
73+
- name: Install Cross
74+
shell: bash
75+
run: |
76+
cargo install cross --git "https://github.com/cross-rs/cross" --jobs="$(($(nproc)+1))"
77+
hash -r &>/dev/null
78+
command -v cross &>/dev/null || { echo "cross command not found" >&2; exit 1; }
79+
7480
- name: Build
75-
run: RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --locked --target ${{ matrix.build.TARGET }}
81+
env:
82+
RUSTFLAGS: "-C target-feature=+crt-static \
83+
-C link-self-contained=yes \
84+
-C link-arg=-Wl,--build-id=none"
85+
run: cross +nightly build --release --locked --target "${{ matrix.build.TARGET }}" --jobs="$(($(nproc)+1))" --verbose
7686

7787
- name: Prepare nightly binary
88+
env:
89+
ARTIFACT: "nightly/soarql-${{ matrix.build.NAME }}"
7890
shell: bash
7991
run: |
8092
mkdir -p nightly
81-
cp "target/${{ matrix.build.TARGET }}/release/soarql" nightly/soarql-${{ matrix.build.NAME }}
82-
b3sum nightly/soarql-${{ matrix.build.NAME }} > nightly/soarql-${{ matrix.build.NAME }}.b3sum
83-
93+
cp "target/${{ matrix.build.TARGET }}/release/soarql" "${ARTIFACT}"
94+
b3sum "${ARTIFACT}" > "${ARTIFACT}.b3sum"
95+
realpath "${ARTIFACT}" | xargs -I "{}" bash -c \
96+
'printf "\nFile: $(basename {})\n Type: $(file -b {})\n B3sum: $(b3sum {} | cut -d" " -f1)\n SHA256sum: $(sha256sum {} | cut -d" " -f1)\n Size: $(du -bh {} | cut -f1)\n"'
97+
8498
- name: Upload nightly binary
8599
uses: softprops/action-gh-release@v2
86100
with:
@@ -92,3 +106,12 @@ jobs:
92106
draft: false
93107
env:
94108
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
110+
- name: Attest Build Provenance
111+
uses: actions/[email protected]
112+
with:
113+
subject-name: "soarql-${{ matrix.build.NAME }}"
114+
subject-path: |
115+
nightly/**
116+
show-summary: true
117+
continue-on-error: true

0 commit comments

Comments
 (0)