Skip to content

Commit

Permalink
fix(ci): Pull SDK from nightly builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
na2axl committed Oct 6, 2024
1 parent 8fef726 commit fedd2f5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 22 deletions.
44 changes: 25 additions & 19 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,49 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build:
needs: [ cleanup ]
needs: [cleanup]
uses: AmplitudeAudio/sdk/.github/workflows/cmake.yml@develop
with:
project-path: .
project-slug: plugin_flac
pull-sdk: true
sdk-version: nightly
need-flatc: false
name: Flac Codec

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: "plugin_flac_windows_msvc_x64.7z"
archiver: "7z a"
target_triplet: x64-windows

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

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

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

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

steps:
- name: Check out code
Expand All @@ -94,19 +97,22 @@ jobs:
with:
enableCrossOsArchive: true
path: sdk
key: ${{ matrix.build_type }}-${{ matrix.config.artifact }}-${{ hashFiles('**/sdk') }}
key: ${{ matrix.build_type }}-plugin_flac-${{ matrix.config.target_triplet }}-${{ hashFiles('**/sdk') }}
restore-keys: |
${{ matrix.build_type }}-${{ matrix.config.artifact }}-
${{ matrix.build_type }}-plugin_flac-${{ 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 }}_plugin_flac_${{ matrix.config.target_triplet }}.7z LICENSE 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
README.md
sdk/
name: ${{ matrix.build_type }}_plugin_flac_${{ 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 +121,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 }}_plugin_flac_${{ matrix.config.target_triplet }}.7z
asset_name: ${{ matrix.build_type }}_plugin_flac_${{ matrix.config.target_triplet }}.7z
asset_content_type: application/x-7z-compressed
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ cmake_minimum_required(VERSION 3.20)

cmake_policy(SET CMP0048 NEW)

list(APPEND CMAKE_MODULE_PATH "$ENV{AM_SDK_PATH}/cmake" "${AM_SDK_PATH}/cmake")
list(APPEND CMAKE_PREFIX_PATH "$ENV{AM_SDK_PATH}/cmake" "${AM_SDK_PATH}/cmake")
if(EXISTS $ENV{AM_SDK_PATH})
string(REPLACE "\\" "/" ENV_AM_SDK_PATH $ENV{AM_SDK_PATH})
list(APPEND CMAKE_MODULE_PATH "${ENV_AM_SDK_PATH}/cmake")
list(APPEND CMAKE_PREFIX_PATH "${ENV_AM_SDK_PATH}/cmake")
endif()

list(APPEND CMAKE_MODULE_PATH "${AM_SDK_PATH}/cmake")
list(APPEND CMAKE_PREFIX_PATH "${AM_SDK_PATH}/cmake")

project(AmplitudeFlacCodecPlugin)

set(CMAKE_CXX_STANDARD 20)
Expand Down Expand Up @@ -81,7 +87,11 @@ set(AM_INC_DESTINATION "include")

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${AM_LIB_DESTINATION}")

set(CMAKE_INSTALL_PREFIX ${AM_SDK_PATH})
if(NOT AM_BUILDSYSTEM_BUILDING_AMPLITUDE)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/sdk")
else()
set(CMAKE_INSTALL_PREFIX ${AM_SDK_PATH})
endif()

install(
TARGETS ${PROJECT_NAME}
Expand Down

0 comments on commit fedd2f5

Please sign in to comment.