CI: Improve Pages job
Code coverage and RTLMeter complete (concluding 'skipped') on branch pushes where they do no work, and each completion fires the Pages workflow_run trigger. Rebuilding and redeploying master's pages for these no-op events is wasteful. Gate the build job so a workflow_run whose upstream conclusion is 'skipped' does nothing; deploy and notify need build, so they cascade-skip. Route such no-op runs to their own throwaway concurrency group. In the shared 'pages' group they would, as the newest queued run, cancel a pending real run and then deploy nothing (concurrency keeps only the in-progress and newest pending run). Real runs keep sharing 'pages' and serialize as before. Add retry to deploy step to reduce flakyness due to the Pages back end. Fix trigger on workflow file changes.
This commit is contained in:
parent
cbd78e689c
commit
c7c778f109
|
|
@ -7,7 +7,7 @@ name: Pages
|
|||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
paths: ["ci/**", ".github/workflows"]
|
||||
paths: ["ci/**", ".github/workflows/**"]
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows: ["Code coverage", "RTLMeter"]
|
||||
|
|
@ -22,8 +22,11 @@ permissions:
|
|||
# Allow only one concurrent deployment, skipping runs queued between the run
|
||||
# in-progress and latest queued. However, do NOT cancel in-progress runs as we
|
||||
# want to allow these deployments to complete.
|
||||
# A skipped-upstream run does no work (see the build job's if:), so put it in its
|
||||
# own throwaway group: otherwise, as the newest queued run, it would cancel a
|
||||
# pending real run and then deploy nothing.
|
||||
concurrency:
|
||||
group: "pages"
|
||||
group: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'skipped') && format('pages-skip-{0}', github.run_id) || 'pages' }}
|
||||
cancel-in-progress: false
|
||||
|
||||
defaults:
|
||||
|
|
@ -34,6 +37,10 @@ jobs:
|
|||
build:
|
||||
name: Build content
|
||||
runs-on: ubuntu-24.04
|
||||
# A skipped upstream run (e.g. Code coverage / RTLMeter on a branch push)
|
||||
# still fires workflow_run; don't rebuild and redeploy for it. deploy and
|
||||
# notify need this job, so they cascade-skip too.
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion != 'skipped' }}
|
||||
outputs:
|
||||
pr-run-ids: ${{ steps.build.outputs.pr-run-ids }}
|
||||
steps:
|
||||
|
|
@ -58,9 +65,16 @@ jobs:
|
|||
runs-on: ubuntu-24.04
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
url: ${{ steps.deploy-2.outputs.page_url || steps.deploy-1.outputs.page_url }}
|
||||
steps:
|
||||
# GitHub's Pages backend intermittently fails a deployment mid-sync, retry
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deploy-1
|
||||
continue-on-error: true
|
||||
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5
|
||||
- name: Deploy to GitHub Pages (retry)
|
||||
id: deploy-2
|
||||
if: steps.deploy-1.outcome == 'failure'
|
||||
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5
|
||||
|
||||
notify:
|
||||
|
|
|
|||
Loading…
Reference in New Issue