From 0374d63efee3788d58bffb482b85eb414593a078 Mon Sep 17 00:00:00 2001 From: GW_MC <72297530+GWMCwing@users.noreply.github.com> Date: Tue, 2 Dec 2025 20:18:48 +0800 Subject: [PATCH] Add frontend build artifact handling and linting steps to CI workflow --- .github/workflows/test.yml | 67 +++++++++++++++++++++++++++++++++----- justfile | 8 +++++ 2 files changed, 66 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 638bb91..0cbc987 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,6 +44,7 @@ jobs: fi test: + needs: frontend-build runs-on: ubuntu-latest steps: - name: Checkout repository @@ -54,9 +55,42 @@ jobs: - name: Setup Rust, checkout and restore caches uses: ./.github/actions/setup-rust + - name: Download frontend build + uses: actions/download-artifact@v4 + with: + name: frontend-build + path: apps/frontend/build + - name: Run tests run: cargo test --all-features + lint: + needs: frontend-build + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Rust, checkout and restore caches + uses: ./.github/actions/setup-rust + with: + components: clippy, rustfmt + + - name: Download frontend build + uses: actions/download-artifact@v4 + with: + name: frontend-build + path: apps/frontend/build + + - name: Run clippy + run: cargo clippy --all-features -- -D warnings + + - name: Check code formatting + run: cargo fmt --all -- --check + + test-frontend: runs-on: ubuntu-latest steps: @@ -88,21 +122,36 @@ jobs: cd apps/frontend pnpm test - lint: + frontend-build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 + + - uses: pnpm/action-setup@v4 with: - fetch-depth: 0 + version: 10 + run_install: false - - name: Setup Rust, checkout and restore caches - uses: ./.github/actions/setup-rust + - name: Setup Node.js + uses: actions/setup-node@v4 with: - components: clippy, rustfmt + node-version: 22 + cache: 'pnpm' + cache-dependency-path: apps/frontend/pnpm-lock.yaml - - name: Run clippy - run: cargo clippy --all-features -- -D warnings + - name: Install frontend dependencies + run: | + cd apps/frontend + pnpm install - - name: Check code formatting - run: cargo fmt --all -- --check \ No newline at end of file + - name: Build frontend + run: | + cd apps/frontend + pnpm build + + - name: Upload frontend build artifact + uses: actions/upload-artifact@v4 + with: + name: frontend-build + path: apps/frontend/build \ No newline at end of file diff --git a/justfile b/justfile index 44963be..a048e1d 100644 --- a/justfile +++ b/justfile @@ -52,3 +52,11 @@ build-backend: cargo build --release build: build-frontend build-backend + +act *args: + if [ -n "{{args}}" ]; then \ + act {{args}} --artifact-server-path /tmp/artifacts; \ + else \ + act; \ + fi +