-
-
Notifications
You must be signed in to change notification settings - Fork 11
113 lines (98 loc) · 3.81 KB
/
ci.yaml
File metadata and controls
113 lines (98 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: ci
# Build and run all tests.
# - Triggers: All pushes and pull requests on any branch.
# - Runs on: All repositories (including forks)
#
# Forks build only the latest version + default distro on amd64 (fast feedback).
# Full matrix (including ARM64) runs on workflow_dispatch or the official repo.
on:
push:
branches: ['**']
pull_request:
branches: ['**']
workflow_dispatch:
inputs:
version-filter:
description: 'Version filter (e.g. 5, 4.0, 5.0.3). Empty = all.'
required: false
type: string
distro-filter:
description: 'Distro filter (e.g. bookworm). Empty = all.'
required: false
type: string
# Prevents overlapping runs of this workflow on the same branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
determine-scope:
runs-on: ubuntu-latest
outputs:
version-filter: ${{ steps.scope.outputs.version-filter }}
distro-filter: ${{ steps.scope.outputs.distro-filter }}
is-official: ${{ steps.scope.outputs.is-official }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Determine build scope
id: scope
shell: pwsh
run: |
$vf = '${{ inputs.version-filter }}'
$df = '${{ inputs.distro-filter }}'
$isOfficial = '${{ github.repository }}' -eq 'FirebirdSQL/firebird-docker'
# For forks (non-dispatch), build only latest version + default distro
if (-not $vf -and '${{ github.event_name }}' -ne 'workflow_dispatch') {
if (-not $isOfficial) {
$assets = Get-Content -Raw ./assets.json | ConvertFrom-Json
$vf = $assets.versions[0].version
$df = $assets.config.defaultDistro
}
}
"version-filter=$vf" >> $env:GITHUB_OUTPUT
"distro-filter=$df" >> $env:GITHUB_OUTPUT
"is-official=$($isOfficial.ToString().ToLower())" >> $env:GITHUB_OUTPUT
build-and-test:
if: ${{ !(github.repository == 'FirebirdSQL/firebird-docker' && github.ref == 'refs/heads/master') }}
needs: determine-scope
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
exclude:
# Forks: skip arm64 to save CI minutes
- arch: ${{ needs.determine-scope.outputs.is-official != 'true' && 'arm64' || 'none' }}
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install tools
shell: pwsh
run: |
Install-Module InvokeBuild -Force
Install-Module PSFirebird -MinimumVersion '1.0.0' -Force
- name: Build
shell: pwsh
run: |
$params = @{}
if ('${{ needs.determine-scope.outputs.version-filter }}') { $params['VersionFilter'] = '${{ needs.determine-scope.outputs.version-filter }}' }
if ('${{ needs.determine-scope.outputs.distro-filter }}') { $params['DistributionFilter'] = '${{ needs.determine-scope.outputs.distro-filter }}' }
Invoke-Build Build @params
- name: Test
shell: pwsh
run: |
$params = @{}
if ('${{ needs.determine-scope.outputs.version-filter }}') { $params['VersionFilter'] = '${{ needs.determine-scope.outputs.version-filter }}' }
if ('${{ needs.determine-scope.outputs.distro-filter }}') { $params['DistributionFilter'] = '${{ needs.determine-scope.outputs.distro-filter }}' }
Invoke-Build Test @params
- name: Run tag unit tests
if: matrix.arch == 'amd64'
shell: pwsh
run: |
Install-Module Pester -Force -SkipPublisherCheck
Invoke-Pester src/tags.tests.ps1 -Output Detailed -CI