From 9880afa117a1b05c5039cf22d214a662c138e972 Mon Sep 17 00:00:00 2001 From: Shaun Arman Date: Sun, 29 Mar 2026 14:50:48 -0500 Subject: [PATCH] ci: migrate from Woodpecker to Gitea Actions Replaces .woodpecker/*.yml with Gitea Actions workflows: - .gitea/workflows/test.yml: triggers on push/PR, runs 5 jobs (rust-fmt-check, rust-clippy, rust-tests, frontend-typecheck, frontend-tests) using rust:1.88-slim and node:22-alpine containers. - .gitea/workflows/release.yml: triggers on v* tags, 4 jobs: - build-linux-amd64 (linux-amd64 runner, cross-compile x86_64) - build-windows-amd64 (linux-amd64 runner, mingw cross-compile) - build-linux-arm64 (linux-arm64 runner, native aarch64) - upload-release (runs after all 3 build jobs, uses actions/download-artifact + Gitea release API) Runners registered: - amd64-docker-runner (Docker, 172.0.0.29, labels: ubuntu-latest linux-amd64) - arm64-native-runner (systemd, local arm64 machine, label: linux-arm64) Secrets: RELEASE_TOKEN set in repo Actions secrets. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- .gitea/workflows/release.yml | 137 +++++++++++++++++++++++++++++++++++ .gitea/workflows/test.yml | 50 +++++++++++++ 2 files changed, 187 insertions(+) create mode 100644 .gitea/workflows/release.yml create mode 100644 .gitea/workflows/test.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 00000000..f560480d --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,137 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + build-linux-amd64: + runs-on: linux-amd64 + container: + image: rust:1.88-slim + steps: + - uses: actions/checkout@v4 + - 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 \ + pkg-config curl perl + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - + apt-get install -y nodejs + - name: Build + 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 + - name: Collect artifacts + run: | + mkdir -p artifacts + find src-tauri/target/x86_64-unknown-linux-gnu/release/bundle \ + \( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) \ + -exec cp {} artifacts/ \; + - uses: actions/upload-artifact@v4 + with: + name: linux-amd64 + path: artifacts/ + + build-windows-amd64: + runs-on: linux-amd64 + container: + image: rust:1.88-slim + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: | + apt-get update -qq && apt-get install -y -qq mingw-w64 curl nsis perl make + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - + apt-get install -y nodejs + - name: Build + env: + CC_x86_64_pc_windows_gnu: x86_64-w64-mingw32-gcc + CXX_x86_64_pc_windows_gnu: x86_64-w64-mingw32-g++ + AR_x86_64_pc_windows_gnu: x86_64-w64-mingw32-ar + CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc + 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 + - name: Collect artifacts + run: | + mkdir -p artifacts + find src-tauri/target/x86_64-pc-windows-gnu/release/bundle \ + \( -name "*.exe" -o -name "*.msi" \) \ + -exec cp {} artifacts/ \; 2>/dev/null || true + - uses: actions/upload-artifact@v4 + with: + name: windows-amd64 + path: artifacts/ + + build-linux-arm64: + runs-on: linux-arm64 + container: + image: rust:1.88-slim + steps: + - uses: actions/checkout@v4 + - 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 \ + pkg-config curl perl + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - + apt-get install -y nodejs + - name: Build + run: | + npm ci --legacy-peer-deps + rustup target add aarch64-unknown-linux-gnu + cargo install tauri-cli --version "^2" --locked + CI=true cargo tauri build --target aarch64-unknown-linux-gnu + - name: Collect artifacts + run: | + mkdir -p artifacts + find src-tauri/target/aarch64-unknown-linux-gnu/release/bundle \ + \( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) \ + -exec cp {} artifacts/ \; + - uses: actions/upload-artifact@v4 + with: + name: linux-arm64 + path: artifacts/ + + upload-release: + needs: [build-linux-amd64, build-windows-amd64, build-linux-arm64] + runs-on: linux-amd64 + steps: + - uses: actions/download-artifact@v4 + with: + path: artifacts/ + + - name: Create Gitea release and upload artifacts + env: + RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} + run: | + TAG="${{ gitea.ref_name }}" + REPO="${{ gitea.repository }}" + API="http://gitea_app:3000/api/v1" + + # Create release (idempotent) + curl -sf -X POST "$API/repos/$REPO/releases" \ + -H "Authorization: token $RELEASE_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true + + # Get release ID + RELEASE_ID=$(curl -sf "$API/repos/$REPO/releases/tags/$TAG" \ + -H "Authorization: token $RELEASE_TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) + echo "Release ID: $RELEASE_ID" + + # Upload all artifacts + find artifacts/ -type f | while read f; do + echo "Uploading $f..." + curl -sf -X POST "$API/repos/$REPO/releases/$RELEASE_ID/assets" \ + -H "Authorization: token $RELEASE_TOKEN" \ + -F "attachment=@$f;filename=$(basename $f)" && echo "OK" || echo "Upload failed: $f" + done diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 00000000..ab8a0141 --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,50 @@ +name: Test + +on: [push, pull_request] + +jobs: + rust-fmt-check: + runs-on: ubuntu-latest + container: + image: rust:1.88-slim + steps: + - uses: actions/checkout@v4 + - run: rustup component add rustfmt + - run: cargo fmt --manifest-path src-tauri/Cargo.toml --check + + rust-clippy: + runs-on: ubuntu-latest + container: + image: rust:1.88-slim + steps: + - uses: actions/checkout@v4 + - 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 pkg-config perl + - run: rustup component add clippy + - run: cargo clippy --manifest-path src-tauri/Cargo.toml -- -D warnings + + rust-tests: + runs-on: ubuntu-latest + container: + image: rust:1.88-slim + steps: + - uses: actions/checkout@v4 + - 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 pkg-config perl + - run: cargo test --manifest-path src-tauri/Cargo.toml + + frontend-typecheck: + runs-on: ubuntu-latest + container: + image: node:22-alpine + steps: + - uses: actions/checkout@v4 + - run: npm ci --legacy-peer-deps + - run: npx tsc --noEmit + + frontend-tests: + runs-on: ubuntu-latest + container: + image: node:22-alpine + steps: + - uses: actions/checkout@v4 + - run: npm ci --legacy-peer-deps + - run: npm run test:run