From 2051bfe1e69129bdff4436947e2e0cee36ab47f0 Mon Sep 17 00:00:00 2001 From: Camille Date: Sat, 30 May 2026 00:00:59 +0200 Subject: [PATCH] ci: add OneDev pipeline for build, test, and Docker images Configure Build and Test and Docker Build jobs with branch and PR triggers, plus a root .dockerignore to keep Docker contexts lean. Co-authored-by: Cursor --- .dockerignore | 11 +++++ .onedev-buildspec.yml | 96 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 .dockerignore create mode 100644 .onedev-buildspec.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..394e79e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +# Docker build context (workspace root) — keep images small and fast +.git +.nx +node_modules +.pnpm-store +dist +coverage +apps/backend/target +**/*.md +.env +.env.* diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml new file mode 100644 index 0000000..320c5a1 --- /dev/null +++ b/.onedev-buildspec.yml @@ -0,0 +1,96 @@ +# OneDev CI/CD — CityGame monorepo +# Docs: https://docs.onedev.io/category/cicd +version: 47 +jobs: +- name: Build and Test + steps: + - type: CheckoutStep + name: checkout + cloneCredential: + type: DefaultCredential + withLfs: false + withSubmodules: false + cloneDepth: 1 + condition: SUCCESSFUL + optional: false + - type: CommandStep + name: build and test + runInContainer: true + image: node:20-bookworm + interpreter: + type: DefaultInterpreter + commands: | + set -e + set -o pipefail + + apt-get update -qq + DEBIAN_FRONTEND=noninteractive apt-get install -y -qq openjdk-21-jdk-headless + + corepack enable + corepack prepare pnpm@10.33.2 --activate + + export CI=true + export NX_NO_CLOUD=true + + pnpm install --frozen-lockfile + + pnpm exec nx run-many -t build --parallel=2 --skip-nx-cache + pnpm exec nx run-many -t test --parallel=2 --skip-nx-cache + condition: SUCCESSFUL + optional: false + triggers: + - type: BranchUpdateTrigger + branches: main master develop feature/* release/* ci/* + userMatch: anyone + - type: PullRequestUpdateTrigger + branches: main master develop + userMatch: anyone + retryCondition: never + maxRetries: 2 + retryDelay: 30 + 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 + userMatch: anyone + retryCondition: never + maxRetries: 2 + retryDelay: 30 + timeout: 7200