Tidy up globals #60
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 | |
on: | |
push: | |
branches: [ "main" ] | |
tags: "v*" | |
pull_request: | |
branches: [ "main" ] | |
tags: "v*" | |
workflow_dispatch: | |
branches: [ "main" ] | |
tags: "v*" | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
CPM_SOURCE_CACHE: ${{github.workspace}}/cache/cpm | |
QT_QPA_PLATFORM: offscreen | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
name: "macos-arm64" | |
qtarch: "clang_64" | |
- os: windows-latest | |
name: "windows-x86_64" | |
qtarch: "win64_msvc2019_64" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Cache CPM Dependencies and build dir | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{env.CPM_SOURCE_CACHE}} | |
key: crystalexplorer-cache-${{ matrix.name }} | |
- name: Install Qt | |
uses: jurplel/[email protected] | |
with: | |
version: 6.7.2 | |
cache: true | |
arch: ${{ matrix.qtarch }} | |
- uses: TheMrMilchmann/setup-msvc-dev@v3 | |
if: runner.os == 'Windows' | |
with: | |
arch: x64 | |
- name: Configure CMake (Windows) | |
run: cmake --preset ${{ matrix.name }} | |
- name: Build | |
run: cmake --build --preset ${{ matrix.name }} | |
- name: Package with CPack | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: | | |
cpack | tee cpack_output.txt | |
PACKAGE_FILE=$(grep -oE 'CPack: - package: .+ generated\.' cpack_output.txt | sed 's/CPack: - package: \(.*\) generated\./\1/') | |
echo "PACKAGE_NAME=${PACKAGE_FILE}" >> $GITHUB_ENV | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: crystalexplorer-binaries-${{ matrix.name }} | |
path: ${{env.PACKAGE_NAME}} | |
overwrite: true | |
create-release: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: binaries | |
pattern: crystalexplorer-binaries-* | |
merge-multiple: true | |
- name: Make GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
binaries/* |