ci: gate development images on checks [CI]

This commit is contained in:
justme committed 2026-10-12 01:47:24 +08:00
1 parent c0d155c608
commit fd01120d3a
6 files changed
+132 -50

No files matched your search

+21 -39
View File
@@ -1,5 +1,10 @@
when:
- event: [push, manual]
- event: pull_request
- event: push
branch: master
- event: push
branch: main
- event: manual
labels:
ci: domain-linux-native
@@ -13,45 +18,22 @@ clone:
from_secret: gitea_clone_webdrop
lfs: false
steps:
prefetch-dependencies:
image: bash
commands:
- mkdir -p "$HOME/.cache/woodpecker/webdrop/npm" "$HOME/.cache/woodpecker/webdrop/nuget"
- cd packages/core
- npm ci --cache "$HOME/.cache/woodpecker/webdrop/npm" --prefer-offline --no-audit
- cd ../../web
- npm ci --cache "$HOME/.cache/woodpecker/webdrop/npm" --prefer-offline --no-audit
- cd ..
- NUGET_PACKAGES="$HOME/.cache/woodpecker/webdrop/nuget" dotnet restore server/WebDrop.slnx
api-contract:
steps:
prefetch-dependencies:
image: bash
commands:
- mkdir -p "$HOME/.cache/woodpecker/webdrop/nuget"
- NUGET_PACKAGES="$HOME/.cache/woodpecker/webdrop/nuget" dotnet restore server/WebDrop.slnx
api-contract:
image: bash
commands:
- node scripts/check-api-contract.mjs
core-and-web:
image: bash
depends_on: [prefetch-dependencies]
commands:
- cd packages/core
- npm run typecheck
- npm test
- npm run vectors:check
- npm run build
web:
image: bash
depends_on: [prefetch-dependencies]
commands:
- cd web
- npm run typecheck
- npm run lint:css
- npm test
- npm run build
server:
image: bash
depends_on: [prefetch-dependencies]
commands:
- NUGET_PACKAGES="$HOME/.cache/woodpecker/webdrop/nuget" dotnet test server/WebDrop.slnx --configuration Release --verbosity minimal --no-restore
server:
image: bash
depends_on: [prefetch-dependencies]
when:
- evaluate: 'not (CI_COMMIT_MESSAGE contains "[SKIP TESTS]")'
commands:
- NUGET_PACKAGES="$HOME/.cache/woodpecker/webdrop/nuget" dotnet test server/WebDrop.slnx --configuration Release --verbosity minimal --no-restore
+50
View File
@@ -0,0 +1,50 @@
when:
- event: push
branch: master
evaluate: 'CI_COMMIT_MESSAGE contains "[CI]"'
- event: push
branch: main
evaluate: 'CI_COMMIT_MESSAGE contains "[CI]"'
labels:
ci: domain-linux-native
platform: linux/amd64
clone:
- name: git
image: woodpeckerci/plugin-git:2.9.3
settings:
remote:
from_secret: gitea_clone_webdrop
lfs: false
depends_on:
- ci
- web-build
concurrency: 1
steps:
publish-dev-image:
image: bash
environment:
ZOT_USERNAME:
from_secret: registry_username
ZOT_PASSWORD:
from_secret: registry_password
ZOT_REGISTRY: 192.168.2.162:5000
commands:
- set -euo pipefail
- ': "${WOODPECKER_BACKEND_LOCAL_TEMP_DIR:=$HOME/woodpecker/work}"'
- buildah_store="$(dirname "$WOODPECKER_BACKEND_LOCAL_TEMP_DIR")/buildah-cache/webdrop"
- mkdir -p "$buildah_store/storage" "$buildah_store/run"
- 'buildah() { command buildah --root "$buildah_store/storage" --runroot "$buildah_store/run" "$@"; }'
- printf '%s' "$ZOT_PASSWORD" | buildah login --tls-verify=false "$ZOT_REGISTRY" --username "$ZOT_USERNAME" --password-stdin
- trap 'buildah logout "$ZOT_REGISTRY" >/dev/null 2>&1 || true' EXIT
- sha="${CI_COMMIT_SHA:0:7}"
- image="$ZOT_REGISTRY/justme/webdrop-api:dev-$sha"
- dev_image="$ZOT_REGISTRY/justme/webdrop-api:dev"
- buildah bud --layers --network host --format docker --platform linux/amd64 --tag "$image" --file server/Dockerfile .
- buildah tag "$image" "$dev_image"
- buildah push --tls-verify=false "$image" "docker://$image"
- buildah push --tls-verify=false "$dev_image" "docker://$dev_image"
+11 -10
View File
@@ -29,12 +29,13 @@ steps:
release-checks:
image: bash
commands:
- release_tag="${CI_COMMIT_TAG:-${RELEASE_TAG:-}}"
- test -n "$release_tag"
- node scripts/check-api-contract.mjs "$release_tag"
- mkdir -p "$HOME/.cache/woodpecker/webdrop/nuget"
- NUGET_PACKAGES="$HOME/.cache/woodpecker/webdrop/nuget" dotnet restore server/WebDrop.slnx
- NUGET_PACKAGES="$HOME/.cache/woodpecker/webdrop/nuget" dotnet test server/WebDrop.slnx --configuration Release --verbosity minimal --no-restore
- release_tag="${CI_COMMIT_TAG:-${RELEASE_TAG:-}}"
- test -n "$release_tag"
- node scripts/check-api-contract.mjs "$release_tag"
- bash scripts/ci-frontend.sh
- mkdir -p "$HOME/.cache/woodpecker/webdrop/nuget"
- NUGET_PACKAGES="$HOME/.cache/woodpecker/webdrop/nuget" dotnet restore server/WebDrop.slnx
- NUGET_PACKAGES="$HOME/.cache/woodpecker/webdrop/nuget" dotnet test server/WebDrop.slnx --configuration Release --verbosity minimal --no-restore
publish-backend:
image: bash
@@ -55,9 +56,9 @@ steps:
- printf '%s' "$ZOT_PASSWORD" | buildah login --tls-verify=false "$ZOT_REGISTRY" --username "$ZOT_USERNAME" --password-stdin
- trap 'buildah logout "$ZOT_REGISTRY" >/dev/null 2>&1 || true' EXIT
- image="$ZOT_REGISTRY/justme/webdrop-api:$release_tag"
- latest_image="$ZOT_REGISTRY/justme/webdrop-api:latest"
- buildah bud --layers --network host --format docker --platform linux/amd64 --tag "$image" --file server/Dockerfile .
- buildah tag "$image" "$latest_image"
- buildah push --tls-verify=false "$image" "docker://$image"
- latest_image="$ZOT_REGISTRY/justme/webdrop-api:latest"
- buildah bud --layers --network host --format docker --platform linux/amd64 --tag "$image" --file server/Dockerfile .
- buildah tag "$image" "$latest_image"
- buildah push --tls-verify=false "$image" "docker://$image"
- buildah push --tls-verify=false "$latest_image" "docker://$latest_image"
+25
View File
@@ -0,0 +1,25 @@
when:
- event: pull_request
- event: push
branch: master
- event: push
branch: main
- event: manual
labels:
ci: domain-linux-native
platform: linux/amd64
clone:
- name: git
image: woodpeckerci/plugin-git:2.9.3
settings:
remote:
from_secret: gitea_clone_webdrop
lfs: false
steps:
web-build:
image: bash
commands:
- bash scripts/ci-frontend.sh