Skip to content

Change condition for Unix configuration step #7

Change condition for Unix configuration step

Change condition for Unix configuration step #7

Workflow file for this run

name: CI (Linux/macOS/Windows)
on:
push:
branches: [ main ]
tags: ['v*']
release:
types: [published]
pull_request:
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x86_64
qt_host: linux
qt_arch: linux_gcc_64
- os: macos-latest
arch: arm64
qt_host: mac
qt_arch: clang_64
- os: windows-latest
arch: x64
qt_host: windows
qt_arch: win64_msvc2022_64
runs-on: ${{ matrix.os }}
env:
CODESIGN_ID: Developer ID Application
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
# Prep
- name: Prep Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
- name: Prep macOS
if: startsWith(matrix.os, 'macos-')
run: |
brew update
brew install ninja || true
- name: Set up MSVC (Windows)
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Ensure Ninja (Windows)
if: matrix.os == 'windows-latest'
run: choco install ninja -y || echo "Ninja already present"
shell: pwsh
# Qt
- name: Install Qt 6.10.0 + QtIFW
uses: jurplel/install-qt-action@v4
with:
version: '6.10.0'
host: ${{ matrix.qt_host }}
target: desktop
arch: ${{ matrix.qt_arch }}
cache: true
aqtversion: '==3.3.*'
modules: 'qthttpserver qtwebsockets qtimageformats'
tools: 'tools_ifw'
- name: Show versions (Unix)
if: matrix.os != 'windows-latest'
run: |
cmake --version
qmake -v || true
- name: Show versions (Windows)
if: matrix.os == 'windows-latest'
run: |
cmake --version
qmake -v || Write-Host "qmake not on PATH (ok)"
shell: pwsh
# --- Import Developer ID cert into an ephemeral keychain ---
- name: Create and unlock keychain
if: matrix.os == 'macos-latest'
run: |
security create-keychain -p "$MAC_KEYCHAIN_PASSWORD" build.keychain
security set-keychain-settings -lut 21600 build.keychain
security unlock-keychain -p "$MAC_KEYCHAIN_PASSWORD" build.keychain
security list-keychains -s build.keychain login.keychain
env:
MAC_KEYCHAIN_PASSWORD: ${{ secrets.MAC_KEYCHAIN_PASSWORD }}
- name: Import Developer ID certificate
if: matrix.os == 'macos-latest'
run: |
base64 -d <<< "$MAC_CERT_P12" > dev.p12
security import dev.p12 -k build.keychain -P "$MAC_CERT_P12_PASSWORD" -T /usr/bin/codesign -T /usr/bin/security
# Allow codesign to use the key non-interactively:
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MAC_KEYCHAIN_PASSWORD" build.keychain
rm -f dev.p12
env:
MAC_CERT_P12: ${{ secrets.MAC_CERT_P12 }}
MAC_CERT_P12_PASSWORD: ${{ secrets.MAC_CERT_P12_PASSWORD }}
MAC_KEYCHAIN_PASSWORD: ${{ secrets.MAC_KEYCHAIN_PASSWORD }}
# Configure
- name: Configure (Unix)
if: matrix.os != 'windows-latest'
run: cmake -S src -B build-Release -G Ninja -DCMAKE_BUILD_TYPE=Release -DCODESIGN_ID="$CODESIGN_ID"
- name: Configure (Windows)
if: matrix.os == 'windows-latest'
run: cmake -S src -B build-Release -G Ninja -DCMAKE_BUILD_TYPE=Release
shell: pwsh
# Build
- name: Build (Unix)
if: matrix.os != 'windows-latest'
run: cmake --build build-Release --parallel
- name: Build (Windows)
if: matrix.os == 'windows-latest'
run: cmake --build build-Release --parallel
shell: pwsh
# Package
- name: CPack (Unix)
if: matrix.os != 'windows-latest'
run: cmake --build build-Release --target package --parallel
continue-on-error: true
- name: CPack (Windows)
if: matrix.os == 'windows-latest'
run: cmake --build build-Release --target package --parallel
shell: pwsh
continue-on-error: true
# Artifacts
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ matrix.os }}-${{ matrix.arch }}-packages
path: |
build-Release/${{ github.event.repository.name }}-*.deb
build-Release/${{ github.event.repository.name }}-*.rpm
build-Release/${{ github.event.repository.name }}-*.sh
build-Release/${{ github.event.repository.name }}-*.run
build-Release/${{ github.event.repository.name }}-*.zip
build-Release/${{ github.event.repository.name }}-*.tar.gz
build-Release/${{ github.event.repository.name }}-*.dmg
build-Release/${{ github.event.repository.name }}-*.exe
if-no-files-found: error
release:
name: Publish GitHub Release
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
pattern: ${{ github.event.repository.name }}-*packages
merge-multiple: true
path: artifacts
- name: List files
run: ls -lah artifacts
- name: Create Release & upload assets
uses: softprops/action-gh-release@v2
with:
# Mark RC/Beta as prerelease automatically (optional)
prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') }}
files: artifacts/*