Skip to content

fix(build): Build samples when generating SDK binaries. #118

fix(build): Build samples when generating SDK binaries.

fix(build): Build samples when generating SDK binaries. #118

Workflow file for this run

name: Build
on:
push:
pull_request:
release:
tags:
- "v*"
jobs:
build:
name: "[${{ matrix.build_type }}] ${{ matrix.config.name }}"
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
build_type: [ "release", "debug" ]
config:
- name: "Windows Latest MSVC"
os: windows-latest
artifact: "amplitude_audio_sdk_windows_msvc_x64.7z"
cc: "cl"
cxx: "cl"
archiver: "7z a"
generator: "Visual Studio 17 2022"
target_triplet: x64-windows
- name: "Windows Latest MinGW"
os: windows-latest
artifact: "amplitude_audio_sdk_windows_mingw_x64.7z"
cc: "gcc"
cxx: "g++"
archiver: "7z a"
generator: "Ninja"
target_triplet: x64-windows
- name: "Ubuntu_Latest_GCC"
os: ubuntu-latest
artifact: "amplitude_audio_sdk_linux_gcc_x64.7z"
cc: "gcc"
cxx: "g++"
archiver: "7z a"
generator: "Ninja"
target_triplet: x64-linux
- name: "Ubuntu_GCC_9"
os: ubuntu-latest
artifact: "amplitude_audio_sdk_linux_gcc9_x64.7z"
cc: "gcc"
cxx: "g++"
archiver: "7z a"
generator: "Ninja"
target_triplet: x64-linux
- name: "macOS Latest Clang"
os: macos-latest
artifact: "amplitude_audio_sdk_macos_clang_x64.7z"
cc: "clang"
cxx: "clang++"
archiver: "7za a"
generator: "Ninja"
target_triplet: x64-osx
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- name: Setup vcpkg
uses: lukka/[email protected]
with:
runVcpkgInstall: true
vcpkgGitCommitId: 9f03078bdcbab3ad8c1e3927c40c3fb48e42501f
- name: Find flatc version
if: startsWith(matrix.config.os, 'ubuntu') || startsWith(matrix.config.os, 'macos')
id: flatc_version
uses: tdemin/find-latest-tag@v1
with:
repo: https://github.com/google/flatbuffers.git
- name: Install dependencies on Windows
if: startsWith(matrix.config.os, 'windows')
run: |
choco install ninja cmake curl
choco upgrade mingw
ninja --version
cmake --version
$FLATC_VERSION = "$(curl "https://api.github.com/repos/google/flatbuffers/releases/latest" --ssl-no-revoke --silent | Select-String -Pattern '"tag_name":\s*"(.+)"')" -replace '.*"v(.+)".*','$1'
echo "flatc download latest v$FLATC_VERSION version"
iwr -Uri https://github.com/google/flatbuffers/releases/download/v$FLATC_VERSION/Windows.flatc.binary.zip -OutFile flatc.zip
mkdir bin
Expand-Archive -Force flatc.zip .\bin\
.\bin\flatc --version
- name: Install dependencies on Ubuntu
if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC')
run: |
sudo apt-get update
sudo apt-get install ninja-build cmake
ninja --version
cmake --version
gcc --version
wget https://github.com/google/flatbuffers/releases/download/${{ steps.flatc_version.outputs.tag }}/Linux.flatc.binary.g++-10.zip
mkdir bin
sudo unzip Linux.flatc.binary.g++-10.zip -d bin
./bin/flatc --version
- name: Install dependencies on Ubuntu (GCC9)
if: startsWith(matrix.config.name, 'Ubuntu_GCC_9')
run: |
echo Update gcc-9 =======================================================================
echo gcc version before
gcc --version
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install ninja-build cmake gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
echo gcc version after
gcc --version
echo Update ninja =======================================================================
echo ninja version before
ninja --version
# wget https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip
wget https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip
sudo unzip ninja-linux.zip -d /usr/local/bin/
sudo update-alternatives --install /usr/bin/ninja ninja /usr/local/bin/ninja 1 --force
echo ninja version after
ninja --version
echo Update cmake =======================================================================
echo cmake version before
cmake --version
# curl --silent "https://api.github.com/repos/Kitware/CMake/releases/latest" | sed -n 's/.*tag_name":\s"\(.*\)".*/\1/p' | head -2
# wget https://github.com/Kitware/CMake/releases/latest/download/cmake-3.16.5-Linux-x86_64.sh
cmake_version=$(curl --silent "https://api.github.com/repos/Kitware/CMake/releases/latest" | sed -n 's/.*tag_name":\s"\(.*\)".*/\1/p' | head -2 | cut -c 2-)
echo cmake download latest v$cmake_version version
wget https://github.com/Kitware/CMake/releases/download/v$cmake_version/cmake-$cmake_version-Linux-x86_64.sh
chmod +x cmake-$cmake_version-Linux-x86_64.sh
sudo mkdir /opt/cmake
sudo ./cmake-$cmake_version-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
sudo update-alternatives --install /usr/bin/cmake cmake /opt/cmake/bin/cmake 1 --force
echo cmake version after
cmake --version
wget https://github.com/google/flatbuffers/releases/download/${{ steps.flatc_version.outputs.tag }}/Linux.flatc.binary.g++-10.zip
mkdir bin
sudo unzip Linux.flatc.binary.g++-10.zip -d bin
./bin/flatc --version
- name: Install dependencies on MacOS
if: startsWith(matrix.config.os, 'macos')
run: |
brew install p7zip cmake ninja
ninja --version
cmake --version
wget https://github.com/google/flatbuffers/releases/download/${{ steps.flatc_version.outputs.tag }}/Mac.flatc.binary.zip
mkdir bin
sudo unzip Mac.flatc.binary.zip -d bin
./bin/flatc --version
- name: Configure
shell: bash
run: |
mkdir build
cmake \
-S . \
-B build \
-G "${{ matrix.config.generator }}" \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_TOOLCHAIN_FILE:STRING="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET:STRING="${{ matrix.config.target_triplet }}" \
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \
-DBUILD_SAMPLES:BOOL=TRUE
- name: Build
shell: bash
working-directory: build
run: cmake --build . --config ${{ matrix.build_type }}
- name: Install Strip
shell: bash
working-directory: build
run: cmake --install . --strip --config ${{ matrix.build_type }}
- name: Pack
shell: bash
run: ${{ matrix.config.archiver }} ./${{ matrix.build_type }}_${{ matrix.config.artifact }} LICENSE README.md sdk
- name: Upload
uses: actions/upload-artifact@v1
with:
path: ./${{ matrix.build_type }}_${{ matrix.config.artifact }}
name: ${{ matrix.build_type }}_${{ matrix.config.artifact }}
- name: Upload release asset
if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'created')
uses: actions/upload-release-asset@v1
env:
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