1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 15:19:44 +02:00
audacity/.github/workflows/cmake_build.yml
2021-08-16 13:22:02 -05:00

224 lines
8.2 KiB
YAML

name: CMake Build
on:
push:
branches:
- master
pull_request:
defaults:
run:
shell: bash
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: Ubuntu_20.04
os: ubuntu-20.04
arch: x86_64 # as reported by `arch` or `uname -m`
compiler_cache: ccache
compiler_cache_path: ~/.ccache
vcpkg_binary_cache: ~/.cache/vcpkg
vcpkg_triplet: x64-linux
wxwidgets_git_url: https://github.com/wxWidgets/wxWidgets.git
wxwidgets_git_ref: v3.1.5
WX_CONFIG: /home/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config
- name: macOS_Intel
os: macos-latest
arch: Intel # as reported by Apple menu > About This Mac
compiler_cache: ccache
compiler_cache_path: ~/Library/Caches/ccache
vcpkg_binary_cache: ~/.cache/vcpkg
vcpkg_triplet: x64-osx-10.12min
wxwidgets_git_url: https://github.com/wxWidgets/wxWidgets.git
wxwidgets_git_ref: v3.1.5
WX_CONFIG: /Users/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config
- name: Windows_32bit
os: windows-latest
arch: x86
# required so CMake uses MSVC rather than MinGW
cc: cl
cxx: cl
compiler_cache: sccache
compiler_cache_path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache
vcpkg_binary_cache: C:\Users\runneradmin\AppData\Local\vcpkg
vcpkg_triplet: x86-windows
exe_suffix: .exe
- name: Windows_64bit
os: windows-latest
arch: amd64
# required so CMake uses MSVC rather than MinGW
cc: cl
cxx: cl
compiler_cache: sccache
compiler_cache_path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache
vcpkg_binary_cache: C:\Users\runneradmin\AppData\Local\vcpkg
vcpkg_triplet: x64-windows
exe_suffix: .exe
env:
CMAKE_BUILD_TYPE: RelWithDebInfo
CMAKE_C_COMPILER_LAUNCHER: ${{ matrix.config.os.compiler_cache }}
CMAKE_CXX_COMPILER_LAUNCHER: ${{ matrix.config.os.compiler_cache }}
MACOSX_DEPLOYMENT_TARGET: 10.12
VCPKG_DISABLE_METRICS: true
VCPKG_DEFAULT_TRIPLET: ${{ matrix.config.vcpkg_triplet }}
# Windows codesigning
# This variables will be used by all the steps
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
AUDACITY_ARCH_LABEL: ${{ matrix.config.arch }}
steps:
- name: Checkout Git repository
uses: actions/checkout@v2
with:
submodules: true
- name: Install dependencies
run: |
exec bash "scripts/ci/dependencies.sh"
- name: Install Apple codesigning certificates
uses: apple-actions/import-codesign-certs@v1
if: startswith( matrix.config.os, 'macos' ) && github.event_name == 'push' && github.repository_owner == 'audacity'
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
# required for CMake to find Ninja
- name: "[Windows] Set up MSVC Developer Command Prompt"
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-vsdevenv@v3
with:
arch: ${{ matrix.config.arch }}
- name: Get Git commit of vcpkg submodule
run: echo VCPKG_COMMIT=$(git ls-tree HEAD vcpkg | awk '{print $3}') >> ${GITHUB_ENV}
- name: Setup vcpkg cache
uses: actions/cache@v2
with:
# cache the vcpkg executable to avoid having to bootstrap vcpkg every time
path: |
${{ github.workspace }}/vcpkg/vcpkg${{ matrix.config.exe_suffix }}
${{ matrix.config.vcpkg_binary_cache }}
key: ${{ matrix.config.name }}-${{ hashFiles('**/vcpkg.json') }}-${{ env.VCPKG_COMMIT }}-${{ github.run_number }}
restore-keys: |
${{ matrix.config.name }}-${{ hashFiles(' **/vcpkg.json') }}-${{ env.VCPKG_COMMIT }}-
${{ matrix.config.name }}-${{ hashFiles(' **/vcpkg.json') }}-
${{ matrix.config.name }}-
# FIXME: hack around bad SSL certificate, needed to build ffmpeg
# https://github.com/microsoft/vcpkg/issues/19121
- name: "[Windows] Install yasm"
if: runner.os == 'Windows'
run: |
mkdir -p "vcpkg/downloads/tools/yasm/1.3.0.6"
curl -k -o "vcpkg/downloads/tools/yasm/1.3.0.6/yasm.exe" \
"http://www.tortall.net/projects/yasm/snapshots/v1.3.0.6.g1962/yasm-1.3.0.6.g1962.exe"
- name: "Set up wxwidgets cache"
uses: actions/cache@v2
id: wxwidgets-cache
if: runner.os != 'Windows'
with:
path: ${{ github.workspace }}/wxwidgets-install
key: ${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ matrix.config.wxwidgets_git_url }}-${{ matrix.config.wxwidgets_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: 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 ${{ matrix.config.wxwidgets_git_url }}
cd wxWidgets
git checkout ${{ matrix.config.wxwidgets_git_ref }}
cmake -G Ninja -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/wxwidgets-install \
-S . -B cmake_build
cmake --build cmake_build
cmake --install cmake_build
- name: "Set up compiler cache"
uses: actions/cache@v2
with:
path: ${{ matrix.config.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
-G Ninja
-D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }}
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install
-D VCPKG=ON
-S .
-B build
env:
# Apple code signing
APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }}
APPLE_NOTARIZATION_USER_NAME: ${{ secrets.APPLE_NOTARIZATION_USER_NAME }}
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
# hack to get CMake to find wxWidgets until vcpkg wxWidgets port is fixed
# https://github.com/microsoft/vcpkg/pull/17111
WX_CONFIG: ${{ matrix.config.WX_CONFIG }}
- name: Build
run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} --verbose
- name: "Print compiler cache stats"
run: ${{ matrix.config.compiler_cache }} -s
- name: Install
run: cmake --install build --config ${{ env.CMAKE_BUILD_TYPE }} --verbose
- name: "[Windows] Package"
if: runner.os == 'Windows'
run: cmake --build build --target innosetup --config ${{ env.CMAKE_BUILD_TYPE }}
- name: "[Ubuntu/macOS] Package"
if: runner.os != 'Windows'
working-directory: build
run: >-
cpack
-C ${{ env.CMAKE_BUILD_TYPE }}
-D CPACK_COMMAND_HDIUTIL=${{ github.workspace }}/scripts/ci/macos/repeat_hdiutil.sh
--verbose
&& rm -r package/_CPack_Packages
env:
# Required for linuxdeploy to find wxWidgets libraries installed without a package manager
WXWIDGETS_LD_LIBRARY_PATH: ${{ github.workspace }}/wxwidgets-install/lib
- name: Upload package artifact
uses: actions/upload-artifact@v2
with:
name: Tenacity_${{ matrix.config.name }}_${{ github.run_id }}_${{ env.GIT_HASH_SHORT }}
path: build/package/*
if-no-files-found: error
- name: Upload artifact of vcpkg build logs
if: always()
uses: actions/upload-artifact@v2
with:
name: vcpkg-logs-${{ runner.os }}
path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log