feat(cicd): Add UT to PR's via SonarCloud #129
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR | |
on: | |
pull_request: | |
branches: | |
- dev # this is the default branch and not main | |
concurrency: | |
# Cancel in progress for PR open and close | |
group: ${{ github.event.number }} | |
cancel-in-progress: true | |
jobs: | |
# https://github.com/bcgov-nr/action-builder-ghcr | |
builds: | |
name: Builds | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
package: [backend/sites, frontend/site-registry, backend/sites-migration] | |
include: | |
- package: backend/sites | |
build_file: ./backend/sites/Dockerfile | |
build_context: backend/sites | |
- package: backend/sites-migration | |
build_file: ./backend/sites/Dockerfile.migrations | |
build_context: backend/sites | |
- package: frontend/site-registry | |
build_file: ./frontend/site-registry/Dockerfile | |
build_context: frontend/site-registry | |
timeout-minutes: 10 | |
steps: | |
- uses: bcgov-nr/action-builder-ghcr@v2.2.0 | |
with: | |
package: ${{ matrix.package }} | |
tag: ${{ github.event.number }} | |
tag_fallback: latest | |
triggers: ('${{ matrix.package }}/') | |
build_file: ${{ matrix.build_file }} | |
build_context: ${{ matrix.build_context }} | |
# https://github.com/bcgov/quickstart-openshift-helpers | |
deploys: | |
name: Deploys | |
if: ${{ ! github.event.pull_request.draft }} | |
needs: [builds] | |
uses: ./.github/workflows/.deployer.yml | |
secrets: inherit | |
with: | |
triggers: ('backend/' 'frontend/') | |
results: | |
name: PR Results | |
needs: [builds, deploys] | |
if: always() | |
runs-on: ubuntu-24.04 | |
steps: | |
- if: contains(needs.*.result, 'failure') | |
run: echo "At least one job has failed." && exit 1 | |
- run: echo "Success!" |