This document provides an improved iteration of the CI/CD optimization strategy, focusing on specific technical fixes identified during the analysis of the current ci.yaml files in bnc-cpt-api and bnc-cpt-wui.
| Bottleneck | API Workflow | WUI Workflow |
|---|---|---|
| Redundant Cloning | Deploy job re-clones all repos. | Deploy job re-clones all repos. |
| Redundant Building | N/A (Builds once in monolithic job) | Deploy job runs make do-setup-wui-no-cache. |
| Docker I/O | N/A | Uses docker save/load (very slow artifact transfer). |
| Package Management | poetry install happens inside container. |
npm install runs in every test job. |
| Caching | No Docker layer caching; uses -no-cache. |
No Docker layer caching; uses -no-cache. |
| Path Filtering | None. Runs on every push. | None. Runs on every push. |
Instead of docker save/load or re-building in deploy:
1. Job: build: Build the Docker image once using docker/build-push-action with cache-from: type=gha and cache-to: type=gha.
2. Push: Push to GCP Artifact Registry with two tags: sha-${{ github.sha }} and latest-branch-${{ github.ref_name }}.
3. Pull: All subsequent jobs (test-unit, test-ui, deploy) pull this specific SHA tag. This guarantees that exactly what was tested is what is deployed, without the overhead of artifact zipping/unzipping.
Instead of actions/upload-artifact for the entire 500MB+ workspace:
1. Job: setup: Clone once.
2. Path Filtering: Determine which sub-projects changed.
3. Sparse Artifacts: Only upload the specific project directory needed (e.g., bnc-cpt-api/ for API tests).
job: test-unit: Run pytest tests/unit.job: test-integration: Run pytest tests/integration (starts Redis/Tesla Mock).build job completes.job: test-unit: Vitest.job: lint-typecheck: ESlint + vue-tsc.job: test-ui-matrix: Parallel Puppeteer workers by language.Stop running npm install and poetry install in test jobs.
1. The build job must ensure node_modules and .venv are fully populated inside the Docker image.
2. The Dockerfile should be optimized with multi-stage builds to keep the final test/deploy image lean but complete.
Create a suite of CI helper functions in the utl project:
* do_ci_get_image_tag: Generates the unique SHA-based tag.
* do_ci_wait_for_registry: Ensures the image is available before pulling.
--no-cache from make targets in CI.docker/login-action for GCP Artifact Registry.build-and-test into build -> test (parallel).docker save/load with docker pull from Artifact Registry.npm install from test-support and test-unit jobs; rely on the image.deploy job to use the pre-built image for the build step.Implement dorny/paths-filter in a pre-flight job:
filters:
api:
- 'bnc-cpt-api/**'
- 'bnc-cpt-utl/**'
- 'bnc-cpt-cnf/**'
wui:
- 'bnc-cpt-wui/**'
- 'bnc-cpt-utl/**'
- 'bnc-cpt-cnf/**'
bnc-cpt-utl with CI helper scripts.bnc-cpt-api ci.yaml to use the Registry.bnc-cpt-wui ci.yaml to remove docker save/load.