name: Unit Test on: push: branches: ["main"] paths-ignore: - "**.md" - "packages/**" pull_request: branches: ["main"] workflow_dispatch: permissions: contents: read env: CARGO_TERM_COLOR: always jobs: test: name: Test on ${{ matrix.name }} runs-on: ${{ matrix.platform }} container: image: ${{ matrix.container }} options: --user root strategy: fail-fast: false matrix: # On Push: Linux only. On PR: All platforms. include: - platform: "ubuntu-22.04" name: "Ubuntu 22.04" - platform: "ubuntu-22.04" name: "Arch Linux (Wayland)" container: "archlinux:latest" wayland: true - platform: "windows-latest" name: "Windows" - platform: "macos-14" name: "macOS" steps: - name: Checkout uses: actions/checkout@v6 - name: Install Dependencies (Ubuntu) if: runner.os == 'Linux' && !matrix.wayland run: | sudo apt-get update || true sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libfuse2 - name: Install Dependencies (Arch Linux) if: matrix.wayland run: | pacman -Syu --noconfirm pacman -S --noconfirm webkit2gtk-4.1 base-devel curl wget file openssl gtk3 - name: Setup Wayland Environment (Arch) if: matrix.wayland run: | echo "WAYLAND_DISPLAY=wayland-1" >> $GITHUB_ENV echo "GDK_BACKEND=wayland" >> $GITHUB_ENV echo "XDG_SESSION_TYPE=wayland" >> $GITHUB_ENV echo "Wayland test environment configured" - name: Install Rust uses: dtolnay/rust-toolchain@stable - name: Install Node.js if: github.event_name == 'workflow_dispatch' uses: actions/setup-node@v6 with: node-version: 22 - name: Install pnpm if: github.event_name == 'workflow_dispatch' uses: pnpm/action-setup@v4 - name: Install Frontend Dependencies if: github.event_name == 'workflow_dispatch' run: pnpm install - name: Install Tauri CLI if: github.event_name == 'workflow_dispatch' run: cargo install tauri-cli - name: Rust Cache uses: swatinem/rust-cache@v2 - name: Run Tests working-directory: ./src-tauri run: cargo test --verbose - name: Build Rust Only (Push/PR) if: github.event_name != 'workflow_dispatch' working-directory: ./src-tauri run: cargo build --verbose - name: Build App (Debug) if: github.event_name == 'workflow_dispatch' run: cargo tauri build --debug - name: Get Short SHA if: github.event_name == 'workflow_dispatch' id: slug run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT - name: Upload Artifact (Linux) if: runner.os == 'Linux' && github.event_name == 'workflow_dispatch' uses: actions/upload-artifact@v6 with: name: dropout-linux-${{ matrix.wayland && 'arch' || 'ubuntu' }}-${{ steps.slug.outputs.sha8 }} path: | target/debug/bundle/appimage/*.AppImage target/debug/bundle/deb/*.deb target/debug/dropout retention-days: 5 - name: Upload Artifact (Windows) if: runner.os == 'Windows' && github.event_name == 'workflow_dispatch' uses: actions/upload-artifact@v6 with: name: dropout-windows-${{ steps.slug.outputs.sha8 }} path: | target/debug/bundle/msi/*.msi target/debug/bundle/nsis/*.exe target/debug/dropout.exe retention-days: 5 - name: Upload Artifact (macOS) if: runner.os == 'macOS' && github.event_name == 'workflow_dispatch' uses: actions/upload-artifact@v6 with: name: dropout-macos-${{ steps.slug.outputs.sha8 }} path: | target/debug/bundle/dmg/*.dmg target/debug/bundle/macos/DropOut.app retention-days: 5