P3 done: workflow-example.yml usa composite action (generalizzazione per altri repo)
Riscritta gitea/workflow-example.yml per usare la composite action Simone/local-ci-system/.gitea/actions/local-ci-build@main invece della chiamata diretta a Invoke-CIJob.ps1. Commenti inline guidano la personalizzazione per ogni repo: - build-command e artifact-source (unici campi obbligatori da adattare) - submodules, repo-url, use-git-clone (opzionali) - extra-guest-env-json per secret injection (chiavi di firma, GPG) - artifact-name personalizzato (e.g. con ref_name per tag build) Aggiunge workflow_dispatch per trigger manuale. Rimossa logica di orchestrazione inline: zero duplicazione tra repo. TODO.md: Gitea Workflow Integration chiuso (5/5).
This commit is contained in:
@@ -31,7 +31,7 @@ _Last updated: 2026-05-11 (post Sprint 14: §6.4+§6.5 DONE — build-nsis.yml m
|
|||||||
| [x] | Template VM (Fasi A→D) | 4 | 0 | Snapshot `BaseClean` preso, credenziali in Credential Manager |
|
| [x] | Template VM (Fasi A→D) | 4 | 0 | Snapshot `BaseClean` preso, credenziali in Credential Manager |
|
||||||
| [x] | Scripts Verification | 3 | 0 | e2e-008/009 SUCCESS, cleanup orfani + retry deleteVM ok |
|
| [x] | Scripts Verification | 3 | 0 | e2e-008/009 SUCCESS, cleanup orfani + retry deleteVM ok |
|
||||||
| [x] | Runner Configuration | 2 | 0 | `config.yaml`, capacity 4, `BuildVMGuest` |
|
| [x] | Runner Configuration | 2 | 0 | `config.yaml`, capacity 4, `BuildVMGuest` |
|
||||||
| [ ] | Gitea Workflow Integration | 4 | 1 | manca solo §P3 generalizzazione workflow |
|
| [x] | Gitea Workflow Integration | 5 | 0 | tutti completati — example.yml usa composite action |
|
||||||
| [x] | §1 Sicurezza & hardening | 3 | 0 | 1.1, 1.4, 1.6 done; 1.2/1.3/1.5/1.7/1.8 deferred (home lab) |
|
| [x] | §1 Sicurezza & hardening | 3 | 0 | 1.1, 1.4, 1.6 done; 1.2/1.3/1.5/1.7/1.8 deferred (home lab) |
|
||||||
| [x] | §2 Affidabilità & resilienza | 7 | 0 | tutto done (2.1-2.7) |
|
| [x] | §2 Affidabilità & resilienza | 7 | 0 | tutto done (2.1-2.7) |
|
||||||
| [x] | §3 Performance & throughput | 4 | 0 | 3.1/3.2/3.3/3.6 done; 3.4/3.5 deferred — **§3 CHIUSO** |
|
| [x] | §3 Performance & throughput | 4 | 0 | 3.1/3.2/3.3/3.6 done; 3.4/3.5 deferred — **§3 CHIUSO** |
|
||||||
@@ -173,8 +173,11 @@ _Last updated: 2026-05-11 (post Sprint 14: §6.4+§6.5 DONE — build-nsis.yml m
|
|||||||
- [x] Push commit e verificare job in Gitea Actions UI
|
- [x] Push commit e verificare job in Gitea Actions UI
|
||||||
- [x] Verificare artifact scaricabile da Gitea dopo build riuscita
|
- [x] Verificare artifact scaricabile da Gitea dopo build riuscita
|
||||||
- [x] `gitea/workflows/lint.yml` creato — PSScriptAnalyzer su push/PR che toccano `.ps1` (2026-05-09)
|
- [x] `gitea/workflows/lint.yml` creato — PSScriptAnalyzer su push/PR che toccano `.ps1` (2026-05-09)
|
||||||
- [ ] **[P3] Adattare workflow per altri repository** — generalizzare `BUILD_COMMAND` e `ARTIFACT_SOURCE`.
|
- [x] **[P3] Adattare workflow per altri repository** — generalizzare `BUILD_COMMAND` e `ARTIFACT_SOURCE`.
|
||||||
Vedi anche §6.2 (composite action riutilizzabile).
|
COMPLETATO 2026-05-11: `gitea/workflow-example.yml` riscritto per usare la composite action
|
||||||
|
`Simone/local-ci-system/.gitea/actions/local-ci-build@main`. Commenti inline guidano
|
||||||
|
la personalizzazione di `build-command`, `artifact-source`, submodules, SSH URL,
|
||||||
|
`extra-guest-env-json` e `artifact-name`. Nessuna logica di orchestrazione nei repo chiamanti.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+34
-54
@@ -1,11 +1,20 @@
|
|||||||
# Gitea Actions workflow: .NET build with ephemeral VMware VM
|
# Gitea Actions workflow — generic build template using the composite action.
|
||||||
# Copy this file to: .gitea/workflows/build.yml in your repository.
|
# Copy this file to: .gitea/workflows/build.yml in your repository.
|
||||||
#
|
#
|
||||||
# This workflow triggers on push to main/develop and on pull requests.
|
# Adapt the two fields below to your project:
|
||||||
# It routes the job to the act_runner with label "windows-build",
|
# build-command : the command to run inside the ephemeral VM
|
||||||
# which creates an isolated VM per build.
|
# artifact-source : the directory inside the VM where outputs are placed
|
||||||
|
#
|
||||||
|
# Runner label selects the guest OS automatically:
|
||||||
|
# windows-build -> WinBuild2025 (WinRM/HTTPS transport)
|
||||||
|
# linux-build -> LinuxBuild2404 (SSH transport)
|
||||||
|
#
|
||||||
|
# The composite action (Simone/local-ci-system/.gitea/actions/local-ci-build)
|
||||||
|
# handles the full VM lifecycle: clone template -> start -> build ->
|
||||||
|
# collect artifacts -> upload to Gitea -> destroy VM.
|
||||||
|
# No orchestration logic needed in each repo's workflow.
|
||||||
|
|
||||||
name: Build (.NET / MSBuild)
|
name: Build (Local CI)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -17,67 +26,38 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- develop
|
- develop
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
# Must match the runner label defined in runner/config.yaml
|
# Change to linux-build for Ubuntu 24.04 guest
|
||||||
runs-on: windows-build
|
runs-on: windows-build
|
||||||
|
|
||||||
# Job-level timeout (should be less than the runner's timeout setting)
|
|
||||||
timeout-minutes: 90
|
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:
|
steps:
|
||||||
# Step 1: Check out the repository on the RUNNER HOST
|
# ── Invoke the full VM lifecycle via composite action ───────────────────
|
||||||
# (This gives the runner access to the scripts/ directory)
|
- uses: Simone/local-ci-system/.gitea/actions/local-ci-build@main
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
# --- adapt these two per-repository -----------------------------------
|
||||||
|
build-command: 'python build.py --dist-dir dist' # command run in VM
|
||||||
|
artifact-source: 'dist' # output dir in VM
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
# Step 2: Invoke the orchestrator script
|
# Uncomment to clone repo with submodules inside the VM:
|
||||||
# This script handles the entire VM lifecycle:
|
# submodules: 'true'
|
||||||
# clone → start → wait ready → build → collect artifacts → destroy
|
|
||||||
- name: Build in ephemeral VM
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
|
||||||
$ErrorActionPreference = 'Stop'
|
|
||||||
|
|
||||||
# CI scripts are at a fixed location on the runner host.
|
# Uncomment to clone via SSH alias instead of HTTPS (faster for large repos):
|
||||||
# Do NOT use $env:GITHUB_WORKSPACE — the CI system is in a separate repo.
|
# repo-url: 'ssh://gitea-ci/${{ github.repository }}.git'
|
||||||
$ciScriptsDir = 'N:\Code\Workspace\Local-CI-CD-System\scripts'
|
# use-git-clone: 'true'
|
||||||
|
|
||||||
& "$ciScriptsDir\Invoke-CIJob.ps1" `
|
# Uncomment to inject secrets as env vars in the VM (never logged):
|
||||||
-JobId "${{ github.run_id }}-${{ github.run_attempt }}" `
|
# extra-guest-env-json: >-
|
||||||
-RepoUrl "ssh://gitea-ci/${{ github.repository }}.git" `
|
# {"SIGN_PASS":"${{ secrets.SIGN_PASS }}",
|
||||||
-Branch "${{ github.ref_name }}" `
|
# "GPG_KEY_ID":"${{ secrets.GPG_KEY_ID }}"}
|
||||||
-Commit "${{ github.sha }}" `
|
|
||||||
-Submodules `
|
|
||||||
-BuildCommand 'python build_plugin.py --final --dist-dir dist' `
|
|
||||||
-GuestArtifactSource 'dist' `
|
|
||||||
-GuestCredentialTarget "$env:GUEST_CRED_TARGET"
|
|
||||||
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
# Artifact name defaults to build-{run_id}-{sha}.
|
||||||
exit $LASTEXITCODE
|
# Uncomment to use a custom name (e.g. include ref_name for tag builds):
|
||||||
}
|
# artifact-name: 'myproject-${{ github.ref_name }}'
|
||||||
|
|
||||||
# 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
|
if-no-files-found: error
|
||||||
|
|
||||||
# Step 4: Upload artifacts even on failure (for diagnostics)
|
# Step 4: Upload artifacts even on failure (for diagnostics)
|
||||||
|
|||||||
Reference in New Issue
Block a user