blob: d00a04c12a9d6a13fc1f95ebad1ca4028baec968 (
plain)
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
|
name: Main
on:
- push
defaults:
run:
shell: bash
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
cc:
- gcc
- clang
variant:
- default
- memcheck
- make-embedded
include:
- os: macos-latest
cc: clang
variant: default
- os: ubuntu-latest
cc: clang
variant: clang-analyzer
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Install dependencies (Ubuntu)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt install -y libcmocka-dev ninja-build ronn
if [[ "${{ matrix.variant }}" = "memcheck" ]]; then
sudo apt install -y valgrind
fi
if [[ "${{ matrix.variant }}" = "clang-analyzer" ]]; then
sudo apt install -y clang-tools
fi
- name: Install dependencies (MacOS)
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install cmocka coreutils groff ninja
gem install ronn-ng
- name: Setup clang-analyzer wrapper (if needed)
id: clang-analyzer
run: |
wrapper=
if [[ "${{ matrix.variant }}" = "clang-analyzer" ]]; then
wrapper="scan-build -o ${{ github.workspace }}/reports --use-cc=clang"
fi
echo "wrapper=${wrapper}" >> $GITHUB_OUTPUT
- name: Configure CMake (default)
if: ${{ matrix.variant != 'make-embedded' }}
run: |
${{ steps.clang-analyzer.outputs.wrapper }} cmake \
-B ${{ github.workspace }}/build \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DBUILD_BLOGC_GIT_RECEIVER=ON \
-DBUILD_BLOGC_MAKE=ON \
-DBUILD_BLOGC_RUNSERVER=ON \
-DBUILD_MANPAGES=ON \
-DBUILD_TESTING=ON \
-S ${{ github.workspace }} \
-G Ninja
- name: Configure CMake (make-embedded)
if: ${{ matrix.variant == 'make-embedded' }}
run: |
cmake \
-B ${{ github.workspace }}/build \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DBUILD_BLOGC_MAKE_EMBEDDED=ON \
-DBUILD_TESTING=ON \
-S ${{ github.workspace }} \
-G Ninja
- name: Build
run: |
${{ steps.clang-analyzer.outputs.wrapper }} cmake \
--build ${{ github.workspace }}/build \
--config RelWithDebInfo
- name: Test (default)
working-directory: ${{ github.workspace }}/build
env:
VARIANT: ${{ matrix.variant }}
run: |
${{ steps.clang-analyzer.outputs.wrapper }} ctest \
--verbose \
--build-config RelWithDebInfo
- uses: actions/upload-artifact@v4
if: ${{ matrix.variant == 'clang-analyzer' }}
id: clang-analyzer-upload
with:
name: clang-analyzer
path: reports
if-no-files-found: ignore
- name: Check clang-analyzer status
if: ${{ matrix.variant == 'clang-analyzer' && steps.clang-analyzer-upload.outputs.artifact-id != '' }}
run: |
echo "::error title=Error hint::clang-analyzer found bugs!"
exit 1
package:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pkg:
- source
- linux-amd64
- linux-amd64-static
- linux-amd64-make-embedded
- linux-amd64-make-embedded-static
- windows-i686
- windows-amd64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Install dependencies
run: |
sudo apt install -y ninja-build ronn
if [[ "${{ matrix.pkg }}" = "windows-i686" ]]; then
sudo apt install -y gcc-mingw-w64-i686
fi
if [[ "${{ matrix.pkg }}" = "windows-amd64" ]]; then
sudo apt install -y gcc-mingw-w64-x86-64
fi
if [[ "${{ matrix.pkg }}" = *-static ]]; then
sudo apt install -y musl-dev
fi
- name: Configure CMake (Default)
if: ${{ !startsWith(matrix.pkg, 'windows-') }}
run: |
cmake \
-B ${{ github.workspace }}/build \
-DCMAKE_C_COMPILER=$([[ "${{ matrix.pkg }}" = *-static ]] && echo x86_64-linux-musl-gcc || echo gcc) \
-DCMAKE_C_FLAGS="-Wall" \
-DCMAKE_EXE_LINKER_FLAGS="$([[ "${{ matrix.pkg }}" = *-static ]] && echo -static)" \
-DCPACK_PACKAGE_FILE_NAME_SUFFIX="$([[ "${{ matrix.pkg }}" != "source" ]] && echo "${{ matrix.pkg }}")" \
-DBUILD_BLOGC_GIT_RECEIVER=$([[ "${{ matrix.pkg }}" != *-make-embedded* ]] && echo ON || echo OFF) \
-DBUILD_BLOGC_MAKE=ON \
-DBUILD_BLOGC_MAKE_EMBEDDED=$([[ "${{ matrix.pkg }}" = *-make-embedded* ]] && echo ON || echo OFF) \
-DBUILD_BLOGC_RUNSERVER=$([[ "${{ matrix.pkg }}" != *-make-embedded* ]] && echo ON || echo OFF) \
-DBUILD_MANPAGES=$([[ "${{ matrix.pkg }}" != *-make-embedded* ]] && echo ON || echo OFF) \
-S ${{ github.workspace }} \
-G Ninja
- name: Configure CMake (Windows)
if: ${{ startsWith(matrix.pkg, 'windows-') }}
run: |
cmake \
-B ${{ github.workspace }}/build \
-DCMAKE_C_COMPILER=$([[ "${{ matrix.pkg }}" = "windows-i686" ]] && echo i686-w64-mingw32-gcc || echo x86_64-w64-mingw32-gcc) \
-DCMAKE_C_FLAGS="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" \
-DCMAKE_SYSTEM_NAME=Windows \
-S ${{ github.workspace }} \
-G Ninja
- name: Build
run: |
cmake \
--build ${{ github.workspace }}/build \
--config Release \
--target $([[ "${{ matrix.pkg }}" = "source" ]] && echo package_source || echo package)
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.pkg }}
path: build/blogc-*
validate-source:
runs-on: ubuntu-latest
needs: package
steps:
- uses: actions/download-artifact@v4
with:
name: source
path: source
- name: Install dependencies
run: sudo apt install -y ninja-build ronn
- name: Validate source
run: |
pushd source > /dev/null
sha512sum -c blogc-*.tar.xz.sha512
popd > /dev/null
tar -xvf source/blogc-*.tar.xz
cmake \
-B ${{ github.workspace }}/build \
-DCMAKE_C_COMPILER=gcc \
-DBUILD_BLOGC_GIT_RECEIVER=ON \
-DBUILD_BLOGC_MAKE=ON \
-DBUILD_BLOGC_RUNSERVER=ON \
-DBUILD_MANPAGES=ON \
-S ${{ github.workspace }}/blogc-* \
-G Ninja
cmake \
--build ${{ github.workspace }}/build \
--config Release
${{ github.workspace }}/build/src/blogc/blogc -v | grep -iv Unknown
${{ github.workspace }}/build/src/blogc-make/blogc-make -v | grep -iv Unknown
${{ github.workspace }}/build/src/blogc-runserver/blogc-runserver -v | grep -iv Unknown
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- test
- validate-source
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Get release metadata
id: meta
run: |
version="$(echo "${{ github.ref }}" | sed 's,refs/tags/v,,')"
echo "name=$(git tag -l --format="%(contents:subject)" "v${version}")" >> $GITHUB_OUTPUT
git tag -l --format="%(contents:body)" "v${version}" > body.txt
- uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5
with:
name: ${{ steps.meta.outputs.name }}
artifacts: "artifacts/blogc-*"
bodyFile: body.txt
generateReleaseNotes: true
|