Issue #599: Selected marchers on field don't match animation (#604) #568
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
# much of this inspired from: https://cristianadam.eu/20191222/using-github-actions-with-c-plus-plus-and-cmake/ | |
# and also the excellent series from: | |
# https://www.edwardthomson.com/blog/github_actions_advent_calendar.html | |
name: CI action for CalChart | |
on: | |
push: | |
branches: | |
- main | |
- calchart-3.6 | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
- calchart-3.6 | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Ubuntu Latest GCC", | |
artifact: "CalChart.tar.xz", | |
artifact_name: "CalChart-Linux", | |
os: ubuntu-24.04, | |
} | |
- { | |
name: "macOS 14 Clang", | |
artifact: "CalChart-*.dmg", | |
artifact_name: "CalChart-macOS", | |
os: macos-14, | |
} | |
- { | |
name: "Windows Latest MSVC", | |
artifact: "CalChart-*.exe", | |
artifact_name: "CalChart-Windows", | |
os: windows-latest, | |
} | |
build_type: [Debug, Release] | |
exclude: | |
- config: { | |
name: "Windows Latest MSVC", | |
artifact: "CalChart-*.exe", | |
artifact_name: "CalChart-Windows", | |
os: windows-latest, | |
} | |
build_type: Debug | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Checkout unshallow | |
run: git fetch --unshallow | |
- name: Checkout submodules | |
run: git submodule update --init --recursive | |
- name: Installing Xcode (MacOS) | |
if: matrix.config.os == 'macos-14' | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '15.4' | |
- name: Installing Dependencies (Windows) | |
if: matrix.config.os == 'windows-latest' | |
run: choco install winflexbison | |
- name: Installing Dependencies (Linux) | |
if: matrix.config.os == 'ubuntu-24.04' | |
run: sudo apt-get update && sudo apt-get install build-essential libgtk-3-dev | |
- name: Updating to gcc 14 (Linux) | |
if: matrix.config.os == 'ubuntu-24.04' | |
run: | | |
sudo apt update | |
sudo apt install gcc-14 g++-14 | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 --slave /usr/bin/g++ g++ /usr/bin/g++-14 --slave /usr/bin/gcov gcov /usr/bin/gcov-14 | |
sudo update-alternatives --set gcc /usr/bin/gcc-14 | |
- name: Configure CMake | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} | |
# Codesigning for mac involves: | |
# 1. Creating a signing cert in p12 form (https://help.apple.com/xcode/mac/current/#/dev154b28f09) | |
# 2. Uploading the p12 as github secrets (https://docs.github.com/en/actions/use-cases-and-examples/deploying/installing-an-apple-certificate-on-macos-runners-for-xcode-development) | |
# 3. Generating the p12 file on the github action server | |
# 4. using indygreg/apple-code-sign-action@v1 to sign the app | |
- name: Gen p12 (macOS) | |
if: matrix.config.os == 'macos-14' | |
env: | |
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} | |
run: echo $MACOS_CERTIFICATE | base64 --decode > ${{github.workspace}}/certificate.p12 | |
- name: Codesign (macOS) | |
if: matrix.config.os == 'macos-14' | |
uses: indygreg/apple-code-sign-action@v1 | |
with: | |
input_path: ${{github.workspace}}/build/src/CalChart.app | |
p12_file: ${{github.workspace}}/certificate.p12 | |
p12_password: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} | |
- name: Run tests | |
run: ctest --verbose --test-dir ${{github.workspace}}/build | |
- name: Pack (macOS) | |
if: matrix.config.os == 'macos-14' | |
run: pushd ${{github.workspace}}/build && cpack -G DragNDrop | |
- name: Pack (Windows) | |
if: matrix.config.os == 'windows-latest' | |
# it seems that the cmake command provided by chocolatey conflicts with cmake. | |
# explicitly running cpack from the cmake directory. | |
run: | | |
$cmdpath = split-path -parent (get-command cmake).Path | |
$cpack_cmd = Join-Path -Path $cmdpath -ChildPath cpack | |
pushd ${{github.workspace}}/build | |
& $cpack_cmd | |
- name: Strip (Linux) | |
if: matrix.config.os == 'ubuntu-24.04' | |
run: cmake --install build --prefix instdir --strip | |
- name: Pack (Linux) | |
if: matrix.config.os == 'ubuntu-24.04' | |
working-directory: instdir | |
run: cmake -E tar cJfv ${{github.workspace}}/build/CalChart.tar.xz . | |
- name: Upload | |
if: matrix.build_type == 'Release' | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{github.workspace}}/build/${{ matrix.config.artifact }} | |
name: ${{ matrix.config.artifact_name }} | |
release: | |
if: contains(github.ref, 'tags/v') | |
name: Release | |
runs-on: ubuntu-24.04 | |
needs: build | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./ | |
- name: Display structure of downloaded files | |
run: ls -R | |
# using https://github.com/ncipollo/release-action | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: CalChart-*/* | |
bodyFile: ./LATEST_RELEASE_NOTES.md | |
draft: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |