diff --git a/.github/workflows/build-self-hosted.yml b/.github/workflows/build-self-hosted.yml deleted file mode 100644 index 8f56ee80e8..0000000000 --- a/.github/workflows/build-self-hosted.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Build, Lint, and Test (self-hosted) - -on: - push: - branches: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - strategy: - matrix: - just_variants: - - async_std - #- tokio - runs-on: [self-hosted] - steps: - - uses: dtolnay/rust-toolchain@stable - name: Install Current Rust - with: - components: "clippy, rustfmt" - - - uses: actions/checkout@v4 - name: Checkout Repository - - - uses: Swatinem/rust-cache@v2 - name: Enable Rust Caching - with: - prefix-key: ${{ matrix.just_variants }} - - - name: Run linting - run: | - just ${{ matrix.just_variants }} lint - - - name: Build all crates in workspace - run: just ${{ matrix.just_variants }} build - - - name: Unit and integration tests for all crates in workspace - run: | - just ${{ matrix.just_variants }} test - timeout-minutes: 60 - env: - RUST_BACKTRACE: full diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 9ba418e99b..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,233 +0,0 @@ -name: Build, Lint, and Test - -on: - push: - branches: - - 'develop' - - 'main' - pull_request: - schedule: - - cron: '0 0 * * 1' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ 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: Run linting - run: | - just ${{ matrix.just_variants }} lint - - - name: Build all crates in workspace - run: just ${{ matrix.just_variants }} build - - - name: Unit and integration tests for all crates in workspace - run: | - just ${{ matrix.just_variants }} test - timeout-minutes: 60 - env: - RUST_BACKTRACE: full - - - name: Upload Binaries - uses: actions/upload-artifact@v3 - with: - name: binaries-amd64-${{ matrix.just_variants }} - path: | - target/debug/examples/counter - target/debug/examples/multi-validator-libp2p - target/debug/examples/orchestrator-libp2p - target/debug/examples/validator-libp2p - target/debug/examples/multi-validator-webserver - target/debug/examples/multi-webserver - target/debug/examples/webserver - target/debug/examples/orchestrator-webserver - target/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@v3 - with: - name: binaries-aarch64-${{ matrix.just_variants }} - path: | - target/debug/examples/counter - target/debug/examples/multi-validator-libp2p - target/debug/examples/orchestrator-libp2p - target/debug/examples/validator-libp2p - target/debug/examples/multi-validator-webserver - target/debug/examples/multi-webserver - target/debug/examples/webserver - target/debug/examples/orchestrator-webserver - target/debug/examples/validator-webserver - - build-dockers: - strategy: - matrix: - just_variants: - - async_std - - tokio - runs-on: ubuntu-latest - needs: [build, build-arm] - 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 executables AMD - uses: actions/download-artifact@v3 - with: - name: binaries-amd64-${{ matrix.just_variants }} - path: target/amd64/debug/examples - - - name: Download executables ARM - uses: actions/download-artifact@v3 - with: - name: binaries-aarch64-${{ matrix.just_variants }} - path: target/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 }} - - - 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 }} - - - 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 }} - - - 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 }} - - - 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 }} diff --git a/.github/workflows/sequencer.yml b/.github/workflows/sequencer.yml new file mode 100644 index 0000000000..d57655c653 --- /dev/null +++ b/.github/workflows/sequencer.yml @@ -0,0 +1,64 @@ +name: Build, Lint, and Test + +on: + push: + branches: + - 'develop' + - 'main' + pull_request: + schedule: + - cron: '0 0 * * 1' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test-sequencer: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: Checkout Repository + with: + path: hotshot + + - uses: actions/checkout@v4 + name: Checkout Sequencer Repository + with: + repository: EspressoSystems/espresso-sequencer + path: sequencer + + - name: Install Rust Stable + uses: dtolnay/rust-toolchain@stable + + - uses: Swatinem/rust-cache@v2 + name: Enable Rust Caching + with: + shared-key: "" + prefix-key: sequencer + + - name: Patch sequencer dependencies + run: | + mkdir -p .cargo + cat << EOF > .cargo/config.toml + [patch.'https://github.com/EspressoSystems/hotshot'] + hotshot = { path = "${GITHUB_WORKSPACE}/hotshot/crates/hotshot" } + hotshot-orchestrator = { path = "${GITHUB_WORKSPACE}/hotshot/crates/orchestrator" } + hotshot-signature-key = { path = "${GITHUB_WORKSPACE}/hotshot/crates/hotshot-signature-key" } + hotshot-types = { path = "${GITHUB_WORKSPACE}/hotshot/crates/types" } + hotshot-web-server = { path = "${GITHUB_WORKSPACE}/hotshot/crates/web_server" } + hotshot-testing = { path = "${GITHUB_WORKSPACE}/hotshot/crates/testing" } + EOF + + - name: Build sequencer tests + working-directory: sequencer + run: | + export RUSTFLAGS='--cfg async_executor_impl="async-std" --cfg async_channel_impl="async-std" --cfg hotshot_example' + cargo test --release --workspace --all-features --no-run + + - name: Run sequencer tests + working-directory: sequencer + run: | + export RUSTFLAGS='--cfg async_executor_impl="async-std" --cfg async_channel_impl="async-std" --cfg hotshot_example' + cargo test --release --workspace --all-features --verbose -- --test-threads 1 --nocapture