-
Notifications
You must be signed in to change notification settings - Fork 2
224 lines (191 loc) · 8.13 KB
/
Copy pathrelease.yml
File metadata and controls
224 lines (191 loc) · 8.13 KB
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
# Linux release packaging for tagged CargoNetSim releases.
#
# Windows and macOS installers are intentionally deferred until their signing,
# notarization, and platform deployment requirements are settled.
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
env:
BUILD_TYPE: Release
CONTAINER_REF: v0.2.0
KDREPORTS_REF: kdreports-2.3.0
DEPS_PREFIX: ${{ github.workspace }}/deps/install
CMAKE_BUILD_PARALLEL_LEVEL: 2
CMAKE_CXX_COMPILER_LAUNCHER: ccache
jobs:
linux-installer:
name: Linux Installer
runs-on: ubuntu-24.04
steps:
- name: Check out CargoNetSim
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check Container token
env:
CONTAINER_REPO_TOKEN: ${{ secrets.CONTAINER_REPO_TOKEN }}
run: |
if [ -z "${CONTAINER_REPO_TOKEN}" ]; then
echo "::error::CONTAINER_REPO_TOKEN is required to check out the private Container dependency."
exit 1
fi
- name: Check out Container
uses: actions/checkout@v4
with:
repository: AhmedAredah/container
token: ${{ secrets.CONTAINER_REPO_TOKEN }}
ref: ${{ env.CONTAINER_REF }}
path: deps/container
- name: Check out KDReports
uses: actions/checkout@v4
with:
repository: KDAB/KDReports
ref: ${{ env.KDREPORTS_REF }}
path: deps/kdreports
- name: Install build dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: cmake qt6-base-dev qt6-tools-dev libyaml-cpp-dev librabbitmq-dev build-essential ninja-build ccache python3-venv p7zip-full file
version: 1.0
- name: Install Qt Installer Framework
run: |
python3 -m venv "${RUNNER_TEMP}/aqt"
"${RUNNER_TEMP}/aqt/bin/python" -m pip install --upgrade pip
"${RUNNER_TEMP}/aqt/bin/python" -m pip install "aqtinstall==3.3.0"
"${RUNNER_TEMP}/aqt/bin/python" -m aqt install-tool \
-O "${RUNNER_TEMP}/Qt" \
linux desktop tools_ifw
ifw_root="$(find "${RUNNER_TEMP}/Qt/Tools/QtInstallerFramework" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -n 1)"
if [ -z "${ifw_root}" ] || [ ! -x "${ifw_root}/bin/binarycreator" ]; then
echo "::error::Qt Installer Framework binarycreator was not installed."
exit 1
fi
echo "QTIFW_ROOT=${ifw_root}" >> "${GITHUB_ENV}"
echo "${ifw_root}/bin" >> "${GITHUB_PATH}"
echo "Using Qt Installer Framework at ${ifw_root}"
- name: Prepare RabbitMQ-C include compatibility
run: |
mkdir -p "${DEPS_PREFIX}/include/rabbitmq-c"
for header in /usr/include/amqp*.h; do
ln -sf "${header}" "${DEPS_PREFIX}/include/rabbitmq-c/$(basename "${header}")"
done
ln -sf /usr/include/amqp_tcp_socket.h "${DEPS_PREFIX}/include/rabbitmq-c/tcp_socket.h"
- name: Cache compiler output
uses: actions/cache@v4
with:
path: ~/.ccache
key: ${{ runner.os }}-release-ccache-${{ env.CONTAINER_REF }}-${{ env.KDREPORTS_REF }}-${{ hashFiles('CMakeLists.txt', 'cmake/**', 'src/installer/**') }}
restore-keys: |
${{ runner.os }}-release-ccache-
- name: Configure Container
run: |
cmake -S deps/container -B deps/build/container -G Ninja \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DCMAKE_INSTALL_PREFIX="${DEPS_PREFIX}" \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_PYTHON_BINDINGS=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_DOCS=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER="${CMAKE_CXX_COMPILER_LAUNCHER}"
- name: Install Container
run: cmake --build deps/build/container --target install
- name: Configure KDReports
run: |
cmake -S deps/kdreports -B deps/build/kdreports -G Ninja \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DCMAKE_INSTALL_PREFIX="${DEPS_PREFIX}" \
-DKDReports_QT6=ON \
-DKDReports_TESTS=OFF \
-DKDReports_EXAMPLES=OFF \
-DKDReports_DOCS=OFF \
-DKDReports_PYTHON_BINDINGS=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER="${CMAKE_CXX_COMPILER_LAUNCHER}"
- name: Install KDReports
run: cmake --build deps/build/kdreports --target install
- name: Patch KDReports Qt6 package config
run: |
config_file="${DEPS_PREFIX}/lib/cmake/KDReports-qt6/KDReports-qt6Config.cmake"
sed -i \
-e 's/find_dependency(QtCore /find_dependency(Qt6Core /' \
-e 's/find_dependency(QtWidgets /find_dependency(Qt6Widgets /' \
-e 's/find_dependency(QtPrintSupport /find_dependency(Qt6PrintSupport /' \
-e 's/find_dependency(QtXml /find_dependency(Qt6Xml /' \
"${config_file}"
- name: Configure CargoNetSim with installer
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/install" \
-DCMAKE_PREFIX_PATH="${DEPS_PREFIX};/usr" \
-DCONTAINER_CMAKE_DIR="${DEPS_PREFIX}/lib/cmake/Container" \
-DKDREPORTS_DIR="${DEPS_PREFIX}/lib/cmake/KDReports-qt6" \
-DRABBITMQ_CMAKE_DIR="/usr/lib/x86_64-linux-gnu/cmake/rabbitmq-c" \
-DYAMLCPP_CMAKE_DIR="/usr/lib/x86_64-linux-gnu/cmake/yaml-cpp" \
-DCPACK_IFW_ROOT="${QTIFW_ROOT}" \
-DCARGONET_BUILD_TESTS=OFF \
-DCARGONET_BUILD_INSTALLER=ON \
-DCARGONET_BUILD_RABBITMQ_CONFIG=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER="${CMAKE_CXX_COMPILER_LAUNCHER}"
- name: Build CargoNetSim
run: cmake --build build
- name: Install CargoNetSim
run: cmake --build build --target install
- name: Generate Linux installer
env:
QT_QPA_PLATFORM: offscreen
working-directory: build
run: cpack -G IFW -C Release
- name: Collect release assets
run: |
mkdir -p dist
ref_name="${GITHUB_REF_NAME//\//-}"
installer="$(find build -maxdepth 1 -type f -name 'CargoNetSim*.run' | sort | head -n 1)"
if [ -z "${installer}" ]; then
echo "::error::No Linux installer .run file was produced by CPack."
find build -maxdepth 2 -type f | sort
exit 1
fi
installer_name="CargoNetSim-${ref_name}-linux-x86_64.run"
cp "${installer}" "dist/${installer_name}"
checksum="$(sha256sum "dist/${installer_name}" | awk '{print $1}')"
printf '%s %s\n' "${checksum}" "${installer_name}" > release-checksums.txt
file "dist/${installer_name}"
cat release-checksums.txt
- name: Upload installer artifact
uses: actions/upload-artifact@v4
with:
name: CargoNetSim-linux-installer
path: dist/*.run
if-no-files-found: error
- name: Attach assets to GitHub Release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: softprops/action-gh-release@v2
with:
files: dist/*.run
generate_release_notes: true
- name: Add checksums to GitHub Release notes
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view "${GITHUB_REF_NAME}" --json body --jq '.body // ""' > release-body.md
awk '
/^## Checksums$/ { skip = 1; next }
skip && /^## / { skip = 0 }
!skip { print }
' release-body.md > release-body-without-checksums.md
{
cat release-body-without-checksums.md
printf '\n## Checksums\n\n'
printf '| Asset | SHA256 |\n'
printf '| --- | --- |\n'
while read -r checksum asset_name; do
printf '| `%s` | `%s` |\n' "${asset_name}" "${checksum}"
done < release-checksums.txt
} > release-body-final.md
gh release edit "${GITHUB_REF_NAME}" --notes-file release-body-final.md