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
96 changes: 96 additions & 0 deletions .github/workflows/determinism-check.yml
Original file line number Diff line number Diff line change
@@ -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" <<PY2
import hashlib
import sys
from pathlib import Path

root = Path(sys.argv[1])
h = hashlib.sha256()

for p in sorted(root.rglob("*")):
if p.is_file():
rel = p.relative_to(root).as_posix().encode()
h.update(rel)
h.update(b"\0")
h.update(p.read_bytes())
h.update(b"\0")

print(h.hexdigest())
PY2
}

A="$(mktemp -d)"
B="$(mktemp -d)"

build_once "$A"
build_once "$B"

HASH_A="$(tree_hash "$A/dist")"
HASH_B="$(tree_hash "$B/dist")"

echo "HASH_A=$HASH_A"
echo "HASH_B=$HASH_B"

test "$HASH_A" = "$HASH_B"
diff -ru "$A/dist" "$B/dist"

- name: Verify clean workspace after build
shell: bash
run: |
set -euo pipefail
test -z "$(git status --porcelain=v1)"
git diff --exit-code
46 changes: 46 additions & 0 deletions .github/workflows/identity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Identity

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

permissions:
contents: read

jobs:
identity:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Verify host identity boundary
shell: bash
run: |
set -euo pipefail

test -f README.md
test -f LICENSE
test -f surface.host.json
test -f .github/workflows/pages.yml
test -f .github/workflows/surface-validate.yml
test -f "CNAME"

grep -Fx "proof.verifrax.net" "CNAME"
grep -F "https://proof.verifrax.net" README.md
grep -F "Apache License Version 2.0" README.md

python3 - <<PY2
import json
from pathlib import Path

data = json.loads(Path("surface.host.json").read_text())

assert data["repo"] == "proof", data
assert data["host"] == "https://proof.verifrax.net", data
assert data["hostClass"] == "reference", data
assert data["role"] == "proof", data
assert data["deployMode"] == "static-root", data
assert "adjacentHosts" in data and isinstance(data["adjacentHosts"], dict) and data["adjacentHosts"], data
PY2
Loading