-
Notifications
You must be signed in to change notification settings - Fork 12
218 lines (179 loc) · 6.76 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
name: CI
on:
push:
# Don't run this workflow when a tag is pushed.
branches:
- '*'
pull_request:
env:
BOOST_VERSION: 1.83.0
CARGO_TERM_COLOR: always
MSVC_CONFIG: RelWithDebInfo
jobs:
linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Get descriptive libloot version
id: get-libloot-version
shell: bash
run: |
GIT_DESCRIBE=$(git describe --tags --long --abbrev=7)
LIBLOOT_DESC_REF=${GIT_DESCRIBE}_${GITHUB_REF#refs/*/}
LIBLOOT_SAFE_DESC_REF=${LIBLOOT_DESC_REF//[\/<>\"|]/_}
echo "version=$LIBLOOT_SAFE_DESC_REF" >> $GITHUB_OUTPUT
- name: Download Boost
id: get-boost
run: |
BOOST_BASENAME=boost_${BOOST_VERSION//./_}
wget https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/${BOOST_BASENAME}.tar.gz
tar -xf ${BOOST_BASENAME}.tar.gz
echo "root=${BOOST_BASENAME}" >> $GITHUB_OUTPUT
- name: Get ICU
run: |
wget https://github.com/unicode-org/icu/releases/download/release-71-1/icu4c-71_1-Ubuntu20.04-x64.tgz
sudo tar -xf icu4c-71_1-Ubuntu20.04-x64.tgz -C /usr/local --strip-components=4
- name: Install APT package dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-upgrade \
doxygen \
language-pack-el \
language-pack-tr \
libtbb-dev \
g++-10
- name: Run CMake
run: |
mkdir build
cd build
export CXX="g++-10" CC="gcc-10"
cmake .. -DBOOST_ROOT="${{ steps.get-boost.outputs.root }}" -DCPACK_PACKAGE_VERSION="${{ steps.get-libloot-version.outputs.version }}"
make all
- name: Run tests
run: |
cd build
./libloot_internals_tests
./libloot_tests
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install packages for building docs
shell: bash
run: |
pip3 install --user -r docs/requirements.txt
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Build docs
run: sphinx-build -b html docs build/docs/html
- name: Build archive
id: build-archive
shell: bash
run: |
cd build
cpack
VERSION="${{ steps.get-libloot-version.outputs.version }}"
echo "filename=libloot-${VERSION}-Linux.tar.xz" >> $GITHUB_OUTPUT
- name: Import GPG key
run: echo -n "${{ secrets.GPG_SIGNING_KEY }}" | gpg --import
if: github.event_name == 'push'
- name: Sign archive
run: gpg --output "build/package/${{ steps.build-archive.outputs.filename }}.sig" --detach-sig "build/package/${{ steps.build-archive.outputs.filename }}"
if: github.event_name == 'push'
- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build-archive.outputs.filename }}
path: |
build/package/${{ steps.build-archive.outputs.filename }}
build/package/${{ steps.build-archive.outputs.filename }}.sig
if: github.event_name == 'push'
windows:
runs-on: windows-2019
strategy:
matrix:
platform: [Win32, x64]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust i686-pc-windows-msvc target
run: rustup target add i686-pc-windows-msvc
- name: Download Boost
id: get-boost
run: |
$BOOST_BASENAME="boost_" + $env:BOOST_VERSION -replace "\.", "_"
curl -sSfLO "https://boostorg.jfrog.io/artifactory/main/release/${env:BOOST_VERSION}/source/${BOOST_BASENAME}.7z"
7z x "${BOOST_BASENAME}.7z"
echo "root=$BOOST_BASENAME" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Get descriptive libloot version
id: get-libloot-version
shell: bash
run: |
GIT_DESCRIBE=$(git describe --tags --long --abbrev=7)
LIBLOOT_DESC_REF=${GIT_DESCRIBE}_${GITHUB_REF#refs/*/}
LIBLOOT_SAFE_DESC_REF=${LIBLOOT_DESC_REF//[\/<>\"|]/_}
echo "version=$LIBLOOT_SAFE_DESC_REF" >> $GITHUB_OUTPUT
- name: Run CMake
run: |
mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A ${{ matrix.platform }} -DBOOST_ROOT="${{ steps.get-boost.outputs.root }}" -DCPACK_PACKAGE_VERSION="${{ steps.get-libloot-version.outputs.version }}"
cmake --build . --config ${{ env.MSVC_CONFIG }}
- name: Run tests
run: |
cd build/${{ env.MSVC_CONFIG }}
.\libloot_internals_tests.exe
.\libloot_tests.exe
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install packages for building docs
run: |
nuget install doxygen -Version 1.8.14
echo "${{ github.workspace }}\Doxygen.1.8.14\tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
python -m pip install -r docs/requirements.txt
- name: Build docs
run: sphinx-build -b html docs build\docs\html
- name: Build archive
id: build-archive
shell: bash
run: |
cd build
cpack -C ${{ env.MSVC_CONFIG }}
VERSION="${{ steps.get-libloot-version.outputs.version }}"
if [[ "${{ matrix.platform }}" == "Win32" ]]
then
PLATFORM=win32
else
PLATFORM=win64
fi
echo "filename=libloot-${VERSION}-${PLATFORM}.7z" >> $GITHUB_OUTPUT
- name: Import GPG key
run: echo -n "${{ secrets.GPG_SIGNING_KEY }}" | gpg --import
if: github.event_name == 'push'
- name: Sign archive
run: gpg --output "build/package/${{ steps.build-archive.outputs.filename }}.sig" --detach-sig "build/package/${{ steps.build-archive.outputs.filename }}"
if: github.event_name == 'push'
- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build-archive.outputs.filename }}
path: |
build/package/${{ steps.build-archive.outputs.filename }}
build/package/${{ steps.build-archive.outputs.filename }}.sig
if: github.event_name == 'push'