Feat/redpanda/v1 rc #109
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: CI | |
| on: | |
| push: | |
| branches: ['*'] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| integration-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Free up disk space on GitHub Actions runner to avoid "no space left" errors | |
| - name: "EXEC: {Free up disk space}, independent" | |
| uses: endersonmenezes/free-disk-space@v3 | |
| with: | |
| remove_android: true | |
| remove_dotnet: true | |
| remove_haskell: true | |
| remove_tool_cache: true | |
| remove_swap: true | |
| remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*" | |
| remove_packages_one_command: true | |
| remove_folders: "/usr/share/swift /usr/share/miniconda /usr/share/az* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell /usr/local/julia /usr/local/aws-cli /usr/local/aws-sam-cli /usr/share/gradle" | |
| rm_cmd: "rmz" | |
| rmz_version: "3.1.1" | |
| # Setup Rust toolchain and restore cached dependencies | |
| - name: "EXEC: {Setup Rust toolchain}, independent" | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| # CACHE-RUST: Rust dependencies and build artifacts | |
| # These are keyed on the Cargo.lock file to ensure cache validity | |
| - name: "CACHE_RESTORE: {C-rust-cache}" | |
| id: cache-rust | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-rust-build-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-rust-build- | |
| # Setup Docker for building and running containers | |
| - name: "EXEC: {Setup Docker}, independent" | |
| uses: docker/setup-buildx-action@v3 | |
| - name: "EXEC: {Install dependencies}, independent" | |
| run: sudo apt-get update && sudo apt-get install -y tar | |
| # Build the foc-localnet binary | |
| - name: "EXEC: {Build foc-localnet binary}, DEP: {C-rust-cache}" | |
| run: cargo build --release | |
| # CACHE-RUST: Save Rust build cache for future runs | |
| - name: "CACHE_SAVE: {C-rust-cache}" | |
| if: steps.cache-rust.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-rust-build-${{ hashFiles('**/Cargo.lock') }} | |
| # Copy binary and clean up Rust artifacts to save disk space | |
| - name: "EXEC: {Copy binary and clean cache}, DEP: {C-rust-cache}" | |
| run: | | |
| cp ./target/release/foc-localnet ./foc-localnet | |
| rm -rf ~/.cargo/registry/ | |
| rm -rf ~/.cargo/git/db/ | |
| rm -rf target/ | |
| df -h | |
| # Compute cache keys based on version info and source files | |
| # - CODE_HASH: Changes when Lotus/Curio versions change (for build artifacts cache) | |
| # - DOCKER_HASH: Changes when Dockerfiles change (for Docker images cache) | |
| - name: "CHECK: {Compute version hashes}" | |
| id: version-hashes | |
| run: | | |
| # Get version output | |
| VERSION_OUTPUT=$(./foc-localnet version 2>&1) | |
| # Compute CODE_HASH from all default:code: lines (Lotus/Curio versions) | |
| CODE_HASH=$(echo "$VERSION_OUTPUT" | grep 'default:code:' | sha256sum | cut -d' ' -f1) | |
| echo "code-hash=$CODE_HASH" >> $GITHUB_OUTPUT | |
| echo "CODE_HASH: $CODE_HASH" | |
| # Compute DOCKER_HASH from docker/ directory (Dockerfile changes) | |
| DOCKER_HASH=$(find docker -type f -exec sha256sum {} \; | sort | sha256sum | cut -d' ' -f1) | |
| echo "docker-hash=$DOCKER_HASH" >> $GITHUB_OUTPUT | |
| echo "DOCKER_HASH: $DOCKER_HASH" | |
| # CACHE-DOCKER: Try to restore pre-built Docker images (foc-lotus, foc-lotus-miner, foc-builder, foc-curio, foc-yugabyte) | |
| # These images contain YugabyteDB and all build dependencies | |
| - name: "CACHE_RESTORE: {C-docker-images-cache}" | |
| id: cache-docker-images | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ~/.docker-images-cache | |
| key: ${{ runner.os }}-docker-images-${{ steps.version-hashes.outputs.docker-hash }} | |
| # CACHE-DOCKER: If Docker images are cached, load them from tarballs | |
| - name: "EXEC: {Load Docker images}, DEP: {C-docker-images-cache}" | |
| if: steps.cache-docker-images.outputs.cache-hit == 'true' | |
| run: | | |
| echo "Loading Docker images from cache..." | |
| for image in ~/.docker-images-cache/*.tar; do | |
| if [ -f "$image" ]; then | |
| echo "Loading $(basename $image)..." | |
| docker load -i "$image" | |
| fi | |
| done | |
| echo "Docker images loaded successfully, list:" | |
| docker images | |
| rm -rf ~/.docker-images-cache | |
| df -h | |
| # If Docker images are cached, skip building them AND skip downloading YugabyteDB | |
| # (YugabyteDB is already baked into the foc-yugabyte Docker image) | |
| - name: "EXEC: {Initialize with cached Docker}, DEP: {C-docker-images-cache}" | |
| if: steps.cache-docker-images.outputs.cache-hit == 'true' | |
| run: | | |
| rm -rf ~/.foc-localnet | |
| ./foc-localnet init --no-docker-build | |
| # If Docker images are not cached, do full init (downloads YugabyteDB and builds all images) | |
| - name: "EXEC: {Initialize without cache}, independent" | |
| if: steps.cache-docker-images.outputs.cache-hit != 'true' | |
| run: | | |
| rm -rf ~/.foc-localnet | |
| ./foc-localnet init | |
| # CACHE-DOCKER: Build Docker images if not cached | |
| - name: "EXEC: {Build Docker images}, DEP: {C-docker-images-cache}" | |
| if: steps.cache-docker-images.outputs.cache-hit != 'true' | |
| run: |- | |
| mkdir -p ~/.docker-images-cache | |
| echo "Building Docker images for cache..." | |
| docker save foc-lotus -o ~/.docker-images-cache/foc-lotus.tar | |
| docker save foc-lotus-miner -o ~/.docker-images-cache/foc-lotus-miner.tar | |
| docker save foc-builder -o ~/.docker-images-cache/foc-builder.tar | |
| docker save foc-curio -o ~/.docker-images-cache/foc-curio.tar | |
| docker save foc-yugabyte -o ~/.docker-images-cache/foc-yugabyte.tar | |
| echo "Docker images saved to cache" | |
| ls -lath ~/.docker-images-cache/ | |
| df -h | |
| # CACHE-DOCKER: Save Docker images cache for future runs | |
| - name: "CACHE_SAVE: {C-docker-images-cache}" | |
| if: steps.cache-docker-images.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ~/.docker-images-cache | |
| key: ${{ runner.os }}-docker-images-${{ steps.version-hashes.outputs.docker-hash }} | |
| # CACHE-BINARIES: Try to restore previously built Lotus/Curio binaries | |
| - name: "CACHE_RESTORE: {C-build-artifacts-cache}" | |
| id: cache-binaries | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ~/.foc-localnet/bin | |
| key: ${{ runner.os }}-binaries-${{ steps.version-hashes.outputs.code-hash }} | |
| - name: "EXEC: {Ensure permissions on binaries}, DEP: {C-build-artifacts-cache}" | |
| if: steps.cache-binaries.outputs.cache-hit == 'true' | |
| run: sudo chown -R $USER:$USER ~/.foc-localnet/bin/ | |
| # CACHE-GO: Try to restore foc-builder Go module cache to speed up Lotus/Curio builds | |
| - name: "CACHE_RESTORE: {C-foc-builder-cache}" | |
| id: cache-go | |
| if: steps.cache-binaries.outputs.cache-hit != 'true' | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ~/.foc-localnet/docker/volumes/cache/foc-builder | |
| key: ${{ runner.os }}-foc-builder-cache-${{ hashFiles('docker/**') }}-${{ hashFiles('src/config.rs') }} | |
| restore-keys: | | |
| ${{ runner.os }}-foc-builder-cache- | |
| - name: "EXEC: {Ensure permissions}, DEP: {C-foc-builder-cache}" | |
| if: steps.cache-binaries.outputs.cache-hit != 'true' && | |
| steps.cache-go.outputs.cache-hit == 'true' | |
| run: sudo chown -R $USER:$USER ~/.foc-localnet/ | |
| - name: "EXEC: {Check disk space}, independent" | |
| run: df -h | |
| # Build Lotus and Curio if not cached | |
| - name: "EXEC: {Build Lotus}, DEP: {C-build-artifacts-cache}" | |
| if: steps.cache-binaries.outputs.cache-hit != 'true' | |
| run: ./foc-localnet build lotus | |
| - name: "EXEC: {Build Curio}, DEP: {C-build-artifacts-cache}" | |
| if: steps.cache-binaries.outputs.cache-hit != 'true' | |
| run: ./foc-localnet build curio | |
| # CACHE-GO: Save Go module cache for future builds | |
| - name: "CACHE_SAVE: {C-foc-builder-cache}" | |
| if: steps.cache-binaries.outputs.cache-hit != 'true' && | |
| steps.cache-go.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ~/.foc-localnet/docker/volumes/cache/foc-builder | |
| key: ${{ runner.os }}-foc-builder-cache-${{ hashFiles('docker/**') }}-${{ hashFiles('src/config.rs') }} | |
| # CACHE-BINARIES: Save built Lotus/Curio binaries for future runs | |
| - name: "CACHE_SAVE: {C-build-artifacts-cache}" | |
| if: steps.cache-binaries.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ~/.foc-localnet/bin | |
| key: ${{ runner.os }}-binaries-${{ steps.version-hashes.outputs.code-hash }} | |
| # Disk free-up | |
| - name: "EXEC: {Clean up Go modules}, DEP: {C-build-artifacts-cache}" | |
| run: | | |
| sudo rm -rf ~/.foc-localnet/docker/volumes/cache | |
| sudo rm -rf ~/.foc-localnet/code/lotus | |
| sudo rm -rf ~/.foc-localnet/code/curio | |
| df -h | |
| # Download and extract Filecoin proof parameters from S3 | |
| - name: "EXEC: {Download proof parameters from S3}, independent" | |
| run: | | |
| mkdir -p ~/.foc-localnet/docker/volumes/cache/filecoin-proof-parameters/ | |
| curl -L https://fil-proof-params-2k-cache.s3.us-east-2.amazonaws.com/filecoin-proof-params-2k.tar -o /tmp/filecoin-proof-params-2k.tar | |
| tar -xf /tmp/filecoin-proof-params-2k.tar -C ~/.foc-localnet/docker/volumes/cache/filecoin-proof-parameters/ | |
| rm /tmp/filecoin-proof-params-2k.tar | |
| ls -lath ~/.foc-localnet/docker/volumes/cache/filecoin-proof-parameters/ | |
| PROOF_PARAMS_HASH=$(find ~/.foc-localnet/docker/volumes/cache/filecoin-proof-parameters -type f -exec sha256sum {} \; | cut -d' ' -f1 | sort | sha256sum | cut -d' ' -f1) | |
| echo "Downloaded proof parameters with hash: $PROOF_PARAMS_HASH" | |
| # Start the full Filecoin localnet cluster | |
| - name: "EXEC: {Start cluster}, independent" | |
| run: ./foc-localnet start --parallel | |
| # Verify cluster is running correctly | |
| - name: "EXEC: {Check cluster status}, independent" | |
| run: ./foc-localnet status | |
| # Clean shutdown | |
| - name: "EXEC: {Stop cluster}, independent" | |
| run: ./foc-localnet stop |