forked from TrenchBroom/TrenchBroom
-
Notifications
You must be signed in to change notification settings - Fork 7
225 lines (199 loc) · 8.14 KB
/
ci.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
on:
# Run on pushes to tags, the "master" branch, and PR's
push:
tags:
- '**'
branches:
- master
pull_request:
name: CI
jobs:
# Job key
ci:
# Label displayed in UI
name: CI
runs-on: ${{ matrix.os }}
strategy:
# Don't cancel the macOS build if the Linux build fails, etc.
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-11, windows-2019]
tb-build-type: [release]
tb-arch: [default-arch]
exclude:
- os: windows-2019
tb-arch: default-arch
include:
- os: macos-11
tb-build-type: asan
- os: windows-2019
tb-arch: x64
- os: windows-2019
tb-arch: Win32
env:
# Record pull request head commit SHA
TB_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
TB_OS_IMAGE: ${{ matrix.os }}
steps:
# See: https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
# Dependencies
- name: Install common Linux dependencies
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
run: |
sudo apt update
sudo apt install build-essential libxi-dev libxrandr-dev libxxf86vm-dev freeglut3-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libglm-dev pandoc cmake p7zip-full ninja-build xvfb libglew-dev libfreeimage-dev libfreetype6-dev libtinyxml2-dev libassimp-dev
- name: Install Qt5 on Ubuntu 22.04
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
sudo apt update
sudo apt install qtbase5-dev libqt5svg5-dev
- name: Install Qt5 on Ubuntu 20.04
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
sudo apt update
sudo apt install qt5-default libqt5svg5-dev
- name: Install Pandoc (Windows)
if: ${{ matrix.os == 'windows-2019' }}
run: |
# Chocolatey was taking 3 minutes to install pandoc; just install it directly
Invoke-WebRequest 'https://github.com/jgm/pandoc/releases/download/2.11.3.1/pandoc-2.11.3.1-windows-x86_64.zip' -OutFile 'pandoc.zip'
if ("668A62A8990DEB2753753DF0C8D3F1BE567026FE" -ne (Get-FileHash -Path 'pandoc.zip' -Algorithm SHA1).Hash) { exit }
7z x pandoc.zip -o'.'
$tb_pandoc_path = "$(pwd)\pandoc-2.11.3.1"
# Add this to the system path
echo "Pandoc path: $tb_pandoc_path"
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files
echo "$tb_pandoc_path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install Qt on Windows (x64)
if: ${{ matrix.os == 'windows-2019' && matrix.tb-arch == 'x64' }}
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
arch: 'win64_msvc2019_64'
- name: Install Qt on Windows (Win32)
if: ${{ matrix.os == 'windows-2019' && matrix.tb-arch == 'Win32' }}
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
arch: 'win32_msvc2019'
- name: Install macOS dependencies
if: ${{ matrix.os == 'macos-11' }}
run: |
brew install cmake p7zip pandoc qt5 ninja autoconf automake
# Restore from cache the previously built ports. If a "cache miss" occurs,
# then vcpkg is bootstrapped. Since a the vcpkg.json is being used later on
# to install the packages when `run-cmake` runs, no packages are installed at
# this time.
- name: Restore artifacts or setup vcpkg (do not install any package)
uses: lukka/run-vcpkg@v10
with:
# This is the default location of the directory containing vcpkg sources.
# Change it to the right location if needed.
# vcpkgDirectory: '${{ github.workspace }}/vcpkg'
# If not using a submodule for vcpkg sources, this specifies which commit
# id must be checkout from a Git repo. It must not set if using a submodule
# for vcpkg.
# vcpkgGitCommitId: '${{ matrix.vcpkgCommitId }}'
# This is the glob expression used to locate the vcpkg.json and add its
# hash to the cache key. Change it to match a single manifest file you want
# to use.
vcpkgJsonGlob: 'vcpkg.json'
# This is needed to run `vcpkg install` command (after vcpkg is built) in
# the directory where vcpkg.json has been located. Default is false,
# It is highly suggested to let `run-cmake` to run vcpkg (i.e. `false`)
# (i.e. let CMake run `vcpkg install`) using the vcpkg.cmake toolchain.
# runVcpkgInstall: 'true'
# Run build script
- name: Linux build
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
run: ./CI-linux.sh
- name: macOS build
if: ${{ matrix.os == 'macos-11' }}
run: |
if [ '${{ matrix.tb-build-type }}' = 'asan' ]; then
export TB_DEBUG_BUILD=true
fi
./CI-macos.sh
- name: Windows build
if: ${{ matrix.os == 'windows-2019' }}
# NOTE: docs at https://github.com/jurplel/install-qt-action
# mention that it sets a Qt5_DIR environment variable.
# Our script expects it in QT5_INSTALL_DIR
# NOTE: cmd.exe /c = run a command and terminate
run: |
$Env:QT5_INSTALL_DIR = $env:Qt5_DIR
cmd.exe /c CI-windows.bat
env:
TB_ARCH: ${{ matrix.tb-arch }}
# Upload artifacts.
# These need to be separate, otherwise all of the artifacts are bundled into
# one .zip file.
# win64
- name: Upload win64 artifact
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'windows-2019' && matrix.tb-arch == 'x64' }}
with:
name: win64
path: |
cmakebuild/*.7z
cmakebuild/*.7z.md5
# win32
- name: Upload win32 artifact
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'windows-2019' && matrix.tb-arch == 'Win32' }}
with:
name: win32
path: |
cmakebuild/*.7z
cmakebuild/*.7z.md5
# Linux
- name: Upload Linux artifacts
uses: actions/upload-artifact@v3
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
with:
name: linux
path: |
build/*.deb
build/*.md5
# macOS
- name: Upload macOS artifact
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'macos-11' && matrix.tb-build-type != 'asan' }}
with:
name: macos
path: |
build/*.dmg
build/*.md5
# Create release
# Official action upload-release-asset doesn't support uploading files
# based on a glob, so use https://github.com/softprops/action-gh-release
- name: Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.tb-build-type != 'asan' }}
with:
draft: true
files: |
build/*.deb
build/*.dmg
build/*.md5
cmakebuild/*.7z
cmakebuild/*.7z.md5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload compiled manual
uses: peaceiris/actions-gh-pages@v3
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04' }}
with:
# I've created a SSH key pair following https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-create-ssh-deploy-key
# The TrenchBroom/TrenchBroom repo has a repository secret ACTIONS_DEPLOY_KEY set to the SSH private key
# The TrenchBroom/manual repo has a deploy key set to the SSH public key
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: TrenchBroom/manual # Repo to deploy to
publish_branch: gh-pages # Branch to deploy to
publish_dir: ./build/app/gen-manual # Source directory tree
destination_dir: latest # Deploy to this directory in target repo