-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
218 lines (207 loc) · 9.58 KB
/
action.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
name: 'setup-ci'
description: 'Sets up a toolchain on CI for building spatial-model-editor'
inputs:
sme_deps:
description: 'Set to a version or latest to download sme_deps'
required: false
default: 'skip'
sme_deps_common:
description: 'Set to a version or latest to download sme_deps_common'
required: false
default: 'skip'
sme_deps_qt:
description: 'Set to a version or latest to download sme_deps_qt'
required: false
default: 'skip'
sme_deps_llvm:
description: 'Set to a version or latest to download sme_deps_llvm'
required: false
default: 'skip'
cache_id:
description: 'A unique id for the cache - only needed if multiple jobs have the same name'
required: false
default: ''
runs:
using: "composite"
steps:
# LINUX
- if: (runner.os == 'Linux') && (runner.arch == 'X64')
shell: bash
env:
CCACHE_VERSION: '4.10.2'
run: |
# set X64 environment variables
echo "TARGET_TRIPLE=x86_64-unknown-linux-gnu" >> $GITHUB_ENV
echo "HOST_TRIPLE=x86_64-unknown-linux-gnu" >> $GITHUB_ENV
echo "OS=linux" >> $GITHUB_ENV
# get a recent version of ccache
wget https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz
tar -xf ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz
sudo cp ccache-${CCACHE_VERSION}-linux-x86_64/ccache /usr/bin/ccache
rm -rf ccache-${CCACHE_VERSION}-linux-x86_64
rm -f ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz
ccache --version
- if: (runner.os == 'Linux') && (runner.arch == 'ARM64')
shell: bash
env:
CCACHE_VERSION: '4.10.2'
run: |
# set ARM64 environment variables
echo "TARGET_TRIPLE=aarch64-unknown-linux-gnu" >> $GITHUB_ENV
echo "HOST_TRIPLE=aarch64-unknown-linux-gnu" >> $GITHUB_ENV
echo "OS=linux-arm64" >> $GITHUB_ENV
# get a recent version of ccache
wget https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.xz
tar -xf ccache-${CCACHE_VERSION}.tar.xz
cd ccache-${CCACHE_VERSION}/
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DHTTP_STORAGE_BACKEND=OFF -DENABLE_TESTING=OFF -DREDIS_STORAGE_BACKEND=OFF -GNinja ..
ninja
sudo ninja install
cd ../../
rm -rf ccache-${CCACHE_VERSION}
rm -f ccache-${CCACHE_VERSION}.tar.xz
ccache --version
- if: runner.os == 'Linux'
shell: bash
env:
CLANG_VERSION: '19'
run: |
# set environment variables
echo "INSTALL_PREFIX=/opt/smelibs" >> $GITHUB_ENV
echo "SUDO_CMD=sudo" >> $GITHUB_ENV
echo "PYTHON_EXE=/usr/bin/python3" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
# add llvm repo for clang
sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${CLANG_VERSION} main"
sudo apt update -yy
# install clang, ninja, qt build deps, and any extra dependencies
sudo apt install -yy clang-${CLANG_VERSION} llvm-${CLANG_VERSION} lld-${CLANG_VERSION} libclang-rt-${CLANG_VERSION}-dev libclang-dev ninja-build xvfb jwm lcov libglu1-mesa-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxkbcommon-dev libxkbcommon-x11-dev '^libxcb.*-dev' ${{ inputs.extra-deps }}
# set default clang version
sudo update-alternatives --remove-all clang || echo "nothing to remove"
sudo update-alternatives --remove-all clang++ || echo "nothing to remove"
sudo update-alternatives --remove-all llvm-cov || echo "nothing to remove"
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION} 100
sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${CLANG_VERSION} 100
clang++ --version
# disable system blas/lapack if present
sudo rm -rf /usr/lib/*-linux-gnu/libblas*
sudo rm -rf /usr/lib/*-linux-gnu/liblapack*
# set maximum ccache size to 400MB
ccache --max-size 400M
ccache --cleanup
ccache --zero-stats
ccache --show-stats
- if: runner.os == 'Linux'
uses: actions/cache@v4
with:
path: '~/.cache/ccache'
key: ccache-${{ github.job }}-${{ inputs.cache_id }}-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
restore-keys: ccache-${{ github.job }}-${{ inputs.cache_id }}-${{ runner.os }}-${{ runner.arch }}-
# MACOS
- if: runner.os == 'macOS'
shell: bash
run: |
# set environment variables
echo "INSTALL_PREFIX=/opt/smelibs" >> $GITHUB_ENV
echo "SUDO_CMD=sudo" >> $GITHUB_ENV
echo "PYTHON_EXE=/usr/bin/python3" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=12" >> $GITHUB_ENV
# install required tools and any extra dependencies
brew install ninja bison flex ccache ${{ inputs.extra-deps }}
# brew install location differs between macos-13 and macos-14 runners - just put both possiblities in PATH
echo "/opt/homebrew/opt/flex/bin:/opt/homebrew/opt/bison/bin:/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH" > $GITHUB_PATH
# set maximum ccache size to 400MB
ccache --max-size 400M
ccache --cleanup
ccache --zero-stats
ccache --show-stats
- if: (runner.os == 'macOS') && (runner.arch == 'X64')
shell: bash
run: |
# set X64 environment variables
echo "TARGET_TRIPLE=x86_64-apple-darwin16" >> $GITHUB_ENV
echo "HOST_TRIPLE=x86_64-apple-darwin16" >> $GITHUB_ENV
echo "OS=osx" >> $GITHUB_ENV
- if: (runner.os == 'macOS') && (runner.arch == 'ARM64')
shell: bash
run: |
# set ARM64 environment variables
echo "TARGET_TRIPLE=aarch64-apple-darwin20.1.0" >> $GITHUB_ENV
echo "HOST_TRIPLE=aarch64-apple-darwin20.1.0" >> $GITHUB_ENV
echo "OS=osx-arm64" >> $GITHUB_ENV
- if: (runner.os == 'macOS') && (runner.arch == 'X64')
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.2'
- if: (runner.os == 'macOS') && (runner.arch == 'ARM64')
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.1'
- if: runner.os == 'macOS'
uses: actions/cache@v4
with:
path: '/Users/runner/Library/Caches/ccache'
key: ccache-${{ github.job }}-${{ inputs.cache_id }}-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
restore-keys: ccache-${{ github.job }}-${{ inputs.cache_id }}-${{ runner.os }}-${{ runner.arch }}-
# WINDOWS
- if: runner.os == 'Windows'
shell: bash
run: |
# set environment variables
echo "INSTALL_PREFIX=/c/smelibs" >> $GITHUB_ENV
echo "SUDO_CMD=" >> $GITHUB_ENV
echo "TARGET_TRIPLE=x86_64-w64-windows-gnu" >> $GITHUB_ENV
echo "HOST_TRIPLE=x86_64-w64-mingw64" >> $GITHUB_ENV
echo "PYTHON_EXE=/ucrt64/bin/python" >> $GITHUB_ENV
echo "OS=win64-mingw" >> $GITHUB_ENV
- if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-python mingw-w64-ucrt-x86_64-python-pip mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-git-lfs make m4 git dos2unix diffutils flex bison unzip ${{ inputs.extra-deps }}
- if: runner.os == 'Windows'
env:
CCACHE_VERSION: '4.10.2'
shell: msys2 {0}
run: |
# get a recent version of ccache
wget https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-windows-x86_64.zip
unzip ccache-${CCACHE_VERSION}-windows-x86_64.zip
cp ccache-${CCACHE_VERSION}-windows-x86_64/ccache.exe /usr/bin/
rm -rf ccache-${CCACHE_VERSION}-windows-x86_64
rm -f ccache-${CCACHE_VERSION}-windows-x86_64.zip
ccache --version
# set maximum ccache size to 400MB
ccache --max-size 400M
ccache --cleanup
ccache --zero-stats
ccache --show-stats
- if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: 'C:\Users\runneradmin\AppData\Local\ccache'
key: ccache-${{ github.job }}-${{ inputs.cache_id }}-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
restore-keys: ccache-${{ github.job }}-${{ inputs.cache_id }}-${{ runner.os }}-${{ runner.arch }}-
- if: runner.os == 'Windows'
name: Install Mesa 3D to get OpenGL support on Windows without a GPU
uses: ssciwr/setup-mesa-dist-win@v2
with:
version: "24.3.2"
- if: runner.os != 'Windows'
uses: actions/setup-python@v5
with:
python-version: "3.12"
- if: runner.os != 'Windows'
shell: bash
working-directory: ${{ github.action_path }}
run: ./get-libs.sh ${{ inputs.sme_deps }} ${{ inputs.sme_deps_common }} ${{ inputs.sme_deps_qt }} ${{ inputs.sme_deps_llvm }}
- if: runner.os == 'Windows'
shell: msys2 {0}
working-directory: ${{ github.action_path }}
run: ./get-libs.sh ${{ inputs.sme_deps }} ${{ inputs.sme_deps_common }} ${{ inputs.sme_deps_qt }} ${{ inputs.sme_deps_llvm }}