Skip to content

Commit

Permalink
ci: Update CI build artifacts.
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Nana <[email protected]>
  • Loading branch information
na2axl committed Oct 6, 2024
1 parent e839bc9 commit 15a9f80
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 30 deletions.
44 changes: 24 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH=${{ github.ref }}
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
Expand All @@ -44,46 +44,46 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build:
needs: [ cleanup ]
needs: [cleanup]
uses: ./.github/workflows/cmake.yml
with:
project-path: .
project-slug: amplitude_audio_sdk
project-slug: sdk
name: Amplitude Audio SDK

release:
needs: [ build ]
needs: [build]
runs-on: ${{ matrix.config.os }}
name: "[${{ matrix.build_type }}] ${{ matrix.config.name }}"
strategy:
fail-fast: false
matrix:
build_type: [ "release", "debug" ]
build_type: ["release", "debug"]
config:
- name: "Windows Latest MSVC"
os: windows-latest
artifact: "amplitude_audio_sdk_windows_msvc_x64.7z"
archiver: "7z a"
target_triplet: x64-windows

- name: "Windows Latest MinGW"
os: windows-latest
artifact: "amplitude_audio_sdk_windows_mingw_x64.7z"
archiver: "7z a"
target_triplet: x64-mingw-static

- name: "Ubuntu Latest GCC"
os: ubuntu-latest
artifact: "amplitude_audio_sdk_linux_gcc_x64.7z"
archiver: "7z a"
target_triplet: x64-linux

- name: "macOS x64 Latest Clang"
os: macos-13
artifact: "amplitude_audio_sdk_macos_clang_x64.7z"
archiver: "7za a"
target_triplet: x64-osx

- name: "macOS arm64 Latest Clang"
os: macos-14
artifact: "amplitude_audio_sdk_macos_clang_arm64.7z"
archiver: "7za a"
target_triplet: arm64-osx

steps:
- name: Check out code
Expand All @@ -94,19 +94,23 @@ jobs:
with:
enableCrossOsArchive: true
path: sdk
key: ${{ matrix.build_type }}-${{ matrix.config.artifact }}-${{ hashFiles('**/sdk') }}
key: ${{ matrix.build_type }}-sdk-${{ matrix.config.target_triplet }}-${{ hashFiles('**/sdk') }}
restore-keys: |
${{ matrix.build_type }}-${{ matrix.config.artifact }}-
${{ matrix.build_type }}-sdk-${{ matrix.config.target_triplet }}-
- name: Pack
shell: bash
run: ${{ matrix.config.archiver }} ./${{ matrix.build_type }}_${{ matrix.config.artifact }} LICENSE NOTICE README.md sdk
run: ${{ matrix.config.archiver }} ./${{ matrix.build_type }}_sdk_${{ matrix.config.target_triplet }}.7z LICENSE NOTICE README.md sdk

- name: Upload
uses: actions/upload-artifact@v4
with:
path: ./${{ matrix.build_type }}_${{ matrix.config.artifact }}
name: ${{ matrix.build_type }}_${{ matrix.config.artifact }}
path: |
LICENSE
NOTICE
README.md
sdk/
name: ${{ matrix.build_type }}_sdk_${{ matrix.config.target_triplet }}

- name: Upload release asset
if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'created')
Expand All @@ -115,6 +119,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ matrix.build_type }}_${{ matrix.config.artifact }}
asset_name: ${{ matrix.build_type }}_${{ matrix.config.artifact }}.zip
asset_content_type: application/zip
asset_path: ./${{ matrix.build_type }}_sdk_${{ matrix.config.target_triplet }}.7z
asset_name: ${{ matrix.build_type }}_sdk_${{ matrix.config.target_triplet }}.7z
asset_content_type: application/x-7z-compressed
37 changes: 27 additions & 10 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ on:
project-slug:
required: true
type: string

pull-sdk:
required: false
type: boolean
default: false
sdk-version:
required: false
type: string
default: nightly

jobs:
build:
Expand All @@ -18,12 +25,11 @@ jobs:
strategy:
fail-fast: false
matrix:
build_type: [ "release", "debug" ]
build_type: ["release", "debug"]
config:
- name: "Windows Latest MSVC"
key: msvc
os: windows-latest
artifact: "${{ inputs.project-slug }}_windows_msvc_x64.7z"
cc: "cl"
cxx: "cl"
generator: "Visual Studio 17 2022"
Expand All @@ -32,7 +38,6 @@ jobs:
- name: "Windows Latest MinGW"
key: mingw
os: windows-latest
artifact: "${{ inputs.project-slug }}_windows_mingw_x64.7z"
cc: "gcc"
cxx: "g++"
generator: "Ninja"
Expand All @@ -41,7 +46,6 @@ jobs:
- name: "Ubuntu Latest GCC"
key: gcc
os: ubuntu-24.04
artifact: "${{ inputs.project-slug }}_linux_gcc_x64.7z"
cc: "gcc"
cxx: "g++"
generator: "Ninja"
Expand All @@ -50,7 +54,6 @@ jobs:
- name: "macOS x64 Latest Clang"
key: clang
os: macos-13
artifact: "${{ inputs.project-slug }}_macos_clang_x64.7z"
cc: "clang"
cxx: "clang++"
generator: "Ninja"
Expand All @@ -59,7 +62,6 @@ jobs:
- name: "macOS arm64 Latest Clang"
key: clang
os: macos-14
artifact: "${{ inputs.project-slug }}_macos_clang_arm64.7z"
cc: "clang"
cxx: "clang++"
generator: "Ninja"
Expand All @@ -71,6 +73,18 @@ jobs:
with:
submodules: recursive

- name: Setup Amplitude Audio SDK
uses: AmplitudeAudio/action-setup-sdk@main
if: inputs.pull-sdk
id: sdk_path
with:
platforms: |
${{ matrix.config.target_triplet }}
version: ${{ inputs.sdk-version }}
install-dir: "${{ github.workspace }}/amplitude_audio"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
Expand Down Expand Up @@ -142,9 +156,9 @@ jobs:
with:
enableCrossOsArchive: true
path: sdk
key: "${{ matrix.build_type }}-${{ matrix.config.artifact }}-${{ hashFiles('**/sdk') }}"
key: "${{ matrix.build_type }}-${{ inputs.project-slug }}-${{ matrix.config.target_triplet }}-${{ hashFiles('**/sdk') }}"
restore-keys: |
${{ matrix.build_type }}-${{ matrix.config.artifact }}-
${{ matrix.build_type }}-${{ inputs.project-slug }}-${{ matrix.config.target_triplet }}
- name: Configure
id: configure
Expand All @@ -161,6 +175,9 @@ jobs:
-DVCPKG_TARGET_TRIPLET:STRING="${{ matrix.config.target_triplet }}" \
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \
-DBUILD_SAMPLES:BOOL=TRUE
env:
AM_SDK_PATH: "${{ steps.sdk_path.outputs.path }}/sdk"
AM_SDK_PLATFORM: ${{ matrix.config.target_triplet }}

- name: Inspect vcpkg errors
if: failure() && steps.configure.outcome != 'success'
Expand Down Expand Up @@ -193,4 +210,4 @@ jobs:
with:
enableCrossOsArchive: true
path: sdk
key: ${{ matrix.build_type }}-${{ matrix.config.artifact }}-${{ hashFiles('**/sdk') }}
key: ${{ matrix.build_type }}-${{ inputs.project-slug }}-${{ matrix.config.target_triplet }}-${{ hashFiles('**/sdk') }}

0 comments on commit 15a9f80

Please sign in to comment.