Skip to content

Commit 4a24602

Browse files
committed
ci: build only latest-per-major on fork pushes
1 parent b411e34 commit 4a24602

4 files changed

Lines changed: 32 additions & 4 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: ci
33
# Build and run all tests.
44
# - Triggers: All pushes and pull requests on any branch.
55
# - Runs on: All repositories (including forks)
6+
#
7+
# Forks (non-dispatch): build only the latest release per major Firebird version.
8+
# Official repo or workflow_dispatch: full build of all versions.
69

710
on:
811
push:
@@ -28,8 +31,25 @@ concurrency:
2831
cancel-in-progress: true
2932

3033
jobs:
34+
determine-scope:
35+
runs-on: ubuntu-latest
36+
outputs:
37+
latest-per-major: ${{ steps.scope.outputs.latest-per-major }}
38+
steps:
39+
- name: Determine build scope
40+
id: scope
41+
run: |
42+
IS_OFFICIAL="${{ github.repository == 'FirebirdSQL/firebird-docker' }}"
43+
IS_DISPATCH="${{ github.event_name == 'workflow_dispatch' }}"
44+
if [[ "$IS_OFFICIAL" == "true" || "$IS_DISPATCH" == "true" ]]; then
45+
echo "latest-per-major=false" >> $GITHUB_OUTPUT
46+
else
47+
echo "latest-per-major=true" >> $GITHUB_OUTPUT
48+
fi
49+
3150
build-and-test:
3251
if: ${{ !(github.repository == 'FirebirdSQL/firebird-docker' && github.ref == 'refs/heads/master') }}
52+
needs: determine-scope
3353
strategy:
3454
fail-fast: false
3555
matrix:
@@ -56,6 +76,7 @@ jobs:
5676
$params = @{}
5777
if ('${{ inputs.version-filter }}') { $params['VersionFilter'] = '${{ inputs.version-filter }}' }
5878
if ('${{ inputs.distro-filter }}') { $params['DistributionFilter'] = '${{ inputs.distro-filter }}' }
79+
if ('${{ needs.determine-scope.outputs.latest-per-major }}' -eq 'true') { $params['LatestPerMajor'] = $true }
5980
Invoke-Build Build @params
6081
6182
- name: Test
@@ -64,6 +85,7 @@ jobs:
6485
$params = @{}
6586
if ('${{ inputs.version-filter }}') { $params['VersionFilter'] = '${{ inputs.version-filter }}' }
6687
if ('${{ inputs.distro-filter }}') { $params['DistributionFilter'] = '${{ inputs.distro-filter }}' }
88+
if ('${{ needs.determine-scope.outputs.latest-per-major }}' -eq 'true') { $params['LatestPerMajor'] = $true }
6789
Invoke-Build Test @params
6890
6991
- name: Run tag unit tests

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Invoke-Build Build -VersionFilter 5 -DistributionFilter bookworm # Filtered
4545
- `AGENTS.md` — This file
4646

4747
## CI/CD
48-
- `ci.yaml` — Build+test on push/PR. Full matrix (amd64 + arm64) on all repos. Filtered via workflow_dispatch inputs.
48+
- `ci.yaml` — Build+test on push/PR. Full matrix (amd64 + arm64) on all repos. Forks: latest release per major version only. Official repo or `workflow_dispatch`: all versions. Filtered via workflow_dispatch inputs.
4949
- `publish.yaml` — Official repo only. Build+test+push to Docker Hub.
5050
- `snapshot.yaml` — Snapshot pre-release images from FirebirdSQL/snapshots.
5151

DECISIONS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ Decisions made during the v2 rewrite, with rationale.
5050

5151
**Rationale:** Firebird 3 depends on `libncurses5`, which was removed from Ubuntu Noble. Rather than special-casing in code, we declare blocked combinations in config.
5252

53-
## D-008: Uniform CI scope
53+
## D-008: Fork CI scope — latest release per major version
5454

55-
**Decision:** All repositories (forks and official) run the same full build matrix on every push/PR, including both amd64 and arm64.
55+
**Decision:** On forks (non-official repo, non-`workflow_dispatch`), CI builds and tests only the latest release of each major Firebird version (e.g. 5.0.3, 4.0.6, 3.0.13). The official repository always performs a full build of all versions.
5656

57-
**Rationale:** Consistent CI ensures contributors catch the same failures as the official repo. Public repos have unlimited GitHub Actions minutes, so fork-scoping provides no meaningful savings while adding code complexity.
57+
**Rationale:** A full matrix (17 versions × 4 distros × 2 arches) takes 17+ minutes on forks where contributors verify a single change. The latest of each major is sufficient to catch regressions across the version range. The official repo and manual `workflow_dispatch` runs always build everything. Controlled via the `LatestPerMajor` switch in `firebird-docker.build.ps1`.
5858

5959
## D-009: No QEMU in CI
6060

firebird-docker.build.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
param(
22
[string]$VersionFilter, # Filter by version (e.g. '3', '4.0', '5.0.2').
33
[string]$DistributionFilter, # Filter by image distribution (e.g. 'bookworm', 'bullseye', 'jammy').
4+
[switch]$LatestPerMajor, # Build/test only the latest release of each major Firebird version.
45

56
[string]$TestFilter, # Filter by test name (e.g., 'FIREBIRD_USER_can_create_user'). Used only in the 'Test' task.
67

@@ -180,6 +181,11 @@ task FilteredAssets LoadAssets, {
180181
Select-Object -Property 'version','releases',@{Name = 'tags'; Expression = { [PSCustomObject]@{ "$DistributionFilter" = $_.tags.$DistributionFilter } } }
181182
}
182183

184+
if ($LatestPerMajor) {
185+
# Keep only the first (latest) entry per major version
186+
$result = $result | Group-Object { ([version]$_.version).Major } | ForEach-Object { $_.Group[0] }
187+
}
188+
183189
if (-not $result) {
184190
Write-Error "No assets found matching the specified filters."
185191
exit 1

0 commit comments

Comments
 (0)