fix(ci): resolve cargo fmt failures and bump GHA actions to Node 24 #238
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: Test | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - 'crates/**' | |
| - 'app/**' | |
| - 'Cargo.*' | |
| - 'taskfiles/**' | |
| - '.github/**' | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'crates/**' | |
| - 'app/**' | |
| - 'Cargo.*' | |
| - 'taskfiles/**' | |
| - '.github/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| rust-lint: | |
| name: Rust Lint and Format Check | |
| runs-on: [self-hosted, macOS, ARM64] | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Setup macOS self-hosted runner PATH | |
| shell: bash | |
| run: | | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| echo "/opt/homebrew/bin:/opt/homebrew/sbin" >> $GITHUB_PATH | |
| - uses: actions/checkout@v6 | |
| - name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| components: clippy, rustfmt | |
| cache: false | |
| - name: Cargo clippy | |
| run: cargo clippy --workspace -- -D warnings | |
| - name: Cargo fmt check | |
| run: cargo fmt --all -- --check | |
| deno-lint: | |
| name: Deno Lint and Format Check | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Deno | |
| uses: denoland/setup-deno@v2 | |
| with: | |
| deno-version: v2.x | |
| - name: Check Deno formatting | |
| run: deno fmt --check | |
| - name: Run Deno lint | |
| run: deno lint | |
| build: | |
| name: Build (${{ matrix.platform }}) | |
| needs: [rust-lint, deno-lint, vitest-tests, playwright-tests, rust-tests] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: macos | |
| os: [macOS, ARM64, studio] | |
| target: aarch64-apple-darwin | |
| - platform: linux | |
| os: blacksmith-4vcpu-ubuntu-2404 | |
| target: x86_64-unknown-linux-gnu | |
| - platform: windows | |
| os: [self-hosted, Windows, X64] | |
| target: x86_64-pc-windows-msvc | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Bootstrap Windows prerequisites | |
| if: runner.os == 'Windows' | |
| shell: powershell | |
| run: | | |
| $ProgressPreference = 'SilentlyContinue' | |
| $toInstall = @() | |
| if (-not (Get-Command git -ErrorAction SilentlyContinue)) { $toInstall += 'git' } | |
| if (-not (Get-Command pwsh -ErrorAction SilentlyContinue)) { $toInstall += 'pwsh' } | |
| if ($toInstall.Count -gt 0) { | |
| choco install @toInstall -y | |
| } | |
| $gitPath = (Get-ItemProperty 'HKLM:\SOFTWARE\GitForWindows' -ErrorAction SilentlyContinue).InstallPath | |
| if ($gitPath) { | |
| echo "$gitPath\cmd" >> $env:GITHUB_PATH | |
| } | |
| - uses: actions/checkout@v6 | |
| - name: Setup Tauri build environment | |
| uses: ./.github/actions/setup-tauri-build | |
| - name: Cargo check (Linux) | |
| if: runner.os == 'Linux' | |
| shell: bash | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: task ci:check TARGET=${{ matrix.target }} | |
| - name: Cargo check (macOS) | |
| if: runner.os == 'macOS' | |
| shell: bash | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: task ci:check TARGET=${{ matrix.target }} | |
| - name: Cargo check (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: task ci:check TARGET=${{ matrix.target }} | |
| vitest-tests: | |
| name: Vitest Unit Tests | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: app/frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| working-directory: ./app/frontend | |
| run: npm ci | |
| - name: Run Vitest with coverage | |
| working-directory: ./app/frontend | |
| run: npm run test:coverage | |
| continue-on-error: true | |
| - name: Upload coverage report | |
| if: always() | |
| continue-on-error: true | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: vitest-coverage | |
| path: app/frontend/coverage/ | |
| retention-days: 30 | |
| playwright-tests: | |
| name: Playwright E2E Tests | |
| runs-on: [macOS, ARM64] | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| - name: Install frontend dependencies | |
| working-directory: ./app/frontend | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| working-directory: ./app/frontend | |
| run: npx playwright install --with-deps webkit | |
| - name: Kill stale dev server on port 5173 | |
| run: lsof -ti:5173 | xargs kill -9 2>/dev/null || true | |
| - name: Run Playwright tests | |
| working-directory: ./app/frontend | |
| run: npx playwright test | |
| env: | |
| CI: true | |
| - name: Upload Playwright report | |
| if: always() | |
| continue-on-error: true | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 30 | |
| - name: Upload test results | |
| if: always() | |
| continue-on-error: true | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: playwright-results | |
| path: test-results/ | |
| retention-days: 30 | |
| rust-tests: | |
| name: Rust Tests with Coverage | |
| needs: rust-lint | |
| runs-on: [macOS, ARM64, studio] | |
| timeout-minutes: 10 | |
| env: | |
| CARGO_INCREMENTAL: 1 | |
| CARGO_TERM_COLOR: always | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Tauri build environment | |
| uses: ./.github/actions/setup-tauri-build | |
| - name: Check Rust build | |
| run: cargo check --workspace --all-features | |
| - uses: cargo-bins/cargo-binstall@main | |
| - name: Install cargo-tarpaulin | |
| run: cargo binstall --no-confirm --force cargo-tarpaulin | |
| - name: Run Rust tests with coverage | |
| run: | | |
| cargo tarpaulin --workspace --out Html --out Json --output-dir coverage \ | |
| --ignore-tests --skip-clean \ | |
| --exclude-files 'crates/mt-tauri/src/commands/*' 'crates/mt-tauri/src/lib.rs' 'crates/mt-tauri/src/main.rs' 'crates/mt-tauri/src/watcher.rs' 'crates/mt-tauri/src/dialog.rs' 'crates/mt-tauri/src/media_keys.rs' \ | |
| --fail-under 50 | |
| - name: Upload coverage report | |
| if: always() | |
| continue-on-error: true | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: rust-coverage | |
| path: coverage/ | |
| retention-days: 30 |