Translated using Weblate (German) #320
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake Build | |
# Rules: Only run if there's a push to origin/main or a pull request to merge | |
# a branch into main. Any other branches will NOT be tested, so you must test | |
# them by yourself, but see #2 for details (this can (should) also be | |
# discussed there too). The only exception is for 'ci-fixes', having been | |
# dedicated for CI changes. | |
on: | |
push: | |
branches: | |
- main | |
- tenacity-* | |
- 1.3 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- name: Ubuntu | |
os: ubuntu-latest | |
arch: x86_64 # as reported by `arch` or `uname -m` | |
generator: Ninja | |
compiler_cache: ccache | |
compiler_cache_path: ~/.ccache | |
vcpkg_binary_cache: ~/.cache/vcpkg | |
vcpkg_triplet: x64-linux-dynamic | |
- name: macOS_Intel | |
os: macos-latest | |
arch: Intel # as reported by Apple menu > About This Mac | |
generator: Ninja | |
compiler_cache: ccache | |
compiler_cache_path: ~/Library/Caches/ccache | |
vcpkg_binary_cache: ~/.cache/vcpkg | |
vcpkg_triplet: x64-osx-dynamic | |
#- name: macOS_ARM | |
# os: macos-latest | |
# arch: aarch64 | |
# generator: Xcode | |
# Windows (x86) config | |
- name: Windows_32bit | |
os: windows-latest | |
arch: x86 | |
# FIXME: Ninja is broken on Windows, so use Visual Studio for now | |
generator: Visual Studio 17 2022 | |
# 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 | |
# Windows (x64) config | |
- name: Windows_64bit | |
os: windows-latest | |
arch: amd64 | |
# FIXME: Ninja is broken on Windows, so use Visual Studio for now | |
generator: Visual Studio 17 2022 | |
# 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.15 | |
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 }} | |
TENACITY_ARCH_LABEL: ${{ matrix.config.arch }} | |
steps: | |
- name: Checkout Git repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install dependencies | |
if: runner.os != 'Windows' | |
run: | | |
exec bash "scripts/ci/dependencies.sh" | |
- 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 | |
iex "& {$(iwr -useb get.scoop.sh)} -RunAsAdmin" | |
scoop install sccache | |
- 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@v4 | |
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@v3 | |
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 }}- | |
- name: "Set up compiler cache" | |
uses: actions/cache@v3 | |
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 "${{ matrix.config.generator }}" | |
-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 }} | |
- name: Build | |
run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} | |
- 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: | |
# VCPKG_LIB_PATH is the location that vcpkg stores its libs once built | |
VCPKG_LIB_PATH: ${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/debug/lib | |
- name: Upload package artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tenacity_${{ matrix.config.name }}_${{ github.run_id }}_${{ env.GIT_HASH_SHORT }} | |
path: | | |
build/package/* | |
!build/package/_CPack_Packages | |
if-no-files-found: error | |
- name: Upload artifact of vcpkg build logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: vcpkg-logs-${{ runner.os }} | |
path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log |