From 0a067ca7a77fda7efb03e342f88d5d0149246251 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 16 Jun 2025 16:47:42 +0200 Subject: [PATCH] Update CI to build Rust binaries and clarify Node.js builds - Rename Node.js job to clarify it builds both frontend and backend - Add comment explaining what npm run build does (CSS, client, server) - Include public/bundle/ in Node.js artifacts for frontend assets - Add Rust binary build job with matrix strategy for multiple platforms: - Linux (x86_64) - macOS (x86_64 and arm64) - Windows (x86_64) - Cache Rust dependencies for faster builds - Run tests only on native platforms (not cross-compilation targets) --- .github/workflows/ci.yml | 61 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fb8d300..632305f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,8 +11,8 @@ env: DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer jobs: - build-node-server: - name: Build Node Server + build-node-web: + name: Build Node.js Web App (Frontend & Backend) runs-on: ubuntu-latest steps: @@ -30,9 +30,10 @@ jobs: working-directory: web run: npm ci - - name: Build server + - name: Build frontend and backend working-directory: web run: npm run build + # This builds: CSS (Tailwind), Client (TypeScript), and Server (TypeScript) - name: Run tests working-directory: web @@ -41,8 +42,58 @@ jobs: - name: Upload build artifacts uses: actions/upload-artifact@v4 with: - name: node-server-build - path: web/dist/ + name: node-web-build + path: | + web/dist/ + web/public/bundle/ + + build-rust-binaries: + name: Build Rust Binaries + strategy: + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + binary-name: tty-fwd + - os: macos-latest + target: x86_64-apple-darwin + binary-name: tty-fwd + - os: macos-latest + target: aarch64-apple-darwin + binary-name: tty-fwd + - os: windows-latest + target: x86_64-pc-windows-msvc + binary-name: tty-fwd.exe + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Cache Rust dependencies + uses: Swatinem/rust-cache@v2 + with: + workspaces: tty-fwd + + - name: Build tty-fwd + working-directory: tty-fwd + run: cargo build --release --target ${{ matrix.target }} + + - name: Run tests + if: matrix.target == 'x86_64-unknown-linux-gnu' || matrix.target == 'x86_64-apple-darwin' || matrix.target == 'x86_64-pc-windows-msvc' + working-directory: tty-fwd + run: cargo test --release + + - name: Upload binary + uses: actions/upload-artifact@v4 + with: + name: tty-fwd-${{ matrix.target }} + path: tty-fwd/target/${{ matrix.target }}/release/${{ matrix.binary-name }} build-and-test: name: Build and Test macOS App