From 3f95de96b08daa057ec37584df3af751b9f8ee5c Mon Sep 17 00:00:00 2001 From: Mathew Richmond Date: Thu, 12 Oct 2023 09:48:40 -0600 Subject: [PATCH] Build overhaul . --- .github/workflows/audit.yml | 3 +++ .github/workflows/build.yml | 26 ++++++++++++++----------- .github/workflows/build_arm_nix.yml | 10 +++++----- .github/workflows/build_nix.yml | 13 +++++++++++-- .github/workflows/careful.yml | 16 +++++++++++++++ .github/workflows/coverage.yml | 10 ++++++++++ .github/workflows/doc.yml | 21 ++++++++++---------- .github/workflows/lints.yml | 30 ++++++++++++++++++----------- .github/workflows/update_nix.yml | 6 ++++++ 9 files changed, 96 insertions(+), 39 deletions(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 611a84156d..4eeeb80d14 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -1,6 +1,9 @@ name: Run Cargo Audit on: + push: + branches: + - 'main' schedule: - cron: '0 0 * * 1' # Run on Mondays workflow_dispatch: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e387389168..a449eebbbc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,39 +6,43 @@ on: - 'benchmarking_*' - 'main' pull_request: - branches: - - 'main' - - '*/*' schedule: - cron: '0 0 * * 1' workflow_dispatch: jobs: build: + runs-on: ubuntu-latest + strategy: matrix: just_variants: - async_std - tokio - runs-on: ubuntu-latest + steps: - - uses: styfle/cancel-workflow-action@0.11.0 - name: Cancel Outdated Builds + - name: Cancel Outdated Builds + uses: styfle/cancel-workflow-action@0.11.0 with: all_but_latest: true access_token: ${{ github.token }} - - uses: actions/checkout@v4 - name: Checkout Repository + - name: Checkout Repository + uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - name: Enable Rust Caching + - name: Enable Rust Caching + uses: Swatinem/rust-cache@v2 - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y protobuf-compiler - cargo install just + + - 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: Check run: just ${{ matrix.just_variants }} check diff --git a/.github/workflows/build_arm_nix.yml b/.github/workflows/build_arm_nix.yml index 44878cdefe..27b40f3a58 100644 --- a/.github/workflows/build_arm_nix.yml +++ b/.github/workflows/build_arm_nix.yml @@ -5,9 +5,6 @@ on: branches: - 'main' pull_request: - branches: - - 'main' - - '*/*' schedule: - cron: '0 0 * * 1' workflow_dispatch: @@ -34,7 +31,10 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 + # See how long just nix setup takes + - name: Initialize nix + run: nix develop -c echo Finished + # sanity check that repository builds with nix - name: Build - run: | - nix develop -c just async_std build + run: nix develop -c just async_std build diff --git a/.github/workflows/build_nix.yml b/.github/workflows/build_nix.yml index a98c9ae2b4..e99a7dfb05 100644 --- a/.github/workflows/build_nix.yml +++ b/.github/workflows/build_nix.yml @@ -19,10 +19,19 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@v23 + - name: Nix Caching + uses: cachix/cachix-action@v12 + with: + name: espresso-systems-private + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Checkout Repository uses: actions/checkout@v4 + # See how long just nix setup takes + - name: Initialize nix + run: nix develop -c echo Finished + # sanity check that repository builds with nix - name: Build - run: | - nix develop -c just async_std build + run: nix develop -c just async_std build diff --git a/.github/workflows/careful.yml b/.github/workflows/careful.yml index 9ccdb955bf..4727e66e3c 100644 --- a/.github/workflows/careful.yml +++ b/.github/workflows/careful.yml @@ -11,12 +11,28 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 120 steps: + - name: Cancel Outdated Builds + uses: styfle/cancel-workflow-action@0.11.0 + with: + all_but_latest: true + access_token: ${{ github.token }} + - name: Install Nix uses: cachix/install-nix-action@v23 + - name: Nix Caching + uses: cachix/cachix-action@v12 + with: + name: espresso-systems-private + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Checkout Repository uses: actions/checkout@v4 + # See how long just nix setup takes + - name: Initialize nix + run: nix develop -c echo Finished + - name: Run careful tests run: | nix develop .#correctnessShell -c just tokio careful diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 5dd6b32725..85415029f6 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -18,9 +18,19 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@v23 + - name: Nix Caching + uses: cachix/cachix-action@v12 + with: + name: espresso-systems-private + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Checkout Repository uses: actions/checkout@v4 + # See how long just nix setup takes + - name: Initialize nix + run: nix develop -c echo Finished + - name: Generate coverage reports # Use the `release` profile rather than `release-lto` as other workflows do, since `-- # profile=release-lto` will cause the `failed to generate report` error. diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index bb6f576711..ff5771d1a5 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -4,9 +4,6 @@ on: branches: - 'main' pull_request: - branches: - - 'main' - - '*/*' schedule: - cron: '0 0 * * 1' workflow_dispatch: @@ -16,8 +13,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 35 steps: - - uses: styfle/cancel-workflow-action@0.11.0 - name: Cancel Outdated Builds + - name: Cancel Outdated Builds + uses: styfle/cancel-workflow-action@0.11.0 with: all_but_latest: true access_token: ${{ github.token }} @@ -29,14 +26,18 @@ jobs: run: | sudo apt-get update sudo apt-get install -y protobuf-compiler - cargo install just - - uses: Swatinem/rust-cache@v2 - name: Enable Rust Caching + - 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: Enable Rust Caching + uses: Swatinem/rust-cache@v2 - name: Build Docs - run: | - just async_std doc + run: just async_std doc - name: Create documentation if: ${{ github.ref == 'refs/heads/main' }} diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml index 9ab7bf8c03..2eb72016af 100644 --- a/.github/workflows/lints.yml +++ b/.github/workflows/lints.yml @@ -5,9 +5,6 @@ on: branches: - 'main' pull_request: - branches: - - 'main' - - '*/*' workflow_dispatch: jobs: @@ -15,8 +12,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 25 steps: - - uses: styfle/cancel-workflow-action@0.11.0 - name: Cancel Outdated Builds + - name: Cancel Outdated Builds + uses: styfle/cancel-workflow-action@0.11.0 with: all_but_latest: true access_token: ${{ github.token }} @@ -24,13 +21,24 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@v23 - - uses: actions/checkout@v4 - name: Checkout Repository + - name: Nix Caching + uses: cachix/cachix-action@v12 + with: + name: espresso-systems-private + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + + - name: Checkout Repository + uses: actions/checkout@v4 - name: Format Check run: cargo fmt -- --check - - name: Clippy - run: | - nix develop -c just async_std lint - nix develop -c just tokio lint + # See how long just nix setup takes + - name: Initialize nix + run: nix develop -c echo Finished + + - name: Clippy async_std + run: nix develop -c just async_std lint + + - name: Clippy tokio + run: nix develop -c just tokio lint diff --git a/.github/workflows/update_nix.yml b/.github/workflows/update_nix.yml index 139d6d3334..0367e2dbb9 100644 --- a/.github/workflows/update_nix.yml +++ b/.github/workflows/update_nix.yml @@ -17,6 +17,12 @@ jobs: extra_nix_config: | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - name: Nix Caching + uses: cachix/cachix-action@v12 + with: + name: espresso-systems-private + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Update flake.lock uses: DeterminateSystems/update-flake-lock@v20 with: