ci: build, test and publish the nine images from main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
9fd801a1f5
commit
af6077eaa4
2 files changed
+78
-1
No files matched your search
@@ -0,0 +1,77 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
# Builds and tests every module, then publishes nine images to gitea.containerverse.dev/solvway/co-lite-<module>,
|
||||||
|
# tagged with the commit SHA and latest (openspec spec release-packaging). Nothing is pushed unless every build,
|
||||||
|
# test and image check passes. Deployment is done outside this workflow.
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
# Two quick pushes to main must not interleave their image pushes or latest tags.
|
||||||
|
concurrency:
|
||||||
|
group: co-lite-main
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
container:
|
||||||
|
image: gitea.containerverse.dev/solvway/maven-custom-21:latest
|
||||||
|
credentials:
|
||||||
|
username: ${{ secrets.PACKAGE_USER }}
|
||||||
|
password: ${{ secrets.PACKAGE_RW_KEY }}
|
||||||
|
volumes:
|
||||||
|
- /cache/m2:/root/.m2
|
||||||
|
env:
|
||||||
|
REGISTRY: gitea.containerverse.dev
|
||||||
|
IMAGE_PREFIX: gitea.containerverse.dev/solvway/co-lite-
|
||||||
|
DOCKER_HOST: tcp://docker:2375
|
||||||
|
DOCKER_TLS_VERIFY: ""
|
||||||
|
# image name : module folder
|
||||||
|
IMAGES: >-
|
||||||
|
api-gateway:solvway-api-gateway
|
||||||
|
mobile-api:solvway-mobile-api
|
||||||
|
service-auth:solvway-services-auth
|
||||||
|
service-system:solvway-services-system
|
||||||
|
service-counter:solvway-services-counter
|
||||||
|
service-member:solvway-services-member
|
||||||
|
service-log:solvway-services-log
|
||||||
|
service-email:solvway-services-email
|
||||||
|
admin-portal:solvway-admin-portal
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build and test the services
|
||||||
|
run: |
|
||||||
|
mvn -T 1C -B -Dmaven.repo.local=/root/.m2/repository-co-lite verify \
|
||||||
|
-pl solvway-api-gateway,solvway-mobile-api,solvway-services-auth,solvway-services-system,solvway-services-counter,solvway-services-member,solvway-services-log,solvway-services-email -am
|
||||||
|
|
||||||
|
- name: Registry login
|
||||||
|
env:
|
||||||
|
REGISTRY_USER: ${{ secrets.PACKAGE_USER }}
|
||||||
|
REGISTRY_KEY: ${{ secrets.PACKAGE_RW_KEY }}
|
||||||
|
run: printf '%s' "$REGISTRY_KEY" | docker login "$REGISTRY" -u "$REGISTRY_USER" --password-stdin
|
||||||
|
|
||||||
|
- name: Build and check every image
|
||||||
|
# The admin portal's Dockerfile runs its own tests and lint; a red suite fails its build.
|
||||||
|
run: |
|
||||||
|
# image-check.sh needs unzip and refuses to run without it.
|
||||||
|
command -v unzip >/dev/null || { apt-get update -qq && apt-get install -y -qq unzip; }
|
||||||
|
for pair in $IMAGES; do
|
||||||
|
name=${pair%%:*}; dir=${pair#*:}
|
||||||
|
docker build -t "$IMAGE_PREFIX$name:$GITHUB_SHA" -t "$IMAGE_PREFIX$name:latest" "$dir"
|
||||||
|
sh local/image-check.sh "$IMAGE_PREFIX$name:$GITHUB_SHA"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Push every image
|
||||||
|
run: |
|
||||||
|
for pair in $IMAGES; do
|
||||||
|
name=${pair%%:*}
|
||||||
|
docker push "$IMAGE_PREFIX$name:$GITHUB_SHA"
|
||||||
|
docker push "$IMAGE_PREFIX$name:latest"
|
||||||
|
done
|
||||||
@@ -26,7 +26,7 @@ Design: `design.md`. All tasks run serially: each touches a build file, CI or SQ
|
|||||||
|
|
||||||
## 2. CI
|
## 2. CI
|
||||||
|
|
||||||
- [ ] 2.1 Add `.gitea/workflows/ci.yml` (design decisions 1 to 3 and 5).
|
- [x] 2.1 Add `.gitea/workflows/ci.yml` (design decisions 1 to 3 and 5).
|
||||||
- The workflow runs on push to `main` only.
|
- The workflow runs on push to `main` only.
|
||||||
- It runs Maven `verify` with `-T 1C`, then builds all nine images, runs `local/image-check.sh` on each, and pushes after every image has built, tagged with the SHA and `latest`.
|
- It runs Maven `verify` with `-T 1C`, then builds all nine images, runs `local/image-check.sh` on each, and pushes after every image has built, tagged with the SHA and `latest`.
|
||||||
- It logs in to the registry with `PACKAGE_USER` and `PACKAGE_RW_KEY`.
|
- It logs in to the registry with `PACKAGE_USER` and `PACKAGE_RW_KEY`.
|
||||||
|
|||||||
Reference in new issue
Block a user