Skip to content

Commit

Permalink
Initialize and update workflow-triggered workflows status along the way
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Feb 28, 2024
1 parent 351caf5 commit 6153cdf
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 13 deletions.
39 changes: 38 additions & 1 deletion .github/workflows/application_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,47 @@ on:
- cron: "38 11 */3 * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.push.head_commit.id }}
cancel-in-progress: true

jobs:
initialize_e2e_tests_job_check:
name: Initialize E2E Tests job checks
runs-on: ubuntu-22.04
steps:
- name: Initialize Cypress E2E Tests job check
id: initialize_cypress_e2e_tests_job_check
uses: LouisBrunner/[email protected]
with:
conclusion: action_required
details_url: "https://github.com/MTES-MCT/monitorfish/actions/runs/${{ github.run_id }}/job/${{ github.job_id }}"
name: "Application E2E Tests (Cypress)"
sha: ${{ github.event.push.head_commit.id }}
status: queued
token: ${{ secrets.GITHUB_TOKEN }}

- name: Initialize Cypress E2E Tests job check
id: initialize_puppeteer_e2e_tests_job_check
uses: LouisBrunner/[email protected]
with:
conclusion: action_required
details_url: "https://github.com/MTES-MCT/monitorfish/actions/runs/${{ github.run_id }}/job/${{ github.job_id }}"
name: Application E2E Tests (Puppeteer)
sha: ${{ github.event.push.head_commit.id }}
status: queued
token: ${{ secrets.GITHUB_TOKEN }}

- name: Save job check IDs
run: |
mkdir -p workflow_share
echo "${{ steps.initialize_cypress_e2e_tests_job_check.outputs.check_id }}" > workflow_share/cypress_job_check_id
echo "${{ steps.initialize_puppeteer_e2e_tests_job_check.outputs.check_id }}" > workflow_share/puppeteer_job_check_id
- uses: actions/upload-artifact@v4
with:
name: workflow_share
path: workflow_share/*

build:
name: Build and package
runs-on: ubuntu-22.04
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/application_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ jobs:
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Initialize job status check
id: initialize_job_status_check
uses: LouisBrunner/[email protected]
with:
details_url: "https://github.com/MTES-MCT/monitorfish/actions/runs/${{ github.run_id }}/job/${{ github.job_id }}"
name: Application Deployment
sha: ${{ github.event.push.head_commit.id }}
status: in_progress
token: ${{ secrets.GITHUB_TOKEN }}

- name: Check Unit Tests status
id: check_unit_tests_status
uses: LASER-Yi/[email protected]
Expand Down Expand Up @@ -50,6 +60,8 @@ jobs:

- name: Push docker image to registry
if: ${{ steps.check_unit_tests_status.outputs.conclusion == 'success' }}
continue-on-error: true
id: push_docker_image
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin
make docker-tag
Expand All @@ -58,9 +70,9 @@ jobs:
- uses: LouisBrunner/[email protected]
if: ${{ always() }}
with:
# check_id: application-deployment-${{ github.event.workflow_run.head_commit.id }}
conclusion: ${{ job.status }}
check_id: ${{ steps.initialize_job_status_check.outputs.check_id }}
conclusion: ${{ steps.push_docker_image.outcome }}
details_url: "https://github.com/MTES-MCT/monitorfish/actions/runs/${{ github.run_id }}/job/${{ github.job_id }}"
name: Application Deployment
sha: ${{ github.event.workflow_run.head_commit.id }}
status: completed
token: ${{ secrets.GITHUB_TOKEN }}
63 changes: 54 additions & 9 deletions .github/workflows/application_e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ jobs:
PUPPETEER_SKIP_DOWNLOAD: "true"
VITE_CYPRESS_PORT: 8880
steps:
- name: "Download 'workflow_share' artifact"
uses: actions/download-artifact@v4
with:
name: workflow_share

- name: Set STATUS_CHECK_ID environment variable
run: |
echo "STATUS_CHECK_ID=$(cat workflow_share/cypress_job_check_id)" >> $GITHUB_ENV
- name: Update job status check
uses: LouisBrunner/[email protected]
if: ${{ always() }}
with:
check_id: ${{ env.STATUS_CHECK_ID }}
details_url: "https://github.com/MTES-MCT/monitorfish/actions/runs/${{ github.run_id }}/job/${{ github.job_id }}"
sha: ${{ github.event.workflow_run.head_commit.id }}
status: in_progress
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -77,7 +96,10 @@ jobs:
firefox -v
which firefox
- uses: cypress-io/github-action@v6
- name: Run Cypress E2E tests
id: run_cypress_e2e_tests
continue-on-error: true
uses: cypress-io/github-action@v6
with:
browser: firefox
config-file: config/cypress.config.ts
Expand All @@ -89,14 +111,15 @@ jobs:
wait-on: "http://localhost:8880"
working-directory: ./frontend

- uses: LouisBrunner/[email protected]
- name: set final job status check
uses: LouisBrunner/[email protected]
if: ${{ always() }}
with:
# check_id: application-e2e-cypress-${{ github.event.workflow_run.head_commit.id }}
conclusion: ${{ job.status }}
check_id: ${{ env.STATUS_CHECK_ID }}
conclusion: ${{ steps.run_cypress_e2e_tests.outcome }}
details_url: "https://github.com/MTES-MCT/monitorfish/actions/runs/${{ github.run_id }}/job/${{ github.job_id }}"
name: Application E2E Tests (Cypress)
sha: ${{ github.event.workflow_run.head_commit.id }}
status: completed
token: ${{ secrets.GITHUB_TOKEN }}

e2e_multi_windows_test:
Expand All @@ -109,6 +132,25 @@ jobs:
PUPPETEER_SKIP_DOWNLOAD: "true"
VITE_CYPRESS_PORT: 8880
steps:
- name: "Download 'workflow_share' artifact"
uses: actions/download-artifact@v4
with:
name: workflow_share

- name: Set STATUS_CHECK_ID environment variable
run: |
echo "STATUS_CHECK_ID=$(cat workflow_share/puppeteer_job_check_id)" >> $GITHUB_ENV
- name: Update job status check
uses: LouisBrunner/[email protected]
if: ${{ always() }}
with:
check_id: ${{ env.STATUS_CHECK_ID }}
details_url: "https://github.com/MTES-MCT/monitorfish/actions/runs/${{ github.run_id }}/job/${{ github.job_id }}"
sha: ${{ github.event.workflow_run.head_commit.id }}
status: in_progress
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -150,15 +192,18 @@ jobs:
run: npx puppeteer browsers install firefox

- name: Run multi-windows tests
id: run_puppeteer_e2e_tests
continue-on-error: true
run: npm run test:multi-windows:run
working-directory: ./frontend

- uses: LouisBrunner/[email protected]
- name: Set final job status check
uses: LouisBrunner/[email protected]
if: ${{ always() }}
with:
# check_id: application-e2e-puppeteer-${{ github.event.workflow_run.head_commit.id }}
conclusion: ${{ job.status }}
check_id: ${{ env.STATUS_CHECK_ID }}
conclusion: ${{ steps.run_puppeteer_e2e_tests.outcome }}
details_url: "https://github.com/MTES-MCT/monitorfish/actions/runs/${{ github.run_id }}/job/${{ github.job_id }}"
name: Application E2E Tests (Puppeteer)
sha: ${{ github.event.workflow_run.head_commit.id }}
status: completed
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 6153cdf

Please sign in to comment.