nightly #194
This file contains hidden or 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
| # This workflow builds and tests nightly on the `develop` branch. Scheduled jobs always run on the default branch, which is `develop` in our case. | |
| name: nightly | |
| on: | |
| schedule: | |
| - cron: "17 2 * * 1-5" | |
| concurrency: | |
| group: nightly | |
| cancel-in-progress: true | |
| env: | |
| PGUSER: postgres | |
| jobs: | |
| build-administration: | |
| uses: ./.github/workflows/build-administration.yaml | |
| with: | |
| special_build_tag: nightly | |
| build-backend: | |
| uses: ./.github/workflows/build-backend.yaml | |
| with: | |
| special_build_tag: nightly | |
| build-compliance: | |
| uses: ./.github/workflows/build-compliance.yaml | |
| with: | |
| special_build_tag: nightly | |
| build-dashboard: | |
| uses: ./.github/workflows/build-dashboard.yaml | |
| with: | |
| special_build_tag: nightly | |
| build-dashboard-e2e: | |
| uses: ./.github/workflows/build-dashboard-e2e.yaml | |
| with: | |
| special_build_tag: nightly | |
| build-registration: | |
| uses: ./.github/workflows/build-registration.yaml | |
| with: | |
| special_build_tag: nightly | |
| build-reporting: | |
| uses: ./.github/workflows/build-reporting.yaml | |
| with: | |
| special_build_tag: nightly | |
| test-code: | |
| uses: ./.github/workflows/test-code.yaml | |
| with: | |
| backend_has_changes: true | |
| frontend_has_changes: true | |
| test-backend: | |
| needs: [build-backend] | |
| uses: ./.github/workflows/test-backend.yaml | |
| with: | |
| backend_has_changes: true | |
| secrets: inherit | |
| test-administration-e2e: | |
| needs: | |
| [ | |
| build-backend, | |
| build-dashboard-e2e, | |
| build-administration, | |
| ] | |
| uses: ./.github/workflows/test-nx-project-e2e.yaml | |
| with: | |
| compose_profiles: "administration" | |
| is_nx_affected: true | |
| nx_project: administration | |
| secrets: inherit | |
| test-registration-e2e: | |
| needs: | |
| [ | |
| build-backend, | |
| build-dashboard-e2e, | |
| build-registration, | |
| ] | |
| uses: ./.github/workflows/test-nx-project-e2e.yaml | |
| with: | |
| compose_profiles: "registration" | |
| is_nx_affected: true | |
| nx_project: registration | |
| secrets: inherit | |
| test-dashboard-e2e: | |
| needs: | |
| [ | |
| build-administration, | |
| build-backend, | |
| build-compliance, | |
| build-dashboard-e2e, | |
| build-registration, | |
| build-reporting, | |
| ] | |
| uses: ./.github/workflows/test-nx-project-e2e.yaml | |
| with: | |
| # dashboard e2e clicks through to every app tile, so every app has to be up | |
| compose_profiles: "administration,compliance,registration,reporting" | |
| is_nx_affected: true | |
| nx_project: dashboard | |
| secrets: inherit | |
| test-compliance-e2e: | |
| needs: | |
| [ | |
| build-backend, | |
| build-compliance, | |
| build-dashboard-e2e, | |
| build-reporting, | |
| ] | |
| uses: ./.github/workflows/test-nx-project-e2e.yaml | |
| with: | |
| # compliance e2e drives the reporting UI directly to seed its data | |
| # (its specs import @/reporting-e2e POMs), so reporting has to be up too | |
| compose_profiles: "compliance,reporting" | |
| is_nx_affected: true | |
| nx_project: compliance | |
| secrets: inherit | |
| test-reporting-e2e: | |
| needs: | |
| [build-backend, build-dashboard-e2e, build-reporting] | |
| uses: ./.github/workflows/test-nx-project-e2e.yaml | |
| with: | |
| compose_profiles: "reporting" | |
| is_nx_affected: true | |
| nx_project: reporting | |
| secrets: inherit | |
| zap-owasp: | |
| needs: | |
| [ | |
| build-administration, | |
| build-backend, | |
| build-compliance, | |
| build-dashboard-e2e, | |
| build-registration, | |
| build-reporting, | |
| ] | |
| uses: ./.github/workflows/zap-owasp.yaml | |
| with: | |
| zap_fail_on_risk_level: 3 | |
| secrets: inherit | |
| schemaspy: | |
| uses: ./.github/workflows/schemaspy.yaml | |
| secrets: inherit | |
| trivy: | |
| uses: ./.github/workflows/trivy.yaml | |
| trivy-containers: | |
| needs: | |
| [ | |
| build-backend, | |
| build-administration, | |
| build-compliance, | |
| build-dashboard, | |
| build-registration, | |
| build-reporting, | |
| ] | |
| uses: ./.github/workflows/trivy-containers.yaml | |
| codeql: | |
| uses: ./.github/workflows/codeql.yaml | |
| notify: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| if: ${{ always() }} | |
| needs: | |
| [ | |
| test-code, | |
| test-backend, | |
| test-administration-e2e, | |
| test-registration-e2e, | |
| test-dashboard-e2e, | |
| test-compliance-e2e, | |
| test-reporting-e2e, | |
| build-dashboard, | |
| zap-owasp, | |
| schemaspy, | |
| trivy, | |
| trivy-containers, | |
| codeql, | |
| ] | |
| env: | |
| status: |- | |
| ${{ | |
| needs.test-code.result == 'success' | |
| && needs.test-backend.result == 'success' | |
| && needs.test-administration-e2e.result == 'success' | |
| && needs.test-registration-e2e.result == 'success' | |
| && needs.test-dashboard-e2e.result == 'success' | |
| && needs.test-compliance-e2e.result == 'success' | |
| && needs.test-reporting-e2e.result == 'success' | |
| && needs.build-dashboard.result == 'success' | |
| && needs.zap-owasp.result == 'success' | |
| && needs.schemaspy.result == 'success' | |
| && needs.trivy.result == 'success' | |
| && needs.trivy-containers.result == 'success' | |
| && needs.codeql.result == 'success' | |
| && 'success' | |
| || 'failure' | |
| }} | |
| dag_id: cas_bciers_nightly_build_report | |
| airflow_username: ${{ secrets.AIRFLOW_USERNAME }} | |
| airflow_password: ${{ secrets.AIRFLOW_PASSWORD }} | |
| airflow_endpoint: ${{ secrets.AIRFLOW_ENDPOINT }} | |
| steps: | |
| - name: Report status to Airflow | |
| run: | | |
| echo "Reporting status to Airflow" | |
| echo "STATUS=${{ env.status }}" | |
| jwt_token=$(curl -X POST ${{ env.airflow_endpoint }}/auth/token \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"username\": \"${{ env.airflow_username }}\", \"password\": \"${{ env.airflow_password }}\"}" \ | |
| | jq -r .access_token) | |
| auth_params=(-H "Authorization: Bearer $jwt_token") | |
| is_paused=$(curl "${auth_params[@]}" --url ${{ env.airflow_endpoint }}/api/v2/dags/${{ env.dag_id }} | jq -r .dag.is_paused) | |
| if [ "$is_paused" == "true" ]; then | |
| echo "DAG is paused, skipping trigger" | |
| exit 0 | |
| fi | |
| dag_config="{\"status\": \"${{ env.status }}\", \"run_id\": \"${{ github.run_id }}\"}" | |
| dag_run_url="${{ env.airflow_endpoint }}/api/v2/dags/${{ env.dag_id }}/dagRuns" | |
| run_json=$(curl -sSf "${auth_params[@]}" \ | |
| -X POST --url $dag_run_url \ | |
| -H 'Cache-Control: no-cache' \ | |
| -H 'Content-Type: application/json' \ | |
| -d "{\"logical_date\": null,\"conf\": $dag_config, \"note\": \"GitHub Workflow at https://github.com/bcgov/cas-registration/actions/runs/${{ github.run_id }}\"}") | |
| dag_run_id=$(echo "$run_json" | jq -r .dag_run_id) | |
| echo "Reported status for ${{ github.run_id }} to Airflow $dag_run_id with status ${{env.status}}" | |
| - name: Create failed build issue | |
| uses: jayqi/failed-build-issue-action@1a893bbf43ef1c2a8705e2b115cd4f0fe3c5649b # v1.2.0 | |
| if: failure() | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| label-name: "nightly failed" | |
| title-template: "Failed nightly build and test: {{workflow}}" |