Fase B3: CI bouwt en test alleen het master-CMS (SlpModularCms.Ci.slnf), publish alleen bij deploy, compile-sites (niet verplicht), rooktests na test-deploys
- backend-build/-test op SlpModularCms.Ci.slnf (Api + Core + modules + alle testprojecten; zonder Api.SlpSoftware/AndreaSlopFotografie/Slave). - publish-sls-test niet meer op pull_request. Vereiste checks master: backend-test + frontend-test (publish-check vervalt). - compile-sites: dotnet build van de drie site-projecten, niet verplicht. - scripts/smoke-site.sh + jobs smoke-sls-test/smoke-asf-test na deploy-*-test (modulelijst per site, noindex, robots, beschermde routes). - docs/deploy-en-testomgevingen.md bijgewerkt. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -134,6 +134,7 @@ jobs:
|
||||
- 'src/**'
|
||||
- 'tests/**'
|
||||
- '*.sln'
|
||||
- '*.slnf'
|
||||
- '**/*.csproj'
|
||||
frontend:
|
||||
- *workflow
|
||||
@@ -149,8 +150,32 @@ jobs:
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
# The CI builds and tests the master CMS only (SlpModularCms.Api with every module, Core and all test
|
||||
# projects), listed in SlpModularCms.Ci.slnf. The site projects (Api.SlpSoftware, Api.AndreaSlopFotografie,
|
||||
# Api.Slave) are thin compositions: they are compiled by compile-sites below and built/published only when a
|
||||
# deploy needs them. Their behaviour is covered by the tests on the master host (see SiteContractTests).
|
||||
- name: Restore and build (Release)
|
||||
run: dotnet build SlpModularCms.sln -c Release
|
||||
run: dotnet build SlpModularCms.Ci.slnf -c Release
|
||||
|
||||
# --- Not required: the thin site projects still compile ---
|
||||
# Compile only (no tests, a few seconds): catches a broken reference or a renamed type in a site project on the
|
||||
# pull request instead of at deploy time. Deliberately not a required check; the smoke tests after the test
|
||||
# deploys catch composition errors that compile fine.
|
||||
compile-sites:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.backend == 'true'
|
||||
runs-on: linux
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
- name: Compile the site projects (Release)
|
||||
run: |
|
||||
for project in SlpSoftware AndreaSlopFotografie Slave; do
|
||||
echo "== SlpModularCms.Api.$project"
|
||||
dotnet build "src/SlpModularCms.Api.$project/SlpModularCms.Api.$project.csproj" -c Release
|
||||
done
|
||||
|
||||
# --- Gate 2: backend tests ---
|
||||
backend-test:
|
||||
@@ -199,7 +224,7 @@ jobs:
|
||||
sleep 2
|
||||
done
|
||||
export ConnectionStrings__DefaultConnection="Server=$HOST;Port=3308;Database=SlpModularCms;Uid=root;Pwd=ci_test_password"
|
||||
dotnet test SlpModularCms.sln -c Release
|
||||
dotnet test SlpModularCms.Ci.slnf -c Release
|
||||
|
||||
# --- Gate 3: vulnerability scan ---
|
||||
# `dotnet list package --vulnerable` always exits 0, even when it reports vulnerabilities, so the
|
||||
@@ -364,9 +389,9 @@ jobs:
|
||||
# gate's outcome is checked explicitly via needs.<job>.result instead: a skipped gate is fine,
|
||||
# but a gate that actually ran and failed or was cancelled still blocks the publish. The
|
||||
# changes.outputs check makes sure there's something to publish at all: a run that touched
|
||||
# neither backend nor frontend has nothing new to deploy. The final line skips this build on a
|
||||
# manual workflow_dispatch run that didn't check deploy_sls_test — building and uploading a test
|
||||
# artifact nobody is going to deploy is wasted work; push/PR runs are unaffected.
|
||||
# neither backend nor frontend has nothing new to deploy. The last two lines build this site only when a
|
||||
# deploy will use it: never on a pull_request (the pull request builds and tests the master CMS only) and, on a
|
||||
# manual workflow_dispatch run, only when deploy_sls_test is checked.
|
||||
if: |
|
||||
always() &&
|
||||
needs.changes.result == 'success' &&
|
||||
@@ -377,6 +402,7 @@ jobs:
|
||||
needs.frontend-test.result != 'failure' && needs.frontend-test.result != 'cancelled' &&
|
||||
needs.frontend-lint.result != 'failure' && needs.frontend-lint.result != 'cancelled' &&
|
||||
(needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true') &&
|
||||
github.event_name != 'pull_request' &&
|
||||
(github.event_name != 'workflow_dispatch' || github.event.inputs.deploy_sls_test == 'true')
|
||||
runs-on: linux
|
||||
steps:
|
||||
@@ -654,3 +680,28 @@ jobs:
|
||||
service_name: ${{ vars.SERVICE_NAME_ASF_TEST }}
|
||||
health_check_url: ${{ vars.HEALTH_CHECK_URL_ASF_TEST }}
|
||||
run_db_backup: false
|
||||
|
||||
# --- Smoke tests of the deployed compositions (anonymous requests, see scripts/smoke-site.sh) ---
|
||||
# The CI tests the master CMS; this is the check that the composition of each site that was just deployed to test
|
||||
# is the intended one (modules, website mode, noindex, protected admin routes). A failing smoke test fails the run.
|
||||
smoke-sls-test:
|
||||
needs: [deploy-sls-test]
|
||||
if: always() && needs.deploy-sls-test.result == 'success'
|
||||
runs-on: linux
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Smoke test SLS test
|
||||
env:
|
||||
HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_TEST }}
|
||||
run: bash scripts/smoke-site.sh "$HEALTH_URL" sls-test
|
||||
|
||||
smoke-asf-test:
|
||||
needs: [deploy-asf-test]
|
||||
if: always() && needs.deploy-asf-test.result == 'success'
|
||||
runs-on: linux
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Smoke test ASF test
|
||||
env:
|
||||
HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_ASF_TEST }}
|
||||
run: bash scripts/smoke-site.sh "$HEALTH_URL" asf-test
|
||||
|
||||
Reference in New Issue
Block a user