# Gitea Actions workflow: .NET build with ephemeral VMware VM # Copy this file to: .gitea/workflows/build.yml in your repository. # # This workflow triggers on push to main/develop and on pull requests. # It routes the job to the act_runner with label "windows-build", # which creates an isolated VM per build. name: Build (.NET / MSBuild) on: push: branches: - main - develop - 'release/**' pull_request: branches: - main - develop jobs: build: # Must match the runner label defined in runner/config.yaml runs-on: windows-build # Job-level timeout (should be less than the runner's timeout setting) timeout-minutes: 90 env: # Override these per-repository or in Gitea's repository secrets # GITEA_CI_TEMPLATE_PATH is injected by runner/config.yaml global envs # GITEA_CI_CLONE_BASE_DIR is injected by runner/config.yaml global envs # Gitea Credential Manager target (set in runner/config.yaml) # The VM IP is auto-detected via vmrun getGuestIPAddress — no BUILD_VM_IP needed. GUEST_CRED_TARGET: "BuildVMGuest" steps: # Step 1: Check out the repository on the RUNNER HOST # (This gives the runner access to the scripts/ directory) - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 1 # Step 2: Invoke the orchestrator script # This script handles the entire VM lifecycle: # clone → start → wait ready → build → collect artifacts → destroy - name: Build in ephemeral VM shell: pwsh run: | $ErrorActionPreference = 'Stop' # Resolve the scripts directory relative to the checked-out repo. # If your CI scripts are in a separate repo, adjust the path. $ciScriptsDir = Join-Path $env:GITHUB_WORKSPACE 'scripts' & "$ciScriptsDir\Invoke-CIJob.ps1" ` -JobId "${{ github.run_id }}-${{ github.run_attempt }}" ` -RepoUrl "${{ github.server_url }}/${{ github.repository }}.git" ` -Branch "${{ github.ref_name }}" ` -Commit "${{ github.sha }}" ` -Submodules ` -BuildCommand 'python build_plugin.py --final --dist-dir dist' ` -GuestArtifactSource 'dist' ` -GuestCredentialTarget "$env:GUEST_CRED_TARGET" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Step 3: Upload artifacts to Gitea # Artifacts were collected to F:\CI\Artifacts\{JobId}\ by Invoke-CIJob.ps1 - name: Upload build artifacts if: success() uses: actions/upload-artifact@v4 with: name: build-${{ github.sha }} path: F:\CI\Artifacts\${{ github.run_id }}-${{ github.run_attempt }}\ retention-days: 14 if-no-files-found: error # Step 4: Upload artifacts even on failure (for diagnostics) - name: Upload diagnostic logs on failure if: failure() uses: actions/upload-artifact@v4 with: name: build-logs-${{ github.sha }} path: F:\CI\Artifacts\${{ github.run_id }}-${{ github.run_attempt }}\*.log retention-days: 3 if-no-files-found: ignore --- # PARALLEL BUILD VARIANT (using matrix strategy) # Uncomment and adapt if you need to build multiple configurations in parallel. # # jobs: # build: # runs-on: windows-build # strategy: # matrix: # include: # - config: Release # vm_ip: "192.168.11.101" # - config: Debug # vm_ip: "192.168.11.102" # fail-fast: false # # steps: # - uses: actions/checkout@v4 # - name: Build (${{ matrix.config }}) # shell: pwsh # run: | # & scripts\Invoke-CIJob.ps1 ` # -JobId "${{ github.run_id }}-${{ matrix.config }}" ` # -RepoUrl "${{ github.server_url }}/${{ github.repository }}.git" ` # -Branch "${{ github.ref_name }}" ` # -Configuration "${{ matrix.config }}" ` # -VMIPAddress "${{ matrix.vm_ip }}"