From c08ddd7b4835cb13a7f3dcab6821dde04c922d8f Mon Sep 17 00:00:00 2001 From: YXC0915 Date: Sat, 5 Dec 2026 21:11:03 +0800 Subject: [PATCH] ci: run Windows verification on Gitea --- .gitea/workflows/ci.yml | 87 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..65b6e6b --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,87 @@ +name: Windows CI + +on: + push: + branches: [main] + workflow_dispatch: + +concurrency: + group: reims-windows-ci-${{ github.ref }} + cancel-in-progress: true + +env: + GOCACHE: ${{ github.workspace }}/.debug/cache/go-build + +jobs: + verify: + runs-on: reims-windows-x64 + timeout-minutes: 30 + steps: + - name: Check out the triggering commit + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + $PSNativeCommandUseErrorActionPreference = $true + git init . + git remote add origin "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY.git" + git fetch --depth=1 origin $env:GITHUB_SHA + git checkout --detach FETCH_HEAD + if ((git rev-parse HEAD) -ne $env:GITHUB_SHA) { throw 'Unexpected checkout commit' } + + - name: Verify installed build tools + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + $PSNativeCommandUseErrorActionPreference = $true + git --version + go version + node --version + pnpm --version + + - name: Verify CHANGELOG.md matches current version + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + node scripts/changelog.mjs check + if ($LASTEXITCODE -ne 0) { throw 'Changelog validation failed' } + $verFile = Get-Content -Raw -LiteralPath 'internal/version/version.go' + if ($verFile -notmatch 'var\s+Version\s*=\s*"(v[^"]+)"') { + throw 'Could not parse Version from internal/version/version.go' + } + $ver = $Matches[1] + New-Item -ItemType Directory -Force -Path .debug/runs/ci | Out-Null + $tmp = Join-Path $PWD ".debug/runs/ci/release-notes-$ver.md" + & ./scripts/build-release-notes.ps1 -Tag $ver -OutFile $tmp + "REIMS_APP_VERSION=$ver" >> $env:GITHUB_ENV + Write-Host "PASS CHANGELOG.md contains valid release notes for $ver ($((Get-Item -LiteralPath $tmp).Length) bytes)" + + - name: Workspace hygiene + shell: pwsh + run: node scripts/debug/check.mjs + + - name: Install frontend dependencies + shell: pwsh + run: pnpm --dir frontend install --frozen-lockfile + + - name: CI tests + shell: pwsh + run: node scripts/test.mjs ci + + - name: Bundle frontend + shell: pwsh + run: pnpm --dir frontend bundle + + - name: Build reims-go.exe (window + command-line mode) + shell: pwsh + run: | + $env:GOTMPDIR = (Resolve-Path .debug/runs/ci).Path + $exe = '.debug/runs/ci/reims-go.exe' + go vet -tags desktop,production . + if ($LASTEXITCODE -ne 0) { throw 'Go desktop vet failed' } + go build -trimpath -tags desktop,production -ldflags "-H windowsgui" -o $exe . + if ($LASTEXITCODE -ne 0) { throw 'Go desktop build failed' } + ./scripts/check-release-artifact.ps1 -Executable $exe -Version $env:REIMS_APP_VERSION + + - name: WebView2 first-launch smoke + timeout-minutes: 3 + run: node scripts/test.mjs webview2 .debug/runs/ci/reims-go.exe