|
| 1 | +name: Build Tauri Apps |
| 2 | +description: 'Builds Tauri test applications and creates shareable artifacts for E2E testing' |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_call: |
| 6 | + # Make this a reusable workflow, no value needed |
| 7 | + # https://docs.github.com/en/actions/using-workflows/reusing-workflows |
| 8 | + inputs: |
| 9 | + os: |
| 10 | + description: 'OS of runner' |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + build-command: |
| 14 | + description: 'Build command for Tauri apps (build or build:debug)' |
| 15 | + type: string |
| 16 | + default: 'build' |
| 17 | + outputs: |
| 18 | + build_id: |
| 19 | + description: 'Unique identifier for this build' |
| 20 | + value: ${{ jobs.build-tauri-apps.outputs.build_id }} |
| 21 | + build_date: |
| 22 | + description: 'Timestamp when the build completed' |
| 23 | + value: ${{ jobs.build-tauri-apps.outputs.build_date }} |
| 24 | + artifact_size: |
| 25 | + description: 'Size of the build artifact in bytes' |
| 26 | + value: ${{ jobs.build-tauri-apps.outputs.artifact_size }} |
| 27 | + cache_key: |
| 28 | + description: 'Cache key used for artifact uploads, can be passed to download actions' |
| 29 | + value: ${{ jobs.build-tauri-apps.outputs.cache_key }} |
| 30 | + |
| 31 | +env: |
| 32 | + TURBO_TELEMETRY_DISABLED: 1 |
| 33 | + TURBO_DAEMON: false |
| 34 | + |
| 35 | +jobs: |
| 36 | + # This job builds all Tauri test applications for the specified OS |
| 37 | + # Unlike package builds, each OS creates its own artifacts since binaries are platform-specific |
| 38 | + build-tauri-apps: |
| 39 | + name: Build Tauri Apps |
| 40 | + runs-on: ${{ inputs.os }} |
| 41 | + outputs: |
| 42 | + build_id: ${{ steps.build-info.outputs.build_id }} |
| 43 | + build_date: ${{ steps.build-info.outputs.build_date }} |
| 44 | + artifact_size: ${{ steps.upload-archive.outputs.size || '0' }} |
| 45 | + cache_key: ${{ steps.upload-archive.outputs.cache_key }} |
| 46 | + steps: |
| 47 | + # Standard checkout with SSH key for private repositories |
| 48 | + - name: 👷 Checkout Repository |
| 49 | + uses: actions/checkout@v5 |
| 50 | + with: |
| 51 | + ssh-key: ${{ secrets.DEPLOY_KEY }} |
| 52 | + |
| 53 | + # Set up Node.js and PNPM using the reusable action |
| 54 | + - name: 🛠️ Setup Development Environment |
| 55 | + uses: ./.github/workflows/actions/setup-workspace |
| 56 | + with: |
| 57 | + node-version: '20' |
| 58 | + |
| 59 | + # Install Rust toolchain for Tauri compilation |
| 60 | + - name: 🦀 Install Rust Toolchain |
| 61 | + uses: dtolnay/rust-toolchain@stable |
| 62 | + |
| 63 | + # Install Tauri dependencies on Linux |
| 64 | + - name: 🦀 Install Tauri Dependencies (Linux) |
| 65 | + if: runner.os == 'Linux' |
| 66 | + shell: bash |
| 67 | + run: | |
| 68 | + echo "Installing Tauri dependencies for Linux..." |
| 69 | + sudo tee -a /etc/apt/sources.list > /dev/null <<EOT |
| 70 | + deb http://archive.ubuntu.com/ubuntu jammy main universe |
| 71 | + EOT |
| 72 | + sudo apt-get update |
| 73 | + sudo apt-get install -y \ |
| 74 | + build-essential \ |
| 75 | + pkg-config \ |
| 76 | + libgtk-3-dev \ |
| 77 | + libwebkit2gtk-4.0-dev \ |
| 78 | + libwebkit2gtk-4.1-dev \ |
| 79 | + libappindicator3-dev \ |
| 80 | + librsvg2-dev \ |
| 81 | + patchelf \ |
| 82 | + libglib2.0-dev \ |
| 83 | + libsoup-2.4-1 \ |
| 84 | + libsoup2.4-dev \ |
| 85 | + libjavascriptcoregtk-4.0-dev \ |
| 86 | + libjavascriptcoregtk-4.1-dev \ |
| 87 | + libssl-dev \ |
| 88 | + libasound2-dev \ |
| 89 | + libx11-dev \ |
| 90 | + libxext-dev \ |
| 91 | + libxfixes-dev \ |
| 92 | + libxrender-dev \ |
| 93 | + libxrandr-dev \ |
| 94 | + libxss-dev \ |
| 95 | + libxtst-dev \ |
| 96 | + libxcomposite-dev \ |
| 97 | + libxcursor-dev \ |
| 98 | + libxdamage-dev \ |
| 99 | + libxinerama-dev \ |
| 100 | + libxcb1-dev \ |
| 101 | + libxcb-shape0-dev \ |
| 102 | + libxcb-xfixes0-dev \ |
| 103 | + libxcb-render0-dev \ |
| 104 | + libxcb-randr0-dev \ |
| 105 | + libxcb-xinerama0-dev \ |
| 106 | + libxcb-xkb-dev \ |
| 107 | + libxcb-image0-dev \ |
| 108 | + libxcb-util0-dev \ |
| 109 | + libxcb-icccm4-dev \ |
| 110 | + libxcb-ewmh-dev \ |
| 111 | + libxcb-dri2-0-dev |
| 112 | +
|
| 113 | + # Generate build information for tracking |
| 114 | + - name: 📊 Generate Build Information |
| 115 | + id: build-info |
| 116 | + shell: bash |
| 117 | + run: | |
| 118 | + echo "build_id=$(date +%s)-${{ github.run_id }}-${{ runner.os }}" >> $GITHUB_OUTPUT |
| 119 | + echo "build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT |
| 120 | +
|
| 121 | + # Build all Tauri test applications using Turbo |
| 122 | + # This creates the binaries in src-tauri/target/release (or debug) |
| 123 | + - name: 🏗️ Build All Tauri Apps |
| 124 | + run: pnpm exec turbo run ${{ inputs.build-command }} --filter=tauri-*-app --only --parallel |
| 125 | + shell: bash |
| 126 | + |
| 127 | + # Upload Tauri app binaries as artifacts |
| 128 | + # Each OS uploads its own artifacts since binaries are platform-specific |
| 129 | + # Using GitHub Actions cache with ~90 day retention (vs. 1 day for regular artifacts) |
| 130 | + - name: 📦 Upload Tauri App Binaries |
| 131 | + id: upload-archive |
| 132 | + uses: ./.github/workflows/actions/upload-archive |
| 133 | + with: |
| 134 | + name: tauri-apps-${{ runner.os }} |
| 135 | + output: tauri-apps-${{ runner.os }}/artifact.zip |
| 136 | + paths: fixtures/tauri-apps/*/src-tauri/target |
| 137 | + cache_key_prefix: tauri-apps |
| 138 | + retention_days: '90' |
0 commit comments