Skip to content

Commit 763f20f

Browse files
committed
Merge branch 'tb/ci-concurrency'
Avoid unnecessary builds in CI, with settings configured in ci-config. * tb/ci-concurrency: ci: avoid unnecessary builds
2 parents 42f9a60 + eb5b03a commit 763f20f

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

.github/workflows/check-whitespace.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ on:
99
pull_request:
1010
types: [opened, synchronize]
1111

12+
# Avoid unnecessary builds. Unlike the main CI jobs, these are not
13+
# ci-configurable (but could be).
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
1218
jobs:
1319
check-whitespace:
1420
runs-on: ubuntu-latest

.github/workflows/l10n.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: git-l10n
22

33
on: [push, pull_request_target]
44

5+
# Avoid unnecessary builds. Unlike the main CI jobs, these are not
6+
# ci-configurable (but could be).
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
511
jobs:
612
git-po-helper:
713
if: >-

.github/workflows/main.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
outputs:
1313
enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }}
14+
skip_concurrent: ${{ steps.check-ref.outputs.skip_concurrent }}
1415
steps:
1516
- name: try to clone ci-config branch
1617
run: |
@@ -34,7 +35,15 @@ jobs:
3435
then
3536
enabled=no
3637
fi
38+
39+
skip_concurrent=yes
40+
if test -x config-repo/ci/config/skip-concurrent &&
41+
! config-repo/ci/config/skip-concurrent '${{ github.ref }}'
42+
then
43+
skip_concurrent=no
44+
fi
3745
echo "enabled=$enabled" >>$GITHUB_OUTPUT
46+
echo "skip_concurrent=$skip_concurrent" >>$GITHUB_OUTPUT
3847
- name: skip if the commit or tree was already tested
3948
id: skip-if-redundant
4049
uses: actions/github-script@v6
@@ -82,6 +91,9 @@ jobs:
8291
needs: ci-config
8392
if: needs.ci-config.outputs.enabled == 'yes'
8493
runs-on: windows-latest
94+
concurrency:
95+
group: windows-build-${{ github.ref }}
96+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
8597
steps:
8698
- uses: actions/checkout@v3
8799
- uses: git-for-windows/setup-git-for-windows-sdk@v1
@@ -101,11 +113,14 @@ jobs:
101113
windows-test:
102114
name: win test
103115
runs-on: windows-latest
104-
needs: [windows-build]
116+
needs: [ci-config, windows-build]
105117
strategy:
106118
fail-fast: false
107119
matrix:
108120
nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
121+
concurrency:
122+
group: windows-test-${{ matrix.nr }}-${{ github.ref }}
123+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
109124
steps:
110125
- name: download tracked files and build artifacts
111126
uses: actions/download-artifact@v3
@@ -137,6 +152,9 @@ jobs:
137152
NO_PERL: 1
138153
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
139154
runs-on: windows-latest
155+
concurrency:
156+
group: vs-build-${{ github.ref }}
157+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
140158
steps:
141159
- uses: actions/checkout@v3
142160
- uses: git-for-windows/setup-git-for-windows-sdk@v1
@@ -184,11 +202,14 @@ jobs:
184202
vs-test:
185203
name: win+VS test
186204
runs-on: windows-latest
187-
needs: vs-build
205+
needs: [ci-config, vs-build]
188206
strategy:
189207
fail-fast: false
190208
matrix:
191209
nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
210+
concurrency:
211+
group: vs-test-${{ matrix.nr }}-${{ github.ref }}
212+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
192213
steps:
193214
- uses: git-for-windows/setup-git-for-windows-sdk@v1
194215
- name: download tracked files and build artifacts
@@ -218,6 +239,9 @@ jobs:
218239
name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})
219240
needs: ci-config
220241
if: needs.ci-config.outputs.enabled == 'yes'
242+
concurrency:
243+
group: ${{ matrix.vector.jobname }}-${{ matrix.vector.pool }}-${{ github.ref }}
244+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
221245
strategy:
222246
fail-fast: false
223247
matrix:
@@ -278,6 +302,9 @@ jobs:
278302
name: ${{matrix.vector.jobname}} (${{matrix.vector.image}})
279303
needs: ci-config
280304
if: needs.ci-config.outputs.enabled == 'yes'
305+
concurrency:
306+
group: dockerized-${{ matrix.vector.jobname }}-${{ matrix.vector.image }}-${{ github.ref }}
307+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
281308
strategy:
282309
fail-fast: false
283310
matrix:
@@ -320,6 +347,9 @@ jobs:
320347
env:
321348
jobname: StaticAnalysis
322349
runs-on: ubuntu-22.04
350+
concurrency:
351+
group: static-analysis-${{ github.ref }}
352+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
323353
steps:
324354
- uses: actions/checkout@v3
325355
- run: ci/install-dependencies.sh
@@ -331,6 +361,9 @@ jobs:
331361
env:
332362
jobname: sparse
333363
runs-on: ubuntu-20.04
364+
concurrency:
365+
group: sparse-${{ github.ref }}
366+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
334367
steps:
335368
- name: Download a current `sparse` package
336369
# Ubuntu's `sparse` version is too old for us
@@ -349,6 +382,9 @@ jobs:
349382
name: documentation
350383
needs: ci-config
351384
if: needs.ci-config.outputs.enabled == 'yes'
385+
concurrency:
386+
group: documentation-${{ github.ref }}
387+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
352388
env:
353389
jobname: Documentation
354390
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)