Skip to content
Merged
Show file tree
Hide file tree
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
23 changes: 23 additions & 0 deletions .github/workflows/reproducibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: reproducibility

on:
pull_request:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

jobs:
build-twice:
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Install stable Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
- name: Build twice and compare SHA-256
run: bash scripts/check_reproducible.sh
19 changes: 19 additions & 0 deletions scripts/check_reproducible.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Build the sensor twice from scratch in separate target directories and compare
# SHA-256. Proves reproducibility on THIS toolchain/host only.
set -euo pipefail
cd "$(dirname "$0")/.."
root=$(pwd)
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
export SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-$(git log -1 --format=%ct 2>/dev/null || echo 0)}
export RUSTFLAGS="${RUSTFLAGS:-} --remap-path-prefix=$root=/build --remap-path-prefix=${CARGO_HOME:-$HOME/.cargo}=/cargo"
for n in 1 2; do
CARGO_TARGET_DIR="$tmp/target$n" cargo build --release --locked --bin wraith
sha256sum "$tmp/target$n/release/wraith" | tee "$tmp/sum$n.txt"
done
a=$(cut -d' ' -f1 "$tmp/sum1.txt"); b=$(cut -d' ' -f1 "$tmp/sum2.txt")
if [[ "$a" != "$b" ]]; then
echo "NOT REPRODUCIBLE: $a != $b" >&2; exit 1
fi
echo "REPRODUCIBLE: $a"
Loading