initialising for ci-cd pipeline
CI/CD - ERP Core / scripts (pull_request) Failing after 12m21s
CI/CD - ERP Core / e2e-typecheck (pull_request) Failing after 13m13s
CI/CD - ERP Core / frontend (pull_request) Failing after 14m5s
CI/CD - ERP Core / backend (pull_request) Failing after 14m57s
CI/CD - ERP Core / detect (pull_request) Failing after 13m42s
CI/CD - ERP Core / Build & Deploy (pull_request) Failing after 12m47s
CI/CD - ERP Core / ci-ok (pull_request) Failing after 14m58s
CI/CD - ERP Core / scripts (pull_request) Failing after 12m21s
CI/CD - ERP Core / e2e-typecheck (pull_request) Failing after 13m13s
CI/CD - ERP Core / frontend (pull_request) Failing after 14m5s
CI/CD - ERP Core / backend (pull_request) Failing after 14m57s
CI/CD - ERP Core / detect (pull_request) Failing after 13m42s
CI/CD - ERP Core / Build & Deploy (pull_request) Failing after 12m47s
CI/CD - ERP Core / ci-ok (pull_request) Failing after 14m58s
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# ci-cd.yml › backend — build, unit tests and the "entity changed but no migration" check.
|
||||
# The dotnet work runs inside a capped SDK container. ASPNETCORE_ENVIRONMENT=Development is set
|
||||
# explicitly for the EF step: `dotnet ef` boots Program.cs, and outside Development the startup
|
||||
# config check would (correctly) refuse to run without the deployment secrets CI doesn't have.
|
||||
# shellcheck source=common.sh
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||
|
||||
z="$(selinux_mount_suffix)"
|
||||
with_build_lock
|
||||
|
||||
log "backend checks (capped: 2 CPU / 1500 MB)"
|
||||
# The inner script is single-quoted on purpose: it expands inside the container, not here.
|
||||
# shellcheck disable=SC2016
|
||||
docker run --rm --cpus=2 --cpu-shares=512 --memory=1500m \
|
||||
-e DOTNET_CLI_TELEMETRY_OPTOUT=1 -e DOTNET_NOLOGO=1 -e EF_VERSION="$DOTNET_EF_VERSION" \
|
||||
-e ASPNETCORE_ENVIRONMENT=Development \
|
||||
-v "$PWD/Backend:/src$z" \
|
||||
-v erp-nuget:/root/.nuget/packages \
|
||||
-v erp-dotnet-tools:/root/.dotnet/tools \
|
||||
-w /src "$DOTNET_SDK_IMAGE" bash -ec '
|
||||
dotnet restore ERPCore.sln
|
||||
dotnet build ERPCore.sln -c Release --no-restore
|
||||
dotnet test ERPCore.Tests/ERPCore.Tests.csproj -c Release --no-build
|
||||
|
||||
# Program.cs suppresses PendingModelChangesWarning at runtime, so this is the only guard
|
||||
# against an entity/configuration change merged without its migration. --no-build is safe
|
||||
# here: the assembly was built from this exact source two commands ago.
|
||||
dotnet tool update --global dotnet-ef --version "$EF_VERSION" >/dev/null
|
||||
export PATH="$PATH:/root/.dotnet/tools"
|
||||
dotnet ef migrations has-pending-model-changes \
|
||||
--project ERPCore/ERPCore.csproj --configuration Release --no-build
|
||||
'
|
||||
Reference in New Issue
Block a user