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>
96 lines
2.4 KiB
YAML
96 lines
2.4 KiB
YAML
# 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
|