Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker environment to build the actors reproducibly #1606

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
env:
BUILD_FIL_NETWORK: ${{ matrix.network }}
run: |
cargo run --locked -- -o output/builtin-actors.car
make bundle-repro
2 changes: 1 addition & 1 deletion .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
env:
BUILD_FIL_NETWORK: ${{ matrix.network }}
run: |
cargo run --locked -- -o output/builtin-actors.car
make bundle-repro
- name: Upload release assets to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ target
.idea/
.vscode/
**/.DS_Store
output/*.car
output/*
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM rust:1.81.0-bookworm@sha256:7b7f7ae5e49819e708369d49925360bde2af4f1962842e75a14af17342f08262

WORKDIR /usr/src/builtin-actors

# Install the compiler. Unfortunately, the rust docker container doesn't actually contain the rust
rvagg marked this conversation as resolved.
Show resolved Hide resolved
# compiler...
COPY ./rust-toolchain.toml .
RUN rustup show

# Then checkout a clean copy of the repo.
RUN --mount=type=bind,rw,target=/tmp/repo \
echo "Building $(git -C /tmp/repo rev-parse HEAD)" && \
git --git-dir /tmp/repo/.git --work-tree . checkout -f HEAD

ENTRYPOINT ["/bin/bash", "-c"]
28 changes: 26 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,56 @@ check:
test:
cargo test --workspace

docker-builder:
docker build . -t builtin-actors-builder

# Create a bundle in a deterministic location
bundle:
cargo run -- -o output/builtin-actors.car

bundle-repro: docker-builder
docker run -e BUILD_FIL_NETWORK --rm -v `pwd`/output:/usr/src/builtin-actors/output builtin-actors-builder "make bundle"

# Create all canonical network bundles
all-bundles: bundle-mainnet bundle-caterpillarnet bundle-butterflynet bundle-calibrationnet bundle-devnet bundle-testing bundle-testing
all-bundles-repro: bundle-mainnet-repro bundle-caterpillarnet-repro bundle-butterflynet-repro bundle-calibrationnet-repro bundle-devnet-repro bundle-testing-repro

bundle-mainnet:
BUILD_FIL_NETWORK=mainnet cargo run -- -o output/builtin-actors-mainnet.car

bundle-mainnet-repro: docker-builder
docker run --rm -v `pwd`/output:/usr/src/builtin-actors/output builtin-actors-builder "make bundle-mainnet"

bundle-caterpillarnet:
BUILD_FIL_NETWORK=caterpillarnet cargo run -- -o output/builtin-actors-caterpillarnet.car

bundle-caterpillarnet-repro: docker-builder
docker run --rm -v `pwd`/output:/usr/src/builtin-actors/output builtin-actors-builder "make bundle-caterpillarnet"

bundle-butterflynet:
BUILD_FIL_NETWORK=butterflynet cargo run -- -o output/builtin-actors-butterflynet.car

bundle-butterflynet-repro: docker-builder
docker run --rm -v `pwd`/output:/usr/src/builtin-actors/output builtin-actors-builder "make bundle-butterflynet"

bundle-calibrationnet:
BUILD_FIL_NETWORK=calibrationnet cargo run -- -o output/builtin-actors-calibrationnet.car

bundle-calibrationnet-repro: docker-builder
docker run --rm -v `pwd`/output:/usr/src/builtin-actors/output builtin-actors-builder "make bundle-calibrationnet"

bundle-devnet:
BUILD_FIL_NETWORK=devnet cargo run -- -o output/builtin-actors-devnet.car

bundle-devnet-repro: docker-builder
docker run --rm -v `pwd`/output:/usr/src/builtin-actors/output builtin-actors-builder "make bundle-devnet"

bundle-testing:
BUILD_FIL_NETWORK=testing cargo run -- -o output/builtin-actors-testing.car
BUILD_FIL_NETWORK=testing-fake-proofs cargo run -- -o output/builtin-actors-testing-fake-proofs.car

bundle-testing-repro: docker-builder
docker run --rm -v `pwd`/output:/usr/src/builtin-actors/output builtin-actors-builder "make bundle-testing"

# Check if the working tree is clean.
check-clean:
@git diff --quiet || { \
Expand All @@ -50,4 +74,4 @@ check-clean:
}

.PHONY: rustfmt check check-clean test bundle
.PHONY: all-bundles bundle-mainnet bundle-caterpillarnet bundle-butterflynet bundle-calibrationnet bundle-devnet bundle-testing
.PHONY: all-bundles bundle-mainnet bundle-caterpillarnet bundle-butterflynet bundle-calibrationnet bundle-devnet bundle-testing bundle-mainnet-repro bundle-caterpillarnet-repro bundle-butterflynet-repro bundle-calibrationnet-repro bundle-devnet-repro bundle-testing-repro docker-builder
Loading