Switch CI builds for Linux and Windows to Qt6 #1042
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: Build | |
on: | |
# Build on new commits, tags, or pull requests. | |
create: | |
push: | |
pull_request: | |
schedule: | |
# Run every week just to make sure the CI environment still works. | |
- cron: '0 0 * * 0' | |
jobs: | |
build-ubuntu: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Apt Dependencies | |
run: sudo apt update && sudo apt install ninja-build qt6-base-dev libglx-dev libgl1-mesa-dev qt6-tools-dev linguist-qt6 libboost-dev libboost-date-time-dev libboost-iostreams-dev nlohmann-json3-dev libasound2-dev librtmidi-dev libpugixml-dev libminizip-dev doctest-dev | |
- name: Create Build Directory | |
run: cmake -E make_directory ${{runner.workspace}}/build | |
- name: Generate Project | |
working-directory: ${{runner.workspace}}/build | |
# We could use the -S and -B options, but we only have CMake 3.12 here. | |
run: cmake ${GITHUB_WORKSPACE} -G Ninja -DCMAKE_TOOLCHAIN_FILE="${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" | |
- name: Build | |
run: ninja -C ${{runner.workspace}}/build | |
- name: Test | |
run: ${{runner.workspace}}/build/bin/pte_tests | |
build-osx: | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Version number | |
id: version | |
run: echo "::set-output name=VERSION_ID::$(git describe --tags --long --always)" | |
- name: Install Dependencies | |
# Note: remove existing Github actions python to work around conflicts (https://github.com/actions/setup-python/issues/577) | |
run: | | |
rm /usr/local/bin/2to3* | |
rm /usr/local/bin/idle3* | |
rm /usr/local/bin/pydoc3* | |
rm /usr/local/bin/python3* | |
brew install --overwrite boost cmake doctest minizip ninja nlohmann-json pugixml qt6 pugixml rtmidi | |
- name: Generate Project | |
run: cmake -S ${GITHUB_WORKSPACE} -B ${{runner.workspace}}/build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/opt/qt6/lib/cmake | |
- name: Build | |
run: cmake --build ${{runner.workspace}}/build | |
- name: Test | |
run: ${{runner.workspace}}/build/bin/pte_tests | |
# Skip building the installer for PRs, since code signing / notarizing requires access to the repo's secrets. | |
- name: Add Certificates to Keychain | |
if: github.event_name != 'pull_request' | |
uses: apple-actions/import-codesign-certs@v3 | |
with: | |
p12-file-base64: ${{ secrets.MAC_CERTS_BASE64 }} | |
p12-password: ${{ secrets.MAC_CERTS_PASSWORD }} | |
- name: Build Installer | |
if: github.event_name != 'pull_request' | |
env: | |
MAC_DEV_PASSWORD: ${{ secrets.MAC_DEV_PASSWORD }} | |
run: cmake --build ${{runner.workspace}}/build --target package | |
- name: Upload Installer | |
if: github.event_name != 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: powertabeditor-osx-${{ steps.version.outputs.VERSION_ID }}.dmg | |
path: ${{runner.workspace}}/build/powertabeditor-osx.dmg | |
if-no-files-found: error | |
build-windows: | |
runs-on: windows-2022 | |
# Run both 32-bit and 64-bit builds. | |
strategy: | |
matrix: | |
arch: [x64, x86] | |
include: | |
- arch: x64 | |
cmake_arch: x64 | |
qt_arch: win64_msvc2019_64 | |
- arch: x86 | |
cmake_arch: Win32 | |
qt_arch: win32_msvc2019 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Version number | |
id: version | |
run: echo "::set-output name=VERSION_ID::$(git describe --tags --long --always)" | |
- name: Install Dependencies | |
run: vcpkg install --triplet ${{ matrix.arch }}-windows boost-algorithm boost-date-time boost-endian boost-functional boost-iostreams boost-rational boost-signals2 boost-stacktrace doctest minizip nlohmann-json pugixml | |
# Building Qt via vcpkg would take a while ... | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
arch: ${{ matrix.qt_arch }} | |
version: 6.7.2 | |
- name: Generate Project | |
run: cmake -A ${{ matrix.cmake_arch }} -B ./build -DPTE_ENABLE_PCH=1 -DCMAKE_TOOLCHAIN_FILE="${env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" | |
- name: Build | |
run: cmake --build ./build --config Release | |
- name: Test | |
run: ./build/bin/pte_tests.exe | |
- name: Build Installer | |
run: | | |
choco install innosetup -y -v | |
iscc installer/windows/installer.iss | |
mv installer/windows/powertabeditor.exe installer/windows/powertabeditor-windows-${{ matrix.arch }}-${{ steps.version.outputs.VERSION_ID }}.exe | |
- name: Upload Installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: powertabeditor-windows-${{ matrix.arch }}-${{ steps.version.outputs.VERSION_ID }}.exe | |
path: installer/windows/powertabeditor-windows-${{ matrix.arch }}-${{ steps.version.outputs.VERSION_ID }}.exe | |
if-no-files-found: error |