Skip to content

Merge feature/ci-cd-optimization improvements#4846

Merged
arkid15r merged 24 commits into
mainfrom
feature/ci-cd-optimization-merge
Jun 6, 2026
Merged

Merge feature/ci-cd-optimization improvements#4846
arkid15r merged 24 commits into
mainfrom
feature/ci-cd-optimization-merge

Conversation

@arkid15r

@arkid15r arkid15r commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

Checklist

  • Required: I followed the contributing workflow
  • Required: I verified that my code works as intended and resolves the issue as described
  • Required: I ran make check-test locally: all warnings addressed, tests passed
  • I used AI for code, documentation, tests, or communication related to this PR

ahmedxgouda and others added 24 commits May 9, 2026 21:11
* Extract checks

* Remove docker layer from cspell

* Give read permission to the checks

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
* Extract backend tests workflow and remove docker layer

* Add permissions

* Add FORCE_COLOR env

* Fix ordering

* Optimize dependecies installation

* Update cache path and comments identation

* Remove dead code

* Update code

* Update permissions

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
* Extract codecov upload to a separate workflow

* Add permissions

* Add checkout

* Update code

* Add back the checkout step

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
* Remove docker layer from fuzz tests and setup-backend-environment workflow

* Update code

* Update code

* Add poetry run in entrypoint.fuzz.sh

* Update code

* Update code

* Refactor

* Update code

* Apply rabbit's suggestions

* Remove redundant BACKEND_PORT from migartion step

* Update caching

* Disable collecting coverage for fuzz tests

* Reorder steps in setup-backend-environment action

* Apply suggestions

* Remove code-quality-checks dependency temporarily

* Update code

* Update code

* Add run-code-quality-checks dependency

* Update code

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
* Extract infrastructure tests

* Remove the code-quality-checks dependency temporarily

* Apply rabbit suggestions and fix terraform error

* Add caching

* Reorder

* Update path

* Add code-quality-checks as dependency

* Update code

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
* Extract tests and remove docker layer

* Update code

* Update code

* Update permissions

* Remove code-quality-checks dependency temporarily

* Update permissions

* Update code

* Add caching

* Add run-code-quality-checks dependency

* Update code

* Reorder

* Update code

* Update code

* Update code

* Update code

* Update caching

* Update caching

* Refactor

* Add checkout

* Update setup-frontend-environment action description

* Update code

* Remove redundant manual caching step

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
* Extract e2e tests into a separate workflow

* Remove docker layer from frontend

* Use custom action

* Update code

* Add next.js caching

* Remove docker layer from e2e tests

* Update code

* Add e2e dependencies installation step

* Add playwright installation and caching

* Update code

* Update code

* Update envs

* Update code

* Update playwright config and add upload artifact step

* Pin service container images by digest

* Update e2e tests name

* Apply rabbit suggestions

* Fix syntax

* Update code

* Add playwright apt caching

* Try playwright container

* Fix pipx

* Drop set up Python cache

* Bump playwright version

* Update code

* Update install poetry action

* Update code

* Update code

* Update browsers

* Update code

* Revert some changes

* Clean up some steps

* Try chromium only

* Update code

* Add logs

* Update smoke test

* Update code

* Update code

* Clean up code

* Bump workers count

* Revert workers number change

* Rebalance CPUs

* More CPUs to playwright

* Update code

* Update code

* Update code

* Remove apt caching

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
* Extract set-release-version

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
* Extract build-images

* Update build-production-images

* Update code

* Remove unused docker hub

* Update code

* Update code

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
* Extract run-lighthouse-ci into a separate reusable workflow

* Update .github/workflows/run-lighthouse-ci.yaml

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Extract run-zap-baseline-scan into a reusable workflow

* Update code
* Extract bootstrap-infrastructure

* Update CI/CD

* Update CI/CD

* Add terraform caching

* Refactor terraform bootstraping

* Update code

* Update code

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
* Extract scan-images

* Update scan-production-images

