Files
nfpm/.github/workflows/build.yml
Dj GilcreaseandClaude Opus 5.5 0a2893e6f6 ci(macos): leave the Developer ID signing job for a follow-up
The job needs the macos-signing environment, which only a repository
admin can create. It will be added once that environment exists; the
task and the verify scripts that use it stay, and skip the Developer ID
checks while no signed packages are present.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 21:00:53 -08:00

451 lines
19 KiB
YAML

name: build
concurrency:
group: ${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
on:
push:
tags:
- v*
branches:
- main
paths:
- "go.*"
- "**/*.go"
- "Taskfile.yml"
- "Dockerfile"
- ".github/workflows/*.yml"
- "testdata/**"
- ".goreleaser.yml"
pull_request:
merge_group:
permissions:
contents: read
jobs:
license-check:
if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- name: Check licenses
run: go run github.com/google/go-licenses/v2@latest check --allowed_licenses=MIT,Apache-2.0,BSD-3-Clause,BSD-2-Clause,ISC,MPL-2.0 ./...
semgrep:
if: github.event_name != 'merge_group'
uses: caarlos0/meta/.github/workflows/semgrep.yml@c7f17af352dac91fa6c785d06ebac8547f1abdd3 # v0.1.0
unit-tests:
if: github.event_name != 'merge_group'
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task setup
- run: task test
- uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
if: matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
acceptance-tests:
if: github.event_name == 'merge_group'
strategy:
matrix:
pkgFormat: [deb, rpm, apk, archlinux, ipk]
pkgPlatform: [amd64, arm64, 386, ppc64le, armv6, armv7, s390x]
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
NO_TEST_PPC64LE: "true"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- run: task setup
- run: task acceptance
env:
TEST_PATTERN: "/${{ matrix.pkgFormat }}/${{ matrix.pkgPlatform }}/"
msix-acceptance-tests:
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task setup
- run: task acceptance
env:
TEST_PATTERN: "TestMSIXStructure"
msi-acceptance-tests:
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task setup
- run: task acceptance
env:
TEST_PATTERN: "TestMSIStructure"
windows-build-pkgs:
if: github.event_name == 'merge_group'
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: dist/
key: ${{ env.sha_short }}
enableCrossOsArchive: true
- run: task acceptance:windows:package
install-windows-pkgs:
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest
needs: [windows-build-pkgs]
steps:
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: dist/
key: ${{ env.sha_short }}
enableCrossOsArchive: true
- run: task acceptance:windows:install
msix-windows-install:
if: github.event_name == 'merge_group'
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and sign MSIX package
run: task acceptance:windows:package:msix
- name: Install and verify MSIX package
run: task acceptance:windows:install:msix
msix-signed-build:
if: github.event_name == 'merge_group'
# Builds the nfpm-signed MSIX on Linux: a GOOS=windows cross-compiled test
# app, packaged and Authenticode-signed by nfpm's pure-Go signer (go-msix)
# with a throwaway openssl cert. msix-windows-signature validates and
# installs these exact bytes on a real Windows runner, so the whole
# cross-platform story is exercised.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task setup
- name: Build nfpm-signed MSIX package
run: task acceptance:windows:package:signed:msix
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: signed-msix-pkg
if-no-files-found: error
# The throwaway key is only needed by the failure diagnostics below.
retention-days: 1
path: |
dist/*.msix
dist/test.cer
dist/test.pfx
msix-windows-signature:
if: github.event_name == 'merge_group'
# Real Windows validation of nfpm's built-in MSIX signature: crypt32
# recomputes the APPX digests (Get-AuthenticodeSignature), signtool
# verifies, and Add-AppxPackage performs an actual deployment. The package
# was built and signed on Linux by msix-signed-build. msix-windows-install
# is the signtool-signed control for the same packager output.
needs: [msix-signed-build]
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: signed-msix-pkg
path: dist
- name: Validate signature (Get-AuthenticodeSignature, signtool verify /pa)
run: task acceptance:windows:verify:msix:signed
- name: Install and verify MSIX package
run: task acceptance:windows:install:msix
- name: "Diagnostic: real signtool signs the same package (digest-table oracle)"
if: failure()
continue-on-error: true
shell: pwsh
run: |
$signtool = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin" -Recurse -Filter signtool.exe |
Where-Object { $_.FullName -match '\\x64\\' } | Sort-Object FullName -Descending | Select-Object -First 1
Copy-Item ./dist/foo-unsigned.msix ./dist/foo-signtool.msix
& $signtool.FullName sign /debug /fd SHA256 /f ./dist/test.pfx /p test123 ./dist/foo-signtool.msix
Write-Host "signtool sign exit: $LASTEXITCODE"
foreach ($p in 'foo.msix', 'foo-signtool.msix') {
$s = Get-AuthenticodeSignature "./dist/$p"
Write-Host "Get-AuthenticodeSignature($p): $($s.Status) - $($s.StatusMessage)"
}
- name: Upload diagnostic packages
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: msix-signature-diagnostics
path: dist/*.msix
msi-windows-install:
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build MSI packages
run: task acceptance:windows:package:msi
- name: Install native MSI validator
run: dotnet tool install wix --version 5.0.2 --tool-path ./dist/wix --allow-roll-forward
- name: Validate advertised shortcut icons with native ICE50
run: ./dist/wix/wix.exe msi validate ./dist/foo.msi -ice ICE50
- name: Install, upgrade, downgrade, verify and remove the MSI packages
run: task acceptance:windows:install:msi
- name: Verify redirected executable, configuration, service and registry target
run: pwsh -ExecutionPolicy Bypass -File testdata/acceptance/install-msi.ps1 -Msi ./dist/foo.msi -InstallDirectory (Join-Path $env:RUNNER_TEMP 'nfpm redirected')
- name: Verify per-user privileges and native Unicode metadata
run: task acceptance:windows:install:msi:per-user
- name: Preserve native MSI verification logs
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: nfpm-msi-native-logs
path: dist/*.log
if-no-files-found: error
retention-days: 7
msi-signed-build:
if: github.event_name == 'merge_group'
# Builds the nfpm-signed MSI on Linux: a GOOS=windows cross-compiled test
# app, packaged and Authenticode-signed by nfpm's pure-Go signer (go-msi)
# with a throwaway openssl cert. msi-windows-signature validates and
# installs these exact bytes on a real Windows runner, so the whole
# cross-platform story is exercised.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task setup
- name: Build nfpm-signed MSI package
run: task acceptance:windows:package:signed:msi
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: signed-msi-pkg
if-no-files-found: error
# The throwaway key is only needed by the failure diagnostics below.
retention-days: 1
path: |
dist/*.msi
dist/test.cer
dist/test.pfx
msi-windows-signature:
if: github.event_name == 'merge_group'
# Real Windows validation of nfpm's built-in MSI signature: msisip
# recomputes the CFB imprint (Get-AuthenticodeSignature), signtool
# verifies, and msiexec installs and removes the package. The package was
# built and signed on Linux by msi-signed-build. msi-windows-install is
# the unsigned control for the same packager output.
needs: [msi-signed-build]
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: signed-msi-pkg
path: dist
- name: Validate signature (Get-AuthenticodeSignature, signtool verify /pa)
run: task acceptance:windows:verify:msi:signed
- name: Install and verify MSI package
run: task acceptance:windows:install:msi:signed
- name: "Diagnostic: real signtool signs the same package (imprint oracle)"
if: failure()
continue-on-error: true
shell: pwsh
run: |
$signtool = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin" -Recurse -Filter signtool.exe |
Where-Object { $_.FullName -match '\\x64\\' } | Sort-Object FullName -Descending | Select-Object -First 1
Copy-Item ./dist/foo-unsigned.msi ./dist/foo-signtool.msi
& $signtool.FullName sign /debug /fd SHA256 /f ./dist/test.pfx /p test123 ./dist/foo-signtool.msi
Write-Host "signtool sign exit: $LASTEXITCODE"
foreach ($p in 'foo.msi', 'foo-signtool.msi') {
$s = Get-AuthenticodeSignature "./dist/$p"
Write-Host "Get-AuthenticodeSignature($p): $($s.Status) - $($s.StatusMessage)"
}
- name: Upload diagnostic packages and logs
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: msi-signature-diagnostics
path: |
dist/*.msi
dist/*.log
macos-acceptance-tests:
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task setup
- run: task acceptance
env:
TEST_PATTERN: "TestMacOSStructure"
macos-linux-build:
# Builds the macOS packages on Linux: a GOOS=darwin cross-compiled test
# app, packaged as an installer package, an application bundle and a disk
# image by nfpm's pure-Go packagers, unsigned and signed with a throwaway
# openssl certificate. macos-verify installs, mounts and launches these
# exact bytes on a real Mac, so the cross-platform story is what gets
# verified.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: stable
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build macOS packages
run: task acceptance:macos:package
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: macos-packages
if-no-files-found: error
retention-days: 1
path: |
dist/*.pkg
dist/*.app.zip
dist/*.dmg
dist/test.crt
dist/unicode-cases.tsv
macos-verify:
# Real macOS validation of the packages built on Linux by
# macos-linux-build. The installer installs, upgrades, downgrades and
# refuses the installer packages; the application bundles are unpacked and
# launched, the disk images mounted, and pkgutil, codesign and the system
# trust stack check the signatures.
needs: [macos-linux-build]
runs-on: macos-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: macos-packages
path: dist
- name: Unpack, mount, launch and verify the application bundles and disk images
run: task acceptance:macos:verify:app
- name: Install, upgrade and verify the installer packages
run: task acceptance:macos:install:pkg
- name: Preserve the installer log
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: nfpm-macos-install-log
path: /var/log/install.log
if-no-files-found: warn
retention-days: 7
build:
if: always()
needs:
- license-check
- semgrep
- unit-tests
- acceptance-tests
- msix-acceptance-tests
- windows-build-pkgs
- install-windows-pkgs
- msix-windows-install
- msix-signed-build
- msix-windows-signature
- msi-acceptance-tests
- msi-windows-install
- msi-signed-build
- msi-windows-signature
- macos-acceptance-tests
- macos-linux-build
- macos-verify
runs-on: ubuntu-latest
env:
RESULTS: ${{ toJSON(needs) }}
steps:
- name: Check PR results
if: github.event_name != 'merge_group'
run: |
printf '%s\n' "$RESULTS" | jq -e '[.["license-check"], .semgrep, .["unit-tests"], .["msi-windows-install"], .["macos-linux-build"], .["macos-verify"]] | ., all(.[]; .result == "success")'
- name: Check acceptance results
if: github.event_name == 'merge_group'
run: |
printf '%s\n' "$RESULTS" | jq -e '[.["acceptance-tests"], .["msix-acceptance-tests"], .["windows-build-pkgs"], .["install-windows-pkgs"], .["msix-windows-install"], .["msix-signed-build"], .["msix-windows-signature"], .["msi-acceptance-tests"], .["msi-windows-install"], .["msi-signed-build"], .["msi-windows-signature"], .["macos-acceptance-tests"], .["macos-linux-build"], .["macos-verify"]] | ., all(.[]; .result == "success")'