You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

279 lines
10 KiB

name: CMake Build
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
# Matrix id format: {os}-{osname}-{osversion}-{arch}-{triplet}-{generator(_platform)}
# Replace - with _
# Remove .
config:
- name: Linux - Ubuntu 20.04 (x86_64) - Ninja
id: linux-ubuntu-2004-x86_64-x64_linux-ninja
os: ubuntu-20.04
arch: x86_64
vcpkg_triplet: x64-linux
- name: macOS - Big Sur 11 (Intel) - Ninja
id: macos-bigsur-1100-intel-x64_osx_1012min-ninja
os: macos-11
arch: Intel
vcpkg_triplet: x64-osx-10.12min
- name: macOS - Catalina 10.15 (Intel) - Ninja
id: macos-catalina-1015-intel-x64_osx_1012min-ninja
os: macos-10.15
arch: Intel
vcpkg_triplet: x64-osx-10.12min
- name: Windows - Server 2019 (amd64) - Ninja
id: windows-server-2019-amd64-x64_windows-ninja
os: windows-2019
arch: amd64
vcpkg_triplet: x64-windows
- name: Windows - Server 2019 (win32) - Ninja
id: windows-server-2019-x86-x86_windows-ninja
os: windows-2019
arch: x86
vcpkg_triplet: x86-windows
env:
AUDACITY_ARCH_LABEL: ${{ matrix.config.arch }}
MACOSX_DEPLOYMENT_TARGET: 10.12
# CMake settings
CMAKE_BUILD_TYPE: MinSizeRel
CMAKE_GENERATOR: Ninja
CMAKE_GENERATOR_PLATFORM: ${{matrix.config.CMAKE_GENERATOR_PLATFORM}}
# vcpkg settings
VCPKG_DISABLE_METRICS: true
VCPKG_DEFAULT_TRIPLET: ${{ matrix.config.vcpkg_triplet }}
NUGET_PACKAGES: ${{ github.workspace }}/vcpkg/packages/
# Apple codesigning
APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }}
APPLE_NOTARIZATION_USER_NAME: ${{ secrets.APPLE_NOTARIZATION_USER_NAME }}
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
# Windows codesigning
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
# WxWidgets info for Linux and macOS builds
WX_GIT_URL: https://github.com/wxWidgets/wxWidgets.git
WX_GIT_REF: v3.1.5
steps:
- name: Checkout Git repository
uses: actions/checkout@v2
with:
submodules: true
- name: Get Git commit of vcpkg submodule
run: echo VCPKG_COMMIT=$(git ls-tree HEAD vcpkg | awk '{print $3}') >> ${GITHUB_ENV}
- name: Setup platform specific environmental variables
run: |
if [[ "${{runner.os}}" == "Windows" ]]; then
echo "Using Windows specific env vars"
echo COMPILER_CACHE_PATH=C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache >> ${GITHUB_ENV}
echo COMPILER_CACHE=sccache >> ${GITHUB_ENV}
echo EXE_SUFFIX=.exe >> ${GITHUB_ENV}
echo VCPKG_CACHE_PATH=C:\Users\runneradmin\AppData\Local\vcpkg >> ${GITHUB_ENV}
echo CMAKE_C_COMPILER_LAUNCHER=sccache >> ${GITHUB_ENV}
echo CMAKE_CXX_COMPILER_LAUNCHER=sccache >> ${GITHUB_ENV}
if [[ "${{ env.CMAKE_GENERATOR }}" == "Ninja" ]]; then
echo CC=cl >> ${GITHUB_ENV}
echo CXX=cl >> ${GITHUB_ENV}
fi
else
echo "Using non-Windows env vars"
echo COMPILER_CACHE_PATH= ~/Library/Caches/ccache >> ${GITHUB_ENV}
echo COMPILER_CACHE=ccache >> ${GITHUB_ENV}
echo EXE_SUFFIX= >> ${GITHUB_ENV}
echo VCPKG_CACHE_PATH=~/.cache/vcpkg >> ${GITHUB_ENV}
echo CMAKE_C_COMPILER_LAUNCHER=ccache >> ${GITHUB_ENV}
echo CMAKE_CXX_COMPILER_LAUNCHER=ccache >> ${GITHUB_ENV}
if [[ "${{runner.os}}" == "Linux" ]]; then
echo WX_INSTALL_DIR=/home/runner/work/tenacity/tenacity/wxwidgets-install >> ${GITHUB_ENV}
echo WX_CONFIG=/home/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config >> ${GITHUB_ENV}
else
echo WX_INSTALL_DIR=/Users/runner/work/tenacity/tenacity/wxwidgets-install >> ${GITHUB_ENV}
echo WX_CONFIG=/Users/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config >> ${GITHUB_ENV}
fi
fi
- name: "[macOS] Install Apple codesigning certificates"
uses: apple-actions/import-codesign-certs@v1
if: startswith( matrix.config.os, 'macos' ) && github.repository_owner == 'tenacityteam' && github.event_name == 'create' && github.event.ref_type == 'tag'
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- name: "[Windows] Set up MSVC Developer Command Prompt"
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-vsdevenv@v3
with:
arch: ${{ matrix.config.arch }}
- name: Install Nuget
uses: nuget/setup-nuget@v1
with:
nuget-version: 5.10.0
- name: "Authenticate CI to Github Packages"
if: github.repository_owner == 'tenacityteam'
run: |
rm ./nuget.config
nuget sources add -Name tenacityteam_github_auto -Source https://nuget.pkg.github.com/tenacityteam/index.json -Username tenacityteam -Password ${{ secrets.GITHUB_TOKEN }} -StorePasswordInClearText -ForceEnglishOutput -NonInteractive
nuget setapikey ${{ secrets.GITHUB_TOKEN }} -Source tenacityteam_github_auto -ForceEnglishOutput -NonInteractive
if [[ ${{ github.event_name }} == 'push' ]]; then
echo "VCPKG_BINARY_SOURCES=clear;nuget,tenacityteam_github_auto,readwrite;" >> ${GITHUB_ENV}
else
echo "VCPKG_BINARY_SOURCES=clear;nuget,tenacityteam_github_auto,read;" >> ${GITHUB_ENV}
fi
- name: "[Linux] Install dependencies"
if: runner.os == 'Linux'
run: >-
sudo apt-get update &&
sudo apt-get install -y --no-install-recommends
file
g++
ninja-build
nasm
git
wget
bash
scdoc
ccache
debhelper-compat
gettext
libasound2-dev
libgtk-3-dev
libsuil-dev
gettext
- name: "[MacOS] Install dependencies"
if: runner.os == 'macOS'
run: >-
brew install
bash
ccache
ninja
nasm
- name: "[Windows] Install dependencies"
if: runner.os == 'Windows'
shell: pwsh
env:
# Install path of scoop
SCOOP: C:\Scoop\
run: |
echo "C:\Scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
iwr -useb get.scoop.sh | iex
scoop install sccache
# Cache the vcpkg cache and the vcpkg executable to avoid bootstrapping each time
- name: Setup vcpkg cache
uses: actions/cache@v2
with:
path: |
${{ github.workspace }}/vcpkg/vcpkg${{ env.EXE_SUFFIX }}
${{ env.VCPKG_CACHE_PATH }}
key: ${{ matrix.config.id }}-${{ hashFiles('**/vcpkg.json') }}-${{ env.VCPKG_COMMIT }}-${{ github.run_number }}
restore-keys: |
${{ matrix.config.id }}-${{ hashFiles(' **/vcpkg.json') }}-${{ env.VCPKG_COMMIT }}-
${{ matrix.config.id }}-${{ hashFiles(' **/vcpkg.json') }}-
${{ matrix.config.id }}-
- name: "[Linux/macOS] Set up wxWidgets cache"
uses: actions/cache@v2
id: wxwidgets-cache
if: runner.os != 'Windows'
with:
path: ${{ env.WX_INSTALL_DIR }}
key: ${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ env.WX_GIT_URL }}-${{ env.WX_GIT_REF }}
# FIXME: use wxWidgets from vcpkg for all OSes when bugs are fixed for Linux and macOS
# https://github.com/microsoft/vcpkg/pull/17111
- name: "[Linux/macOS] Build and install wxWidgets"
if: steps.wxwidgets-cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
run: |
# wxWidgets' build system does not find dependencies from vcpkg, so use its vendored Git submodules
git clone --recurse-submodules ${{ env.WX_GIT_URL }}
cd wxWidgets
git checkout ${{ env.WX_GIT_REF }}
cmake -S . -B cmake_build -D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -D CMAKE_INSTALL_PREFIX=${{ env.WX_INSTALL_DIR }}
cmake --build cmake_build
cmake --install cmake_build
- name: Set up compiler cache
uses: actions/cache@v2
with:
path: ${{ env.COMPILER_CACHE_PATH }}
key: ${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ github.head_ref }}-${{ github.run_number }}
restore-keys: |
${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ github.head_ref }}-
${{ matrix.config.os }}-${{ matrix.config.arch }}-
- name: Configure
run: cmake -B build -D VCPKG=ON -D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install
- name: Build
run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} --verbose
- name: Print compiler cache stats
run: ${{ env.COMPILER_CACHE}} -s
- name: Install
run: cmake --install build --config ${{ env.CMAKE_BUILD_TYPE }} --verbose
- name: Package
run: |
if [[ "${{runner.os}}" == "Windows" ]]; then
cmake --build build --target innosetup --config ${{ env.CMAKE_BUILD_TYPE }}
else
cd build
cpack -C ${{ env.CMAKE_BUILD_TYPE }} -D CPACK_COMMAND_HDIUTIL=${{ env.CPACK_COMMAND_HDIUTIL }} --verbose
rm -r package/_CPack_Packages
fi
env:
# Workaround for CPack hdiutil/ finder service race condition bug
CPACK_COMMAND_HDIUTIL: ${{ github.workspace }}/scripts/ci/macos/repeat_hdiutil.sh
# Required on Linux to find wxWidgets libraries installed without a package manager
WXWIDGETS_LD_LIBRARY_PATH: ${{ env.WX_INSTALL_DIR }}/lib
- name: Upload package artifact
uses: actions/upload-artifact@v2
with:
name: Tenacity_${{ matrix.config.id }}_${{ github.run_id }}_${{ env.GIT_HASH_SHORT }}
path: build/package/*
if-no-files-found: error
- name: Upload artifact of vcpkg build logs
uses: actions/upload-artifact@v2
if: always()
with:
name: vcpkg-logs-${{ runner.os }}
path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log
if-no-files-found: ignore