* Update code

* Update Trivy caching

* Apply cubic suggestion

* Update code

* Update code

* Refactor trivy

* Update code

* Update code

* Update code

* Update code

* Update code

* Update code

* Update code

* Update code

* Revert "Upload SBOM action creation"

This reverts commit 51132e4.

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
* Extract deploy-nest into a separate reusable workflow

* Update code

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
* Extract production jobs into a separate workflow

* Reorder

Update pnpm
* Generalize production and staging workflows

* Reorder

* Extract checks and tests into a reusable workflow and update run-ci-cd

* Update run-fuzz-tests.yaml

* Update code

* Update code

* Update naming

* Update code

* Update code

* Update e2e/playwright.config.ts

* Update code

* Update code

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
@arkid15r arkid15r marked this pull request as ready for review June 6, 2026 21:05
@github-actions github-actions Bot added docs Improvements or additions to documentation backend frontend labels Jun 6, 2026
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

Summary by CodeRabbit

  • New Features

    • Added staging and production CI/CD pipelines for automated deployments
    • Added Mobile Chrome device testing to end-to-end tests
    • Introduced build cache optimization for Docker images
  • Bug Fixes

    • Fixed environment detection in frontend configuration
    • Standardized navigation timeouts in end-to-end tests
  • Chores

    • Modularized GitHub Actions workflows for improved maintainability
    • Enhanced infrastructure-as-code organization with dedicated cache modules
    • Updated custom spell-check dictionary

Walkthrough

This PR refactors the monolithic GitHub Actions CI/CD pipeline into a scalable, reusable workflow architecture by converting run-ci-cd.yaml into a callable orchestrator, creating delegated workflows for testing and deployment, introducing composite actions for dependency management and infrastructure, and updating infrastructure as code with a new Terraform ECR cache module. Additionally, E2E tests are modernized with custom Playwright device helpers and timeout cleanup.

Changes

CI/CD Workflow Refactoring & Infrastructure Modernization

