I love the github actions develop<->test cycle #163
This file contains 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: Continuous Integration | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: Build ${{matrix.os}}/${{matrix.arch}}/${{matrix.build-type}} | |
runs-on: ${{matrix.os}}-${{matrix.os_version}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: source | |
- name: Make build directory | |
run: cmake -E make_directory build | |
- name: Fetch code-signing key | |
id: signing-key | |
if: (matrix.os == 'windows') && (github.repository == 'fredemmott/StreamDeck-AudioMute') && (github.event_name == 'push') && (github.actor == 'fredemmott') | |
env: | |
CODE_SIGNING_PFX_BASE64: ${{ secrets.CODE_SIGNING_PFX_BASE64 }} | |
run: | | |
$KeyFile = "${{runner.temp}}/MyCert.pfx" | |
[System.Convert]::FromBase64String($Env:CODE_SIGNING_PFX_BASE64) ` | |
| Set-Content $KeyFile -AsByteStream | |
Add-Content $Env:GITHUB_OUTPUT "KEY_FILE=$KeyFile" | |
- name: Configure | |
working-directory: build | |
shell: pwsh | |
run: | | |
$args = @( | |
"-DCMAKE_BUILD_TYPE=${{matrix.build-type}}" | |
"-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/com.fredemmott.micmutetoggle.sdPlugin" | |
"-DCMAKE_OSX_ARCHITECTURES=${{matrix.arch}}" | |
"-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11" | |
) | |
if ( "${{matrix.os}}" -eq "windows" ) { | |
$args += "-DCMAKE_SYSTEM_VERSION=10.0.22621.0" | |
} | |
$KeyFile = "${{steps.signing-key.outputs.KEY_FILE}}" | |
if ( "$keyPath" -ne "" ) { | |
$args += "-DSIGNTOOL_KEY_ARGS=/f;$KeyFile" | |
} | |
cmake ${{github.workspace}}/source @args | |
- name: Compile | |
working-directory: build | |
run: cmake --build . --config ${{matrix.build-type}} --parallel | |
- name: Split out MacOS debug symbols | |
if: matrix.os == 'macos' && matrix.build-type == 'RelWithDebInfo' | |
working-directory: build/Sources | |
run: | | |
dsymutil sdmicmute | |
strip -x -S sdmicmute | |
- name: Upload MacOS Executable | |
if: matrix.os == 'macos' && matrix.build-type != 'Debug' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: MacOS-${{matrix.arch}}-${{matrix.build-type}} | |
path: build/Sources/sdmicmute | |
- name: Upload MacOS debug symbols | |
if: matrix.os == 'macos' && matrix.build-type == 'RelWithDebInfo' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: DebugSymbols-${{matrix.os}}-${{matrix.arch}}-${{matrix.build-type}}.dSYM | |
path: build/Sources/sdmicmute.dSYM | |
- name: Upload Windows Executable | |
if: matrix.os == 'windows' && matrix.build-type != 'Debug' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Windows-${{matrix.build-type}} | |
path: build/Sources/${{matrix.build-type}}/sdmicmute.exe | |
- name: Upload Windows Debug Symbols | |
if: matrix.os == 'windows' && matrix.build-type == 'RelWithDebInfo' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: DebugSymbols-${{matrix.os}}-${{matrix.build-type}} | |
path: build/Sources/${{matrix.build-type}}/sdmicmute.pdb | |
strategy: | |
matrix: | |
target: [windows, macos-arm64, macos-x86_64] | |
build-type: [RelWithDebInfo, Debug] | |
include: | |
- target: windows | |
os: windows | |
arch: x86_64 | |
os_version: latest | |
- target: macos-arm64 | |
os: macos | |
arch: arm64 | |
os_version: 12 # 'latest' is current 11, need better C++20 support | |
- target: macos-x86_64 | |
os: macos | |
arch: x86_64 | |
os_version: 12 | |
streamDeckPlugin: | |
name: StreamDeck Plugin | |
needs: build | |
uses: ./.github/workflows/sdplugin.yml | |
release: | |
needs: [streamDeckPlugin] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: ${{runner.temp}}/artifacts | |
- name: Display downloaded files | |
run: ls -R | |
working-directory: ${{runner.temp}}/artifacts | |
- name: Check if this is a release push | |
id: ref | |
run: | | |
if echo ${{github.ref}} | grep --silent refs/tags/v; then | |
echo "::set-output name=is-release::true" | |
echo "::set-output name=tag::$(echo ${{github.ref}} | awk -F/ '{print $NF}')" | |
else | |
echo "::set-output name=is-release::false" | |
fi | |
- name: Create Draft Release | |
id: create-release | |
if: steps.ref.outputs.is-release == 'true' | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_name: Release ${{ steps.ref.outputs.tag }} | |
tag_name: ${{steps.ref.outputs.tag}} | |
draft: true | |
- name: Attach Release Build | |
if: steps.ref.outputs.is-release == 'true' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
asset_path: ${{runner.temp}}/artifacts/RelWithDebInfo-StreamDeckPlugin/com.fredemmott.micmutetoggle.streamDeckPlugin | |
asset_name: com.fredemmott.micmutetoggle.streamDeckPlugin | |
asset_content_type: application/octet-stream | |
- name: Attach PDB Files | |
if: steps.ref.outputs.is-release == 'true' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
asset_path: ${{runner.temp}}/artifacts/DebugSymbols-windows-RelWithDebInfo/sdmicmute.pdb | |
asset_name: sdmicmute.pdb | |
asset_content_type: application/octet-stream |