|
1 | | -### NB: This is the master file for autogenerating |
2 | | -### NB: `.github/workflows/{bors, build_fork, build}.yml`. |
3 | | -### NB: If you need to edit any of those files, you should edit this file instead, |
4 | | -### NB: and regenerate those files by manually running |
5 | | -### NB: .github/workflows/mk_build_yml.sh |
| 1 | +# Reusable workflow invoked by build.yml, bors.yml, and build_fork.yml. |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + concurrency_group: |
| 7 | + type: string |
| 8 | + required: true |
| 9 | + pr_branch_ref: |
| 10 | + type: string |
| 11 | + required: true |
| 12 | + job_name_suffix: |
| 13 | + type: string |
| 14 | + required: false |
| 15 | + default: "" |
| 16 | + runs_on: |
| 17 | + type: string |
| 18 | + required: true |
6 | 19 |
|
7 | 20 | env: |
8 | 21 | # Disable Lake's automatic fetching of cloud builds. |
|
12 | 25 | # not necessarily satisfy this property. |
13 | 26 | LAKE_NO_CACHE: true |
14 | 27 |
|
15 | | -concurrency: |
16 | | - # label each workflow run; only the latest with each label will run |
17 | | - # workflows on master get more expressive labels |
18 | | - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ (github.event_name == 'push' && contains(fromJSON('["refs/heads/master", "refs/heads/staging"]'), github.ref) && github.run_id) || '' }} |
19 | | - # cancel any running workflow with the same label |
20 | | - cancel-in-progress: true |
21 | | - |
22 | | -# Limit permissions for GITHUB_TOKEN for the entire workflow |
23 | | -permissions: |
24 | | - contents: read |
25 | | - pull-requests: write # Only allow PR comments/labels |
26 | | - # All other permissions are implicitly 'none' |
27 | | - |
28 | 28 | jobs: |
29 | 29 | build: |
30 | | - if: FORK_CONDITION |
31 | | - name: BuildJOB_NAME |
32 | | - runs-on: RUNS_ON |
| 30 | + name: Build${{ inputs.job_name_suffix }} |
| 31 | + runs-on: ${{ inputs.runs_on }} |
33 | 32 | outputs: |
34 | 33 | build-outcome: ${{ steps.build.outcome }} |
35 | 34 | archive-outcome: ${{ steps.archive.outcome }} |
|
51 | 50 | REF: ${{ github.ref }} |
52 | 51 | EVENT_NAME: ${{ github.event_name }} |
53 | 52 | RUN_ID: ${{ github.run_id }} |
54 | | - CONCURRENCY_GROUP: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ (github.event_name == 'push' && contains(fromJSON('["refs/heads/master", "refs/heads/staging"]'), github.ref) && github.run_id) || '' }} |
| 53 | + CONCURRENCY_GROUP: ${{ inputs.concurrency_group }} |
55 | 54 | shell: bash # there is no script body, so this is safe to "run" outside landrun. |
56 | 55 | run: | |
57 | 56 | # We just populate the env vars for this step to make them viewable in the logs |
|
90 | 89 | - name: Checkout PR branch |
91 | 90 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
92 | 91 | with: |
93 | | - ref: "${{ PR_BRANCH_REF }}" |
| 92 | + ref: ${{ inputs.pr_branch_ref }} |
94 | 93 | path: pr-branch |
95 | 94 |
|
96 | 95 | - name: Prepare DownstreamTest directory |
@@ -591,15 +590,14 @@ jobs: |
591 | 590 | master-branch/scripts/lean-pr-testing-comments.sh batteries |
592 | 591 |
|
593 | 592 | post_steps: |
594 | | - name: Post-Build StepJOB_NAME |
595 | | - if: FORK_CONDITION |
| 593 | + name: Post-Build Step${{ inputs.job_name_suffix }} |
596 | 594 | needs: [build] |
597 | 595 | runs-on: ubuntu-latest # Note these steps run on disposable GitHub runners, so no landrun sandboxing is needed. |
598 | 596 | steps: |
599 | 597 |
|
600 | 598 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
601 | 599 | with: |
602 | | - ref: "${{ PR_BRANCH_REF }}" |
| 600 | + ref: ${{ inputs.pr_branch_ref }} |
603 | 601 |
|
604 | 602 | - name: Configure Lean |
605 | 603 | uses: leanprover/lean-action@c544e89643240c6b398f14a431bcdc6309e36b3e # v1.4.0 |
@@ -671,19 +669,17 @@ jobs: |
671 | 669 | # We no longer run `lean4checker` in regular CI, as it is quite expensive for little benefit. |
672 | 670 | # Instead we run it in a cron job on master: see `daily.yml`. |
673 | 671 | style_lint: |
674 | | - name: Lint styleJOB_NAME |
675 | | - if: FORK_CONDITION |
| 672 | + name: Lint style${{ inputs.job_name_suffix }} |
676 | 673 | runs-on: ubuntu-latest |
677 | 674 | steps: |
678 | 675 | - uses: leanprover-community/lint-style-action@a7e7428fa44f9635d6eb8e01919d16fd498d387a # 2025-08-18 |
679 | 676 | with: |
680 | 677 | mode: check |
681 | 678 | lint-bib-file: true |
682 | | - ref: ${{ PR_BRANCH_REF }} |
| 679 | + ref: ${{ inputs.pr_branch_ref }} |
683 | 680 |
|
684 | 681 | final: |
685 | | - name: Post-CI jobJOB_NAME |
686 | | - if: FORK_CONDITION |
| 682 | + name: Post-CI job${{ inputs.job_name_suffix }} |
687 | 683 | needs: [style_lint, build, post_steps] |
688 | 684 | runs-on: ubuntu-latest |
689 | 685 | steps: |
|
0 commit comments