Enhance build process for web applications #24
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main, master, develop] | |
| pull_request: | |
| branches: [main, master, develop] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_VERSION: "1.90.0" # Pin Rust version for reproducible builds | |
| jobs: | |
| build-webapps: | |
| name: Build Web Applications | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Build dashboard webapp | |
| run: | | |
| cd webapps/dashboard | |
| bun install | |
| bun run build | |
| - name: Build exit-node-portal webapp | |
| run: | | |
| cd webapps/exit-node-portal | |
| bun install | |
| bun run build | |
| - name: Upload webapp artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: webapps-ci | |
| path: | | |
| webapps/dashboard/dist | |
| webapps/exit-node-portal/dist | |
| retention-days: 1 | |
| test: | |
| name: Test Suite | |
| needs: build-webapps | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Build dashboard webapp | |
| run: | | |
| cd webapps/dashboard | |
| bun install | |
| bun run build | |
| - name: Download webapp artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: webapps-ci | |
| path: webapps/ | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.RUST_VERSION }} | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "ci" | |
| cache-targets: true | |
| cache-on-failure: true | |
| - name: Build workspace (all crates) | |
| run: cargo build --workspace --verbose | |
| - name: Run tests | |
| run: cargo test --workspace --verbose | |
| lint: | |
| name: Linting | |
| needs: build-webapps | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download webapp artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: webapps-ci | |
| path: webapps/ | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.RUST_VERSION }} | |
| components: rustfmt, clippy | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "ci" | |
| cache-targets: true | |
| cache-on-failure: true | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Run clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| build: | |
| name: Build Check | |
| needs: build-webapps | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Build dashboard webapp | |
| run: | | |
| cd webapps/dashboard | |
| bun install | |
| bun run build | |
| - name: Download webapp artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: webapps-ci | |
| path: webapps/ | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.RUST_VERSION }} | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "ci" | |
| cache-targets: true | |
| cache-on-failure: true | |
| - name: Build workspace | |
| run: cargo build --release --workspace --verbose |