Skip to content

Commit abfae6c

Browse files
authored
Merge pull request #8 from buffrr/ups
Prover and registry API auth, polling and auto publish
2 parents dd92608 + 1611826 commit abfae6c

28 files changed

Lines changed: 9614 additions & 278 deletions

.dockerignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# The prover image builds from the repo root, so keep the context small —
2+
# everything here is either rebuilt inside the image or irrelevant to it.
3+
.git
4+
.github
5+
.idea
6+
.claude
7+
.vscode
8+
target
9+
**/target
10+
11+
# Local operator state, never part of an image.
12+
data
13+
testrig-data
14+
*.bin
15+
*.priv
16+
*.subs
17+
*.subs.c
18+
*.sdb
19+
20+
.DS_Store
21+
**/.DS_Store
22+
screenshot.png
23+
LICENSE

.github/workflows/prover-image.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: prover-image
2+
3+
# Builds the CUDA-enabled subs-prover GPU image.
4+
#
5+
# Forks build but do not push: GITHUB_TOKEN is scoped to the repository owner,
6+
# so only a run inside spacesprotocol/subs can publish to that org's registry.
7+
# A fork's run still compiles the image, which is the part worth catching in CI.
8+
9+
on:
10+
push:
11+
branches: [main]
12+
tags: ['v*']
13+
pull_request:
14+
paths:
15+
- 'prover/**'
16+
- 'types/**'
17+
- 'core/**'
18+
- 'Cargo.toml'
19+
- 'rust-toolchain.toml'
20+
- '.dockerignore'
21+
- '.github/workflows/prover-image.yml'
22+
workflow_dispatch:
23+
inputs:
24+
risc0_version:
25+
description: 'risc0 toolchain version to pin (empty = latest)'
26+
required: false
27+
default: ''
28+
29+
env:
30+
IMAGE: ghcr.io/spacesprotocol/subs-prover-gpu
31+
32+
jobs:
33+
build:
34+
runs-on: ubuntu-latest
35+
permissions:
36+
contents: read
37+
packages: write
38+
39+
steps:
40+
- name: Decide whether this run can publish
41+
id: gate
42+
run: |
43+
if [ "${{ github.repository }}" = "spacesprotocol/subs" ] \
44+
&& [ "${{ github.event_name }}" != "pull_request" ]; then
45+
echo "push=true" >> "$GITHUB_OUTPUT"
46+
else
47+
echo "push=false" >> "$GITHUB_OUTPUT"
48+
echo "::notice::Build-only run (fork or pull request); image will not be pushed."
49+
fi
50+
51+
# The CUDA devel image plus a full risc0 release build overruns the
52+
# ~14 GB free on a stock runner. Reclaiming preinstalled toolchains we
53+
# don't use buys roughly 25 GB.
54+
- name: Free disk space
55+
run: |
56+
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android \
57+
/opt/hostedtoolcache/CodeQL /usr/local/share/boost
58+
sudo docker image prune --all --force
59+
df -h /
60+
61+
- uses: actions/checkout@v4
62+
63+
- uses: docker/setup-buildx-action@v3
64+
65+
- name: Log in to GHCR
66+
if: steps.gate.outputs.push == 'true'
67+
uses: docker/login-action@v3
68+
with:
69+
registry: ghcr.io
70+
username: ${{ github.actor }}
71+
password: ${{ secrets.GITHUB_TOKEN }}
72+
73+
- name: Derive tags
74+
id: meta
75+
uses: docker/metadata-action@v5
76+
with:
77+
images: ${{ env.IMAGE }}
78+
tags: |
79+
type=ref,event=branch
80+
type=semver,pattern={{version}}
81+
type=semver,pattern={{major}}.{{minor}}
82+
type=sha,format=long
83+
type=raw,value=latest,enable={{is_default_branch}}
84+
85+
- name: Build and push
86+
uses: docker/build-push-action@v6
87+
with:
88+
context: .
89+
file: prover/Dockerfile
90+
platforms: linux/amd64
91+
push: ${{ steps.gate.outputs.push == 'true' }}
92+
tags: ${{ steps.meta.outputs.tags }}
93+
labels: ${{ steps.meta.outputs.labels }}
94+
build-args: |
95+
RISC0_VERSION=${{ inputs.risc0_version }}
96+
cache-from: type=gha
97+
cache-to: type=gha,mode=max
98+
99+
- name: Summary
100+
run: |
101+
{
102+
echo "### subs-prover GPU image"
103+
echo
104+
if [ "${{ steps.gate.outputs.push }}" = "true" ]; then
105+
echo "Pushed:"
106+
else
107+
echo "Built but **not** pushed (fork or pull request):"
108+
fi
109+
echo '```'
110+
echo "${{ steps.meta.outputs.tags }}"
111+
echo '```'
112+
} >> "$GITHUB_STEP_SUMMARY"

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
.DS_Store
2-
Cargo.lock
32
.vscode
4-
methods/guest/Cargo.lock
53
target/
64
*.bin
75
*.priv

0 commit comments

Comments
 (0)