Reorganize build/test in CI #4584
Workflow file for this run
This file contains 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: Build | |
on: | |
push: | |
branches: | |
- 'develop' | |
- 'main' | |
pull_request: | |
schedule: | |
- cron: '0 0 * * 1' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ (github.ref == 'refs/heads/main' && github.run_number) || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
just_variants: | |
- async-std | |
- tokio | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout repository | |
- run: rustup toolchain install stable --profile minimal | |
- uses: Swatinem/rust-cache@v2 | |
name: Enable Rust caching | |
with: | |
shared-key: "" | |
prefix-key: ${{ matrix.just_variants }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler | |
- name: Install just | |
run: | | |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz | |
tar -vxf just-1.14.0-x86_64-unknown-linux-musl.tar.gz just | |
sudo cp just /usr/bin/just | |
- name: Build all crates in workspace | |
run: just ${{ matrix.just_variants }} build | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-amd64-${{ matrix.just_variants }} | |
path: | | |
target/${{ matrix.just_variants }}/debug/examples/counter | |
target/${{ matrix.just_variants }}/debug/examples/multi-validator-libp2p | |
target/${{ matrix.just_variants }}/debug/examples/orchestrator-libp2p | |
target/${{ matrix.just_variants }}/debug/examples/validator-libp2p | |
target/${{ matrix.just_variants }}/debug/examples/multi-validator-webserver | |
target/${{ matrix.just_variants }}/debug/examples/multi-webserver | |
target/${{ matrix.just_variants }}/debug/examples/webserver | |
target/${{ matrix.just_variants }}/debug/examples/orchestrator-webserver | |
target/${{ matrix.just_variants }}/debug/examples/validator-webserver | |
build-arm: | |
strategy: | |
matrix: | |
just_variants: | |
- async-std | |
- tokio | |
runs-on: [self-hosted, arm64] | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout Repository | |
- name: Install Rust Stable | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
name: Enable Rust Caching | |
with: | |
shared-key: "" | |
prefix-key: arm-${{ matrix.just_variants }} | |
- name: Build all crates in workspace | |
run: just ${{ matrix.just_variants }} build | |
- name: Upload Binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-aarch64-${{ matrix.just_variants }} | |
path: | | |
target/${{ matrix.just_variants }}/debug/examples/counter | |
target/${{ matrix.just_variants }}/debug/examples/multi-validator-libp2p | |
target/${{ matrix.just_variants }}/debug/examples/orchestrator-libp2p | |
target/${{ matrix.just_variants }}/debug/examples/validator-libp2p | |
target/${{ matrix.just_variants }}/debug/examples/multi-validator-webserver | |
target/${{ matrix.just_variants }}/debug/examples/multi-webserver | |
target/${{ matrix.just_variants }}/debug/examples/webserver | |
target/${{ matrix.just_variants }}/debug/examples/orchestrator-webserver | |
target/${{ matrix.just_variants }}/debug/examples/validator-webserver | |
build-release: | |
strategy: | |
matrix: | |
just_variants: | |
- async-std | |
- tokio | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout repository | |
- run: rustup toolchain install stable --profile minimal | |
- uses: Swatinem/rust-cache@v2 | |
name: Enable Rust caching | |
with: | |
shared-key: "" | |
prefix-key: ${{ matrix.just_variants }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler | |
- name: Install just | |
run: | | |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz | |
tar -vxf just-1.14.0-x86_64-unknown-linux-musl.tar.gz just | |
sudo cp just /usr/bin/just | |
- name: Build HotShot in release mode | |
run: just ${{ matrix.just_variants }} build_release | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-amd64-${{ matrix.just_variants }} | |
path: | | |
target/${{ matrix.just_variants }}/debug/examples/counter | |
target/${{ matrix.just_variants }}/debug/examples/multi-validator-libp2p | |
target/${{ matrix.just_variants }}/debug/examples/orchestrator-libp2p | |
target/${{ matrix.just_variants }}/debug/examples/validator-libp2p | |
target/${{ matrix.just_variants }}/debug/examples/multi-validator-webserver | |
target/${{ matrix.just_variants }}/debug/examples/multi-webserver | |
target/${{ matrix.just_variants }}/debug/examples/webserver | |
target/${{ matrix.just_variants }}/debug/examples/orchestrator-webserver | |
target/${{ matrix.just_variants }}/debug/examples/validator-webserver | |
build-dockers: | |
strategy: | |
matrix: | |
just_variants: | |
- async-std | |
- tokio | |
runs-on: ubuntu-latest | |
needs: [build, build-arm, build-release] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Docker BuildKit (buildx) | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Github container repo | |
uses: docker/login-action@v3 | |
if: github.event_name != 'pull_request' | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download AMD executables | |
uses: actions/download-artifact@v4 | |
with: | |
name: binaries-amd64-${{ matrix.just_variants }} | |
path: target/${{ matrix.just_variants }}/amd64/debug/examples | |
- name: Download ARM executables | |
uses: actions/download-artifact@v4 | |
with: | |
name: binaries-aarch64-${{ matrix.just_variants }} | |
path: target/${{ matrix.just_variants }}/arm64/debug/examples | |
- name: Generate orchestrator-libp2p Docker metadata | |
uses: docker/metadata-action@v5 | |
id: orchestrator-libp2p | |
with: | |
images: ghcr.io/espressosystems/hotshot/orchestrator-libp2p | |
flavor: suffix=-${{ matrix.just_variants }} | |
- name: Generate validator-libp2p Docker metadata | |
uses: docker/metadata-action@v5 | |
id: validator-libp2p | |
with: | |
images: ghcr.io/espressosystems/hotshot/validator-libp2p | |
flavor: suffix=-${{ matrix.just_variants }} | |
- name: Generate webserver Docker metadata | |
uses: docker/metadata-action@v5 | |
id: webserver | |
with: | |
images: ghcr.io/espressosystems/hotshot/webserver | |
flavor: suffix=-${{ matrix.just_variants }} | |
- name: Generate orchestrator-webserver Docker metadata | |
uses: docker/metadata-action@v5 | |
id: orchestrator-webserver | |
with: | |
images: ghcr.io/espressosystems/hotshot/orchestrator-webserver | |
flavor: suffix=-${{ matrix.just_variants }} | |
- name: Generate validator-webserver Docker metadata | |
uses: docker/metadata-action@v5 | |
id: validator-webserver | |
with: | |
images: ghcr.io/espressosystems/hotshot/validator-webserver | |
flavor: suffix=-${{ matrix.just_variants }} | |
- name: Build and push orchestrator-libp2p docker | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./docker/orchestrator-libp2p.Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.orchestrator-libp2p.outputs.tags }} | |
labels: ${{ steps.orchestrator-libp2p.outputs.labels }} | |
build-args: | | |
ASYNC_EXECUTOR=${{ matrix.just_variants }} | |
- name: Build and push validator-libp2p docker | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./docker/validator-libp2p.Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.validator-libp2p.outputs.tags }} | |
labels: ${{ steps.validator-libp2p.outputs.labels }} | |
build-args: | | |
ASYNC_EXECUTOR=${{ matrix.just_variants }} | |
- name: Build and push webserver docker | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./docker/webserver.Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.webserver.outputs.tags }} | |
labels: ${{ steps.webserver.outputs.labels }} | |
build-args: | | |
ASYNC_EXECUTOR=${{ matrix.just_variants }} | |
- name: Build and push orchestrator-webserver docker | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./docker/orchestrator-webserver.Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.orchestrator-webserver.outputs.tags }} | |
labels: ${{ steps.orchestrator-webserver.outputs.labels }} | |
build-args: | | |
ASYNC_EXECUTOR=${{ matrix.just_variants }} | |
- name: Build and push validator-webserver docker | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./docker/validator-webserver.Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.validator-webserver.outputs.tags }} | |
labels: ${{ steps.validator-webserver.outputs.labels }} | |
build-args: | | |
ASYNC_EXECUTOR=${{ matrix.just_variants }} |