# OneDev CI/CD — CityGame monorepo # Docs: https://docs.onedev.io/category/cicd # # Image CI recommandée (propriété ciBuildImage) : # docker build -f ci/Dockerfile -t /citygame-ci:latest . # docker push /citygame-ci:latest # Puis Admin → Job Properties → ciBuildImage = /citygame-ci:latest # # Publication Docker (job Docker Publish) : configurer la connexion registry # sur l'exécuteur Docker OneDev (voir tutorial Build/Publish Docker Image). version: 47 properties: - name: ciBuildImage value: maven:3.9-eclipse-temurin-21 # Remplacer par votre image ci/Dockerfile publiée, ex. registry.example.com/citygame-ci:latest jobs: - name: Build and Test steps: - type: CheckoutStep name: checkout cloneCredential: type: DefaultCredential withLfs: false withSubmodules: false cloneDepth: 1 condition: SUCCESSFUL optional: false - type: SetupCacheStep name: set up dependency caches key: citygame-deps checksumFiles: pnpm-lock.yaml apps/backend/pom.xml paths: - node_modules - .pnpm-store - .nx/cache - .m2 uploadStrategy: UPLOAD_IF_NOT_EXACT_MATCH condition: SUCCESSFUL optional: false - type: CommandStep name: build and test runInContainer: true image: '@property:ciBuildImage@' interpreter: type: DefaultInterpreter commands: | set -e set -o pipefail bash ci/setup-toolchain.sh corepack enable corepack prepare pnpm@10.33.2 --activate export CI=true export HOME="$(pwd)" mkdir -p .m2 reports/apps/frontend pnpm install --frozen-lockfile pnpm exec nx run-many -t build --parallel=2 pnpm exec nx run-many -t test --parallel=2 condition: SUCCESSFUL optional: false - type: PublishJUnitReportStep name: publish test reports reportName: Test Results filePatterns: apps/backend/target/surefire-reports/**/*.xml reports/apps/frontend/**/*.xml condition: ALWAYS optional: false triggers: - type: BranchUpdateTrigger branches: main master develop feature/* release/* ci/* userMatch: anyone - type: PullRequestUpdateTrigger branches: main master develop retryCondition: never timeout: 3600 - name: Docker Build steps: - type: CheckoutStep name: checkout cloneCredential: type: DefaultCredential withLfs: false withSubmodules: false cloneDepth: 1 condition: SUCCESSFUL optional: false - type: BuildImageStep name: build frontend image buildPath: . dockerfile: apps/frontend/Dockerfile output: type: DockerLoadOutput imageName: citygame-frontend:ci platforms: linux/amd64 condition: SUCCESSFUL optional: false - type: BuildImageStep name: build backend image buildPath: . dockerfile: apps/backend/Dockerfile output: type: DockerLoadOutput imageName: citygame-backend:ci platforms: linux/amd64 condition: SUCCESSFUL optional: false jobDependencies: - jobName: Build and Test requireSuccessful: true triggers: - type: BranchUpdateTrigger branches: main master develop feature/* release/* ci/* userMatch: anyone - type: PullRequestUpdateTrigger branches: main master develop retryCondition: never timeout: 7200 - name: Docker Publish steps: - type: CheckoutStep name: checkout cloneCredential: type: DefaultCredential withLfs: false withSubmodules: false cloneDepth: 1 condition: SUCCESSFUL optional: false - type: BuildImageStep name: publish frontend image buildPath: . dockerfile: apps/frontend/Dockerfile output: type: RegistryOutput tags: citygame-frontend:latest citygame-frontend:@build_version@ platforms: linux/amd64 condition: SUCCESSFUL optional: false - type: BuildImageStep name: publish backend image buildPath: . dockerfile: apps/backend/Dockerfile output: type: RegistryOutput tags: citygame-backend:latest citygame-backend:@build_version@ platforms: linux/amd64 condition: SUCCESSFUL optional: false jobDependencies: - jobName: Docker Build requireSuccessful: true triggers: - type: BranchUpdateTrigger branches: main master userMatch: anyone retryCondition: never timeout: 7200