Skip to content

Commit

Permalink
Resync workflows from audioswitcher
Browse files Browse the repository at this point in the history
  • Loading branch information
fredemmott committed Jan 2, 2024
1 parent b4c9f5a commit 2a08505
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 196 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
on:
workflow_call
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: Isolate artifacts
shell: pwsh
if: matrix.build-type == 'RelWithDebInfo'
run: |
$Out = "${{runner.temp}}/out"
New-Item -ItemType "directory" -Path "${{runner.temp}}/out"
Switch ("${{matrix.os}}")
{
'macos' {
Copy-Item build/Sources/sdmicmute $Out/
Copy-Item -Recurse build/Sources/sdmicmute.dSYM $Out/sdmicmute.dSYM
}
'windows' {
Copy-Item build/Sources/${{matrix.build-type}}/*.exe $Out/
Copy-Item build/Sources/${{matrix.build-type}}/*.pdb $Out/
}
}
Get-ChildItem $Out
- name: Upload artifacts
if: matrix.build-type == 'RelWithDebInfo'
uses: actions/upload-artifact@v4
with:
name: build-${{matrix.os}}-${{matrix.arch}}-${{matrix.build-type}}
path: ${{runner.temp}}/out
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
96 changes: 7 additions & 89 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,15 @@ 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: Build
uses: ./.github/workflows/build.yml
secrets: inherit
package:
name: Package
needs: build
uses: ./.github/workflows/sdplugin.yml
uses: ./.github/workflows/package.yml
release:
needs: streamDeckPlugin
name: Release
needs: package
uses: ./.github/workflows/release.yml
secrets: inherit
76 changes: 76 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
on:
workflow_call:
jobs:
streamDeckPlugin:
name: Package
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
path: source
- name: Make build directory
run: cmake -E make_directory build
- name: Configure
working-directory: build
shell: pwsh
run: |
cmake ${{github.workspace}}/source `
"-DCMAKE_INSTALL_PREFIX=${{runner.temp}}/com.fredemmott.micmutetoggle.sdPlugin"
- name: Install static files
working-directory: build/sdPlugin
run: make install
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: ${{runner.temp}}/artifacts
- name: Display downloaded files
run: ls -R
working-directory: ${{runner.temp}}/artifacts
- name: Combine MacOS artifacts
working-directory: ${{runner.temp}}
run: |
lipo -create \
artifacts/build-macos-arm64-RelWithDebInfo/sdmicmute \
artifacts/build-macos-x86_64-RelWithDebInfo/sdmicmute \
-output sdmicmute
mkdir dsym
cp -R \
artifacts/build-macos-arm64-RelWithDebInfo/*.dSYM \
dsym/sdmicmute.dSYM
DSYM_FILE=Contents/Resources/DWARF/sdmicmute
rm dsym/sdmicmute.dSYM/${DSYM_FILE}
lipo -create \
artifacts/build-macos*/*.dSYM/${DSYM_FILE} \
-output dsym/sdmicmute.dSYM/${DSYM_FILE}
(
cd dsym
zip -r sdmicmute.dSYM.zip sdmicmute.dSYM
)
- name: Upload MacOS debug symbols
uses: actions/upload-artifact@v4
with:
name: package-macos-DebugSymbols
path: ${{runner.temp}}/dsym/sdmicmute.dSYM.zip
- name: Copy executables
working-directory: ${{runner.temp}}
run: |
install -m755 \
sdmicmute \
com.fredemmott.micmutetoggle.sdPlugin/sdmicmute
install -m755 \
artifacts/build-windows-x86_64-RelWithDebInfo/sdmicmute.exe \
com.fredemmott.micmutetoggle.sdPlugin/sdmicmute.exe
- name: Checkout DistributionTool
uses: actions/checkout@v4
with:
ref: distributiontool-v1.4
- name: Build .streamDeckPlugin
run: |
./DistributionTool -b \
-i ${{runner.temp}}/com.fredemmott.micmutetoggle.sdPlugin \
-o .
- name: Upload .streamDeckPlugin
uses: actions/upload-artifact@v4
with:
name: package-sdplugin
path: com.fredemmott.micmutetoggle.streamDeckPlugin
63 changes: 32 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
name: Prepare release
on:
workflow_call:
workflow_call:
jobs:
release:
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 "is-release=true" >> $GITHUB_OUTPUT
echo "tag=$(echo ${{github.ref}} | awk -F/ '{print $NF}')" >> $GITHUB_OUTPUT
else
echo "is-release=false" >> $GITHUB_OUTPUT
fi
- name: Create Draft Release
id: create-release
if: steps.ref.outputs.is-release == 'true'
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with:
tag_name: ${{steps.ref.outputs.tag}}
prerelease: ${{contains(github.ref_name, '-')}}
draft: true
files: |
${{runner.temp}}/artifacts/com.fredemmott.micmutetoggle.streamDeckPlugin/com.fredemmott.micmutetoggle.streamDeckPlugin
${{runner.temp}}/artifacts/DebugSymbols-windows-RelWithDebInfo/sdmicmute.pdb
${{runner.temp}}/artifacts/sdmicmute-lipo-dsym/sdmicmute.dSYM.zip
release:
name: Release
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 "is-release=true" >> $GITHUB_OUTPUT
echo "tag=$(echo ${{github.ref}} | awk -F/ '{print $NF}')" >> $GITHUB_OUTPUT
else
echo "is-release=false" >> $GITHUB_OUTPUT
fi
- name: Create Draft Release
id: create-release
if: steps.ref.outputs.is-release == 'true'
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with:
tag_name: ${{steps.ref.outputs.tag}}
prerelease: ${{contains(github.ref_name, '-')}}
draft: true
files: |
${{runner.temp}}/artifacts/package-sdplugin/*.streamDeckPlugin
${{runner.temp}}/artifacts/build-windows-x86_64-RelWithDebInfo/*.pdb
${{runner.temp}}/artifacts/package-macos-DebugSymbols/*.dSYM.zip
Loading

0 comments on commit 2a08505

Please sign in to comment.