Firebird Docker v2 #18
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |