|
| 1 | +name: Build desktop artifact |
| 2 | +description: Build, smoke-test, and upload one desktop bundle |
| 3 | + |
| 4 | +inputs: |
| 5 | + bundle: |
| 6 | + description: Tauri bundle type |
| 7 | + required: true |
| 8 | + target_triple: |
| 9 | + description: Optional Rust target triple |
| 10 | + required: true |
| 11 | + artifact_name: |
| 12 | + description: Uploaded artifact name |
| 13 | + required: true |
| 14 | + artifact_dir: |
| 15 | + description: Bundle output directory |
| 16 | + required: true |
| 17 | +runs: |
| 18 | + using: composite |
| 19 | + steps: |
| 20 | + - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 |
| 21 | + with: |
| 22 | + go-version-file: go.mod |
| 23 | + cache: ${{ inputs.bundle == 'appimage' && inputs.target_triple == '' && github.repository == 'kenn-io/agentsview' && (github.event_name == 'push' && github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.base.repo.full_name == github.repository)) && 'false' || 'true' }} |
| 24 | + |
| 25 | + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 26 | + with: |
| 27 | + node-version: "24" |
| 28 | + |
| 29 | + - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable |
| 30 | + |
| 31 | + - name: Setup MinGW (Windows) |
| 32 | + if: runner.os == 'Windows' |
| 33 | + uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2 |
| 34 | + with: |
| 35 | + msystem: MINGW64 |
| 36 | + update: false |
| 37 | + install: mingw-w64-x86_64-gcc |
| 38 | + path-type: inherit |
| 39 | + |
| 40 | + - name: Install Linux system dependencies |
| 41 | + if: runner.os == 'Linux' |
| 42 | + shell: bash |
| 43 | + run: | |
| 44 | + sudo apt-get update -q |
| 45 | + sudo apt-get install -y \ |
| 46 | + libwebkit2gtk-4.1-dev libgtk-3-dev \ |
| 47 | + libappindicator3-dev librsvg2-dev \ |
| 48 | + patchelf squashfs-tools xdg-utils |
| 49 | +
|
| 50 | + - name: Install Rust target |
| 51 | + shell: bash |
| 52 | + env: |
| 53 | + AGENTSVIEW_TARGET_TRIPLE: ${{ inputs.target_triple }} |
| 54 | + run: | |
| 55 | + if [ -n "$AGENTSVIEW_TARGET_TRIPLE" ]; then |
| 56 | + rustup target add "$AGENTSVIEW_TARGET_TRIPLE" |
| 57 | + fi |
| 58 | +
|
| 59 | + - name: Install desktop dependencies |
| 60 | + shell: bash |
| 61 | + run: npm ci |
| 62 | + working-directory: desktop |
| 63 | + |
| 64 | + - name: Desktop sidecar smoke tests |
| 65 | + shell: bash |
| 66 | + run: bash desktop/scripts/test-prepare-sidecar.sh |
| 67 | + |
| 68 | + - name: Build desktop bundle |
| 69 | + shell: bash |
| 70 | + env: |
| 71 | + AGENTSVIEW_TARGET_TRIPLE: ${{ inputs.target_triple }} |
| 72 | + ARTIFACT_DIR: ${{ inputs.artifact_dir }} |
| 73 | + BUNDLE: ${{ inputs.bundle }} |
| 74 | + run: | |
| 75 | + cd desktop |
| 76 | + export TAURI_ENV_TARGET_TRIPLE="$AGENTSVIEW_TARGET_TRIPLE" |
| 77 | + npm run prepare-sidecar |
| 78 | + build_cmd=(npx tauri build --verbose --bundles "$BUNDLE") |
| 79 | + if [ -n "$AGENTSVIEW_TARGET_TRIPLE" ]; then |
| 80 | + build_cmd+=(--target "$AGENTSVIEW_TARGET_TRIPLE") |
| 81 | + fi |
| 82 | + build_cmd+=(--config '{"bundle":{"createUpdaterArtifacts":false}}') |
| 83 | + "${build_cmd[@]}" |
| 84 | + if [ "$BUNDLE" = "appimage" ]; then |
| 85 | + bash scripts/repair-appimage-diricon.sh \ |
| 86 | + "../${ARTIFACT_DIR}"/*.AppImage |
| 87 | + fi |
| 88 | +
|
| 89 | + - name: Desktop smoke tests (Rust unit tests) |
| 90 | + shell: bash |
| 91 | + env: |
| 92 | + AGENTSVIEW_TARGET_TRIPLE: ${{ inputs.target_triple }} |
| 93 | + run: | |
| 94 | + test_cmd=(cargo test --manifest-path desktop/src-tauri/Cargo.toml --lib) |
| 95 | + if [ -n "$AGENTSVIEW_TARGET_TRIPLE" ]; then |
| 96 | + export TAURI_ENV_TARGET_TRIPLE="$AGENTSVIEW_TARGET_TRIPLE" |
| 97 | + test_cmd+=(--target "$AGENTSVIEW_TARGET_TRIPLE") |
| 98 | + fi |
| 99 | + "${test_cmd[@]}" |
| 100 | +
|
| 101 | + - name: Smoke check sidecar metadata |
| 102 | + shell: bash |
| 103 | + env: |
| 104 | + AGENTSVIEW_TARGET_TRIPLE: ${{ inputs.target_triple }} |
| 105 | + run: | |
| 106 | + target_triple="${AGENTSVIEW_TARGET_TRIPLE:-$(rustc -vV | awk '/^host: /{print $2}')}" |
| 107 | + if [ -z "$target_triple" ]; then |
| 108 | + echo "target triple is empty" >&2 |
| 109 | + exit 1 |
| 110 | + fi |
| 111 | +
|
| 112 | + ext="" |
| 113 | + if [[ "$target_triple" == *"windows"* ]]; then |
| 114 | + ext=".exe" |
| 115 | + fi |
| 116 | + sidecar="desktop/src-tauri/binaries/agentsview-${target_triple}${ext}" |
| 117 | + if [ ! -f "$sidecar" ]; then |
| 118 | + echo "missing sidecar binary: $sidecar" >&2 |
| 119 | + exit 1 |
| 120 | + fi |
| 121 | +
|
| 122 | + "$sidecar" version > sidecar-version.txt |
| 123 | + if grep -q "agentsview dev" sidecar-version.txt; then |
| 124 | + echo "sidecar version should not be dev: $(cat sidecar-version.txt)" >&2 |
| 125 | + exit 1 |
| 126 | + fi |
| 127 | + if grep -q "commit unknown" sidecar-version.txt; then |
| 128 | + echo "sidecar metadata missing commit: $(cat sidecar-version.txt)" >&2 |
| 129 | + exit 1 |
| 130 | + fi |
| 131 | + if grep -Eq "built[[:space:]]*\)$" sidecar-version.txt; then |
| 132 | + echo "sidecar metadata missing build date: $(cat sidecar-version.txt)" >&2 |
| 133 | + exit 1 |
| 134 | + fi |
| 135 | +
|
| 136 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 137 | + with: |
| 138 | + name: ${{ inputs.artifact_name }} |
| 139 | + path: ${{ inputs.artifact_dir }} |
| 140 | + if-no-files-found: error |
0 commit comments