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 <cursoragent@cursor.com>
This commit is contained in:
parent
b1c1972c6f
commit
2051bfe1e6
2 changed files with 107 additions and 0 deletions
11
.dockerignore
Normal file
11
.dockerignore
Normal file
|
|
@ -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.*
|
||||||
96
.onedev-buildspec.yml
Normal file
96
.onedev-buildspec.yml
Normal file
|
|
@ -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
|
||||||
Loading…
Reference in a new issue