From cde4a85cc7398589d1a6b8fc4f76b331bc2782c4 Mon Sep 17 00:00:00 2001 From: Shaun Arman Date: Sun, 5 Apr 2026 10:33:49 -0500 Subject: [PATCH] fix(ci): fix arm64 cross-compile, drop cargo install tauri-cli, move wiki-sync build-linux-arm64: switch from QEMU-emulated linux-arm64 runner to cross-compile on linux-amd64 using aarch64-linux-gnu toolchain. Removes the uname -m arch guard that was causing the job to exit immediately (QEMU reports x86_64 as kernel arch), and fixes the artifact path to the explicit target directory. All build jobs: replace `cargo install tauri-cli --locked` with `npx tauri build`, using the pre-compiled @tauri-apps/cli binary from devDependencies. Eliminates the 20-30 min Tauri CLI recompilation on every run. wiki-sync: move from test.yml to auto-tag.yml. test.yml only fires on pull_request events so the `if: github.ref == 'refs/heads/master'` guard was never true and the wiki was never updated. auto-tag.yml triggers on push to master, so wiki sync now runs on every merge. Update releaseWorkflowCrossPlatformArtifacts.test.ts to match the new workflow. --- .gitea/workflows/auto-tag.yml | 104 +++++++++++++++--- .gitea/workflows/test.yml | 70 ------------ ...easeWorkflowCrossPlatformArtifacts.test.ts | 10 +- 3 files changed, 91 insertions(+), 93 deletions(-) diff --git a/.gitea/workflows/auto-tag.yml b/.gitea/workflows/auto-tag.yml index 2af1304e..675aeeff 100644 --- a/.gitea/workflows/auto-tag.yml +++ b/.gitea/workflows/auto-tag.yml @@ -59,6 +59,69 @@ jobs: echo "Tag $NEXT pushed successfully" + wiki-sync: + runs-on: linux-amd64 + container: + image: alpine:latest + steps: + - name: Install dependencies + run: apk add --no-cache git + + - name: Checkout main repository + run: | + git init + git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git + git fetch --depth=1 origin $GITHUB_SHA + git checkout FETCH_HEAD + + - name: Configure git + run: | + git config --global user.email "actions@gitea.local" + git config --global user.name "Gitea Actions" + git config --global credential.helper '' + + - name: Clone and sync wiki + env: + WIKI_TOKEN: ${{ secrets.Wiki }} + run: | + cd /tmp + if [ -n "$WIKI_TOKEN" ]; then + WIKI_URL="http://${WIKI_TOKEN}@172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git" + else + WIKI_URL="http://172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git" + fi + + if ! git clone "$WIKI_URL" wiki 2>/dev/null; then + echo "Wiki doesn't exist yet, creating initial structure..." + mkdir -p wiki + cd wiki + git init + git checkout -b master + echo "# Wiki" > Home.md + git add Home.md + git commit -m "Initial wiki commit" + git remote add origin "$WIKI_URL" + fi + + cd /tmp/wiki + if [ -d "$GITHUB_WORKSPACE/docs/wiki" ]; then + cp -v "$GITHUB_WORKSPACE"/docs/wiki/*.md . 2>/dev/null || echo "No wiki files to copy" + fi + + git add -A + if ! git diff --staged --quiet; then + git commit -m "docs: sync from docs/wiki/ at commit ${GITHUB_SHA:0:8}" + echo "Pushing to wiki..." + if git push origin master; then + echo "✓ Wiki successfully synced" + else + echo "⚠ Wiki push failed - check token permissions" + exit 1 + fi + else + echo "No wiki changes to commit" + fi + build-linux-amd64: needs: autotag runs-on: linux-amd64 @@ -84,8 +147,7 @@ jobs: run: | npm ci --legacy-peer-deps rustup target add x86_64-unknown-linux-gnu - cargo install tauri-cli --version "^2" --locked - CI=true cargo tauri build --target x86_64-unknown-linux-gnu + CI=true npx tauri build --target x86_64-unknown-linux-gnu - name: Upload artifacts env: RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} @@ -175,8 +237,7 @@ jobs: run: | npm ci --legacy-peer-deps rustup target add x86_64-pc-windows-gnu - cargo install tauri-cli --version "^2" --locked - CI=true cargo tauri build --target x86_64-pc-windows-gnu + CI=true npx tauri build --target x86_64-pc-windows-gnu - name: Upload artifacts env: RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} @@ -252,8 +313,7 @@ jobs: run: | npm ci --legacy-peer-deps rustup target add aarch64-apple-darwin - cargo install tauri-cli --version "^2" --locked - CI=true cargo tauri build --target aarch64-apple-darwin --bundles app + CI=true npx tauri build --target aarch64-apple-darwin --bundles app APP=$(find src-tauri/target/aarch64-apple-darwin/release/bundle/macos -maxdepth 1 -type d -name "*.app" | head -n 1) if [ -z "$APP" ]; then echo "ERROR: Could not find macOS app bundle" @@ -324,7 +384,7 @@ jobs: build-linux-arm64: needs: autotag - runs-on: linux-arm64 + runs-on: linux-amd64 container: image: rust:1.88-slim steps: @@ -337,22 +397,30 @@ jobs: git checkout FETCH_HEAD - name: Install dependencies run: | - apt-get update -qq && apt-get install -y -qq \ - libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev \ - libayatana-appindicator3-dev librsvg2-dev patchelf \ + dpkg --add-architecture arm64 + apt-get update -qq + apt-get install -y -qq \ + gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \ + libwebkit2gtk-4.1-dev:arm64 libssl-dev:arm64 libgtk-3-dev:arm64 \ + libayatana-appindicator3-dev:arm64 librsvg2-dev:arm64 patchelf \ pkg-config curl perl jq curl -fsSL https://deb.nodesource.com/setup_22.x | bash - apt-get install -y nodejs - name: Build + env: + CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc + CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++ + AR_aarch64_unknown_linux_gnu: aarch64-linux-gnu-ar + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc + PKG_CONFIG_SYSROOT_DIR: /usr/aarch64-linux-gnu + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: "1" + OPENSSL_NO_VENDOR: "0" + OPENSSL_STATIC: "1" run: | - ARCH=$(uname -m) - if [ "$ARCH" != "aarch64" ] && [ "$ARCH" != "arm64" ]; then - echo "ERROR: linux-arm64 job is not running on an ARM64 host (uname -m=$ARCH)." - exit 1 - fi npm ci --legacy-peer-deps - cargo install tauri-cli --version "^2" --locked - CI=true cargo tauri build + rustup target add aarch64-unknown-linux-gnu + CI=true npx tauri build --target aarch64-unknown-linux-gnu - name: Upload artifacts env: RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} @@ -379,7 +447,7 @@ jobs: exit 1 fi echo "Release ID: $RELEASE_ID" - ARTIFACTS=$(find src-tauri/target/release/bundle -type f \ + ARTIFACTS=$(find src-tauri/target/aarch64-unknown-linux-gnu/release/bundle -type f \ \( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \)) if [ -z "$ARTIFACTS" ]; then echo "ERROR: No Linux arm64 artifacts were found to upload." diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index bdbcb666..89582472 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -139,73 +139,3 @@ jobs: git checkout FETCH_HEAD - run: npm ci --legacy-peer-deps - run: npm run test:run - - wiki-sync: - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' - container: - image: alpine:latest - steps: - - name: Install dependencies - run: apk add --no-cache git - - - name: Checkout main repository - run: | - git init - git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git - git fetch --depth=1 origin $GITHUB_SHA - git checkout FETCH_HEAD - - - name: Configure git - run: | - git config --global user.email "actions@gitea.local" - git config --global user.name "Gitea Actions" - # Disable credential helper to avoid prompts - git config --global credential.helper '' - - - name: Clone and sync wiki - env: - WIKI_TOKEN: ${{ secrets.Wiki }} - run: | - # Clone wiki repository with authentication - cd /tmp - if [ -n "$WIKI_TOKEN" ]; then - WIKI_URL="http://${WIKI_TOKEN}@172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git" - else - WIKI_URL="http://172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git" - fi - - if ! git clone "$WIKI_URL" wiki 2>/dev/null; then - echo "Wiki doesn't exist yet, creating initial structure..." - mkdir -p wiki - cd wiki - git init - git checkout -b master - echo "# Wiki" > Home.md - git add Home.md - git commit -m "Initial wiki commit" - git remote add origin "$WIKI_URL" - fi - - # Copy wiki files - cd /tmp/wiki - if [ -d "$GITHUB_WORKSPACE/docs/wiki" ]; then - cp -v "$GITHUB_WORKSPACE"/docs/wiki/*.md . 2>/dev/null || echo "No wiki files to copy" - fi - - # Commit if there are changes - git add -A - if ! git diff --staged --quiet; then - git commit -m "docs: sync from docs/wiki/ at commit ${GITHUB_SHA:0:8}" - - # Push using token authentication - echo "Pushing to wiki..." - if git push origin master; then - echo "✓ Wiki successfully synced" - else - echo "⚠ Wiki push failed - check token permissions" - exit 1 - fi - else - echo "No wiki changes to commit" - fi diff --git a/tests/unit/releaseWorkflowCrossPlatformArtifacts.test.ts b/tests/unit/releaseWorkflowCrossPlatformArtifacts.test.ts index 940041ec..fa3fe6b6 100644 --- a/tests/unit/releaseWorkflowCrossPlatformArtifacts.test.ts +++ b/tests/unit/releaseWorkflowCrossPlatformArtifacts.test.ts @@ -20,11 +20,11 @@ describe("auto-tag release cross-platform artifact handling", () => { expect(workflow).toContain("ERROR: No Linux amd64 artifacts were found to upload."); expect(workflow).toContain("ERROR: No Linux arm64 artifacts were found to upload."); - expect(workflow).toContain( - "ERROR: linux-arm64 job is not running on an ARM64 host (uname -m=$ARCH).", - ); - expect(workflow).toContain("CI=true cargo tauri build"); - expect(workflow).toContain("find src-tauri/target/release/bundle -type f"); + expect(workflow).toContain("CI=true npx tauri build"); + expect(workflow).toContain("find src-tauri/target/aarch64-unknown-linux-gnu/release/bundle -type f"); + expect(workflow).toContain("CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc"); + expect(workflow).toContain("PKG_CONFIG_ALLOW_CROSS: \"1\""); + expect(workflow).toContain("aarch64-unknown-linux-gnu"); }); it("fails windows uploads when no artifacts are found", () => {