diff --git a/.github/workflows/determinism-check.yml b/.github/workflows/determinism-check.yml new file mode 100644 index 0000000..4bc2983 --- /dev/null +++ b/.github/workflows/determinism-check.yml @@ -0,0 +1,96 @@ +name: Determinism Check + +on: + pull_request: + push: + branches: [ main ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + determinism: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Hard clean + shell: bash + run: | + set -euo pipefail + git reset --hard + git clean -ffd + + - name: Verify clean workspace + shell: bash + run: | + set -euo pipefail + test -z "$(git status --porcelain=v1)" + git diff --exit-code + + - name: Build artifact twice and compare digests + shell: bash + run: | + set -euo pipefail + + build_once() { + out="$1" +rm -rf "$out/dist" +mkdir -p "$out/dist" +cp public/index.html "$out/dist/index.html" +cp public/404.html "$out/dist/404.html" +cp CNAME "$out/dist/CNAME" +cp -R surface-system "$out/dist/surface-system" +test -f "$out/dist/index.html" +test -f "$out/dist/404.html" +test -f "$out/dist/CNAME" +test -f "$out/dist/surface-system/shell/base.css" +grep -Fx "proof.verifrax.net" "$out/dist/CNAME" + + } + + tree_hash() { + python3 - "$1" <