Layer / File(s) Summary
CI/CD Reusable Orchestrator & Event-Triggered Entry Points
.github/workflows/run-ci-cd.yaml, .github/workflows/ci.yaml, .github/workflows/ci-cd-staging.yaml, .github/workflows/ci-cd-production.yaml
The monolithic run-ci-cd.yaml is converted from event-triggered to a workflow_call reusable interface exposing inputs/secrets for configuration-driven execution. Three event-triggered workflows (CI for PR/merge/push, staging for schedule/dispatch, production for releases) invoke the orchestrator with environment-specific settings, enabling a single orchestrator to serve multiple deployment scenarios.
Test & Quality Assurance Workflows
.github/workflows/run-code-checks.yaml, .github/workflows/run-code-tests.yaml, .github/workflows/run-backend-tests.yaml, .github/workflows/run-frontend-tests.yaml, .github/workflows/run-fuzz-tests.yaml, .github/workflows/run-infrastructure-tests.yaml
New reusable workflows abstract CI quality and test execution: dependency audit, frontend linting, pre-commit checks, security scanning (Semgrep/Trivy), and spelling checks run in run-code-checks; backend unit tests, frontend a11y/unit tests, end-to-end Playwright tests, fuzz tests, and infrastructure tests run via delegated workflows called from the orchestrator, each handling its own setup/caching/artifact upload.
Composite Actions for Dependencies & Infrastructure
.github/actions/install-poetry/action.yaml, .github/actions/install-backend-dependencies/action.yaml, .github/actions/install-frontend-dependencies/action.yaml, .github/actions/apply-infrastructure-changes/action.yaml, .github/actions/setup-backend-environment/action.yaml, .github/actions/run-trivy-scan/action.yaml
Reusable composite actions encapsulate dependency installation (Poetry with pip cache, backend/frontend with lock-file caching), Terraform execution (plugin cache, init/validate/plan/apply with summary output), Trivy scanning with cache, and backend test environment setup (S3 dump fetch, Postgres readiness, Django migrations, gunicorn startup, health polling).
Image Build, Scan & Deployment Workflows
.github/workflows/run-release-version-resolution.yaml, .github/workflows/run-image-build.yaml, .github/workflows/run-image-scan.yaml, .github/workflows/run-infrastructure-bootstrap.yaml, .github/workflows/run-deploy.yaml, .github/workflows/run-lighthouse-ci.yaml, .github/workflows/run-zap-baseline-scan.yaml, .github/workflows/run-coverage-upload.yaml
Release version resolution, Docker multi-stage build with caching and OWASP UID/GID args, Trivy image scanning and SBOM generation, infrastructure bootstrap with Terraform remote state setup, ECS deployment with migrate/index-data tasks and service stability verification, and post-deploy Lighthouse CI/ZAP baseline scans form the delivery pipeline. Coverage upload to Codecov bridges test and build execution.
Terraform ECR Cache Module & Live Configuration
infrastructure/modules/ecr-cache/main.tf, infrastructure/modules/ecr-cache/variables.tf, infrastructure/modules/ecr-cache/outputs.tf, infrastructure/modules/ecr-cache/tests/ecr-cache.tftest.hcl, infrastructure/modules/ecr-cache/README.md, infrastructure/modules/ecr-cache/.terraform.lock.hcl, infrastructure/live/main.tf, infrastructure/live/README.md, .trivyignore.yaml
New Terraform module provisions AWS ECR repositories for build cache with lifecycle policies retaining only the last 3 images. Backend and frontend cache instances are instantiated in the live environment with shared tags. Module includes documentation, test assertions, lockfile, and Trivy misconfiguration ignores for ECR-specific rules.
E2E Test Modernization & Application Configuration
e2e/helpers/devices.ts, e2e/playwright.config.ts, e2e/pages/*.spec.ts, e2e/components/*.spec.ts, frontend/next.config.ts, .github/workflows/code-ql.yaml, .github/workflows/dependency-review.yaml, backend/entrypoint.fuzz.sh, cspell/custom-dict.txt, README.md
Playwright configuration adds a custom iphone13Chromium device helper, swapping iPhone Safari for Chrome mobile emulation. Explicit 25-second navigation timeouts are removed from 15+ E2E page tests, relying on Playwright defaults instead. Next.js config conditionally enables source maps only for staging/production and async rewrites with trailing slashes for E2E backend routing. CodeQL/dependency-review workflows are updated with concurrency/permissions; fuzz entry point path quoting improved; cspell dictionary updated; README badges updated; PR labeler points to new config path.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • OWASP/Nest#4807: Lighthouse CI workflow extraction and integration overlaps with main PR's new run-lighthouse-ci.yaml and wiring into orchestrator.
  • OWASP/Nest#4679: Infrastructure testing refactor shares the same run-infrastructure-tests.yaml extraction into reusable workflow.
  • OWASP/Nest#4818: New deploy workflow refactor uses the same .github/actions/apply-infrastructure-changes composite action for Terraform apply.

Suggested labels

ci, infrastructure, backend, frontend, docs

Suggested reviewers

  • kasya
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Merge feature/ci-cd-optimization improvements' accurately describes the main change: merging CI/CD optimization improvements into the codebase through a large refactoring of GitHub Actions workflows.
Description check ✅ Passed The description, while minimal, is directly related to the changeset by confirming the contributor followed the contributing workflow, verified code functionality, and ran required tests with passing results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/ci-cd-optimization-merge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

sonarqubecloud Bot commented Jun 6, 2026

Copy link
Copy Markdown

@arkid15r arkid15r merged commit 015f834 into main Jun 6, 2026
113 of 116 checks passed
@arkid15r arkid15r deleted the feature/ci-cd-optimization-merge branch June 6, 2026 21:12
@coderabbitai coderabbitai Bot mentioned this pull request Jun 14, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend ci docs Improvements or additions to documentation frontend infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants