From d042739f5c1df5ff1e3302642e808241849478a9 Mon Sep 17 00:00:00 2001 From: Trezy Date: Wed, 4 Mar 2026 16:58:08 -0600 Subject: [PATCH] ci: break the release workflow into more concurrent jobs --- .github/workflows/release.yml | 96 ++++++++++++++++++++++++++--------- 1 file changed, 71 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a8c0ff9..12ab2a6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,51 @@ env: SQLX_OFFLINE: true jobs: - test: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Cache Rust build + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: rust-build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} + restore-keys: | + rust-build-${{ runner.os }}- + + - name: Build all targets + run: cargo build --all-targets + + unit-tests: + needs: [build] + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Restore Rust build cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: rust-build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} + restore-keys: | + rust-build-${{ runner.os }}- + + - name: Run unit tests + run: cargo test --lib + + e2e-tests: + needs: [build] runs-on: ubuntu-latest services: @@ -32,54 +76,56 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 24 - - - name: Build frontend - working-directory: web - run: npm ci && npm run build - - - name: Cache Rust build - uses: actions/cache@v4 + - name: Restore Rust build cache + uses: actions/cache/restore@v4 with: path: | ~/.cargo/registry ~/.cargo/git target - key: rust-test-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} + key: rust-build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} restore-keys: | - rust-test-${{ runner.os }}- - - - name: Build - run: cargo build --all-targets - - - name: Run unit tests - run: cargo test --lib + rust-build-${{ runner.os }}- - name: Run e2e tests env: TEST_DATABASE_URL: postgres://happyview:happyview@localhost:5432/happyview_test run: cargo test --tests + frontend: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 24 + + - name: Build frontend + working-directory: web + run: npm ci && npm run build + lint: + needs: [build] runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Cache Rust build - uses: actions/cache@v4 + - name: Restore Rust build cache + uses: actions/cache/restore@v4 with: path: | ~/.cargo/registry ~/.cargo/git target - key: rust-lint-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} + key: rust-build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} restore-keys: | - rust-lint-${{ runner.os }}- + rust-build-${{ runner.os }}- - name: Check formatting run: cargo fmt -- --check @@ -89,7 +135,7 @@ jobs: release: if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') - needs: [test, lint] + needs: [unit-tests, e2e-tests, frontend, lint] runs-on: ubuntu-latest permissions: contents: write -- 2.51.2