Skip to content

Commit 7fed346

Browse files
committed
perf(ci): reduce pull request validation matrix
1 parent 16dc644 commit 7fed346

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

.github/workflows/_artifacts_windows.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
on:
22
workflow_call:
3+
inputs:
4+
packages:
5+
required: true
6+
type: string
37

48
env:
59
DOTNET_INSTALL_DIR: "./.dotnet"
@@ -12,7 +16,7 @@ jobs:
1216
strategy:
1317
fail-fast: false
1418
matrix:
15-
package: [ Executable, MsBuildFull ]
19+
package: ${{ fromJson(inputs.packages) }}
1620

1721
steps:
1822
- name: Harden the runner (Audit all outbound calls)

.github/workflows/ci.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
contents: read
5454
outputs:
5555
can_publish: ${{ steps.flags.outputs.can_publish }}
56+
run_full_validation: ${{ steps.flags.outputs.run_full_validation }}
5657
steps:
5758
- name: Harden the runner (Audit all outbound calls)
5859
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
@@ -62,7 +63,9 @@ jobs:
6263
- name: Resolve publish flag
6364
id: flags
6465
shell: bash
65-
run: echo "can_publish=${{ github.repository == 'GitTools/GitVersion' && github.ref_name == 'main' }}" >> "$GITHUB_OUTPUT"
66+
run: |
67+
echo "can_publish=${{ github.repository == 'GitTools/GitVersion' && github.ref_name == 'main' }}" >> "$GITHUB_OUTPUT"
68+
echo "run_full_validation=${{ github.repository == 'GitTools/GitVersion' && (github.ref_name == 'main' || github.event_name == 'merge_group' || github.event_name == 'repository_dispatch') }}" >> "$GITHUB_OUTPUT"
6669
6770
build:
6871
name: Build & Package
@@ -84,13 +87,15 @@ jobs:
8487

8588
artifacts_windows_test:
8689
name: Artifacts Windows
87-
needs: [ build ]
90+
needs: [ build, publish_flags ]
8891
permissions:
8992
contents: read
9093
uses: $/.github/workflows/_artifacts_windows.yml # NOSONAR -- $/ resolves to the running commit.
94+
with:
95+
packages: ${{ fromJson(needs.publish_flags.outputs.run_full_validation) && '["Executable", "MsBuildFull"]' || '["Executable"]' }}
9196

9297
artifacts_linux_test:
93-
needs: [ prepare, build ]
98+
needs: [ prepare, build, publish_flags ]
9499
name: Artifacts Linux (${{ matrix.arch }})
95100
permissions:
96101
contents: read
@@ -106,7 +111,7 @@ jobs:
106111
with:
107112
runner: ${{ matrix.runner }}
108113
arch: ${{ matrix.arch }}
109-
docker_distros: ${{ needs.prepare.outputs.docker_distros }}
114+
docker_distros: ${{ fromJson(needs.publish_flags.outputs.run_full_validation) && needs.prepare.outputs.docker_distros || '["ubuntu.24.04"]' }}
110115
dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }}
111116

112117
docker_linux_images:
@@ -129,14 +134,15 @@ jobs:
129134
with:
130135
runner: ${{ matrix.runner }}
131136
arch: ${{ matrix.arch }}
132-
docker_distros: ${{ needs.prepare.outputs.docker_distros }}
137+
docker_distros: ${{ fromJson(needs.publish_flags.outputs.run_full_validation) && needs.prepare.outputs.docker_distros || '["ubuntu.24.04"]' }}
133138
dotnet_versions: ${{ needs.prepare.outputs.dotnet_versions }}
134139
publish_images: ${{ fromJson(needs.publish_flags.outputs.can_publish) }}
135140
dockerhub_oidc_connection_id: ${{ vars.DOCKERHUB_OIDC_CONNECTIONID }}
136141

137142
docker_linux_manifests:
138143
needs: [ prepare, docker_linux_images, publish_flags ]
139144
name: Docker Manifests
145+
if: fromJson(needs.publish_flags.outputs.can_publish)
140146
permissions:
141147
contents: read
142148
id-token: write
@@ -164,6 +170,7 @@ jobs:
164170
release:
165171
name: Release
166172
needs: [ publish, docker_linux_manifests ]
173+
if: ${{ always() && needs.publish.result == 'success' && (needs.docker_linux_manifests.result == 'success' || needs.docker_linux_manifests.result == 'skipped') }}
167174
runs-on: windows-2025-vs2026
168175
permissions:
169176
contents: write

0 commit comments

Comments
 (0)