-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (85 loc) · 2.71 KB
/
build_and_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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/*