From 1d15e414826105dae55f30cfb5111e0a21a22512 Mon Sep 17 00:00:00 2001 From: YXC0915 Date: Sat, 5 Dec 2026 21:23:41 +0800 Subject: [PATCH] ci: shorten Windows checkout paths for Unix socket tests --- .gitea/workflows/ci.yml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 65b6e6b..6ae6b1b 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -10,7 +10,8 @@ concurrency: cancel-in-progress: true env: - GOCACHE: ${{ github.workspace }}/.debug/cache/go-build + REIMS_CI_WORKSPACE: D:/RgCI/${{ github.run_id }}-${{ github.run_attempt }} + GOCACHE: D:/RgCI/${{ github.run_id }}-${{ github.run_attempt }}/.debug/cache/go-build jobs: verify: @@ -22,6 +23,9 @@ jobs: run: | $ErrorActionPreference = 'Stop' $PSNativeCommandUseErrorActionPreference = $true + if (Test-Path -LiteralPath $env:REIMS_CI_WORKSPACE) { throw 'The CI checkout directory already exists' } + New-Item -ItemType Directory -Path $env:REIMS_CI_WORKSPACE -Force | Out-Null + Set-Location -LiteralPath $env:REIMS_CI_WORKSPACE git init . git remote add origin "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY.git" git fetch --depth=1 origin $env:GITHUB_SHA @@ -29,6 +33,7 @@ jobs: if ((git rev-parse HEAD) -ne $env:GITHUB_SHA) { throw 'Unexpected checkout commit' } - name: Verify installed build tools + working-directory: ${{ env.REIMS_CI_WORKSPACE }} shell: pwsh run: | $ErrorActionPreference = 'Stop' @@ -39,6 +44,7 @@ jobs: pnpm --version - name: Verify CHANGELOG.md matches current version + working-directory: ${{ env.REIMS_CI_WORKSPACE }} shell: pwsh run: | $ErrorActionPreference = 'Stop' @@ -56,22 +62,27 @@ jobs: Write-Host "PASS CHANGELOG.md contains valid release notes for $ver ($((Get-Item -LiteralPath $tmp).Length) bytes)" - name: Workspace hygiene + working-directory: ${{ env.REIMS_CI_WORKSPACE }} shell: pwsh run: node scripts/debug/check.mjs - name: Install frontend dependencies + working-directory: ${{ env.REIMS_CI_WORKSPACE }} shell: pwsh run: pnpm --dir frontend install --frozen-lockfile - name: CI tests + working-directory: ${{ env.REIMS_CI_WORKSPACE }} shell: pwsh run: node scripts/test.mjs ci - name: Bundle frontend + working-directory: ${{ env.REIMS_CI_WORKSPACE }} shell: pwsh run: pnpm --dir frontend bundle - name: Build reims-go.exe (window + command-line mode) + working-directory: ${{ env.REIMS_CI_WORKSPACE }} shell: pwsh run: | $env:GOTMPDIR = (Resolve-Path .debug/runs/ci).Path @@ -83,5 +94,22 @@ jobs: ./scripts/check-release-artifact.ps1 -Executable $exe -Version $env:REIMS_APP_VERSION - name: WebView2 first-launch smoke + working-directory: ${{ env.REIMS_CI_WORKSPACE }} timeout-minutes: 3 run: node scripts/test.mjs webview2 .debug/runs/ci/reims-go.exe + + - name: Remove the CI checkout + if: always() + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + if (!(Test-Path -LiteralPath $env:REIMS_CI_WORKSPACE)) { return } + $checkout = Get-Item -LiteralPath $env:REIMS_CI_WORKSPACE + $parent = Get-Item -LiteralPath 'D:/RgCI' + if ($checkout.Parent.FullName -ne $parent.FullName -or + $checkout.Name -notmatch '^[0-9]+-[0-9]+$' -or + ($checkout.Attributes -band [IO.FileAttributes]::ReparsePoint) -or + ($parent.Attributes -band [IO.FileAttributes]::ReparsePoint)) { + throw 'Refusing to remove an unexpected CI checkout path' + } + Remove-Item -LiteralPath $checkout.FullName -Recurse -Force