File: build.yml

package info (click to toggle)
firebuild 0.8.6-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 2,624 kB
  • sloc: cpp: 14,301; ansic: 6,429; python: 2,401; sh: 262; makefile: 40; awk: 33
file content (428 lines) | stat: -rw-r--r-- 15,844 bytes parent folder | download
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
name: CI

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  schedule:
    - cron: '10 4 * * 1'

env:
  BUILD_DEPS: cmake libconfig++-dev libelf-dev libxxhash-dev libjemalloc-dev libtsl-hopscotch-map-dev pkg-config python3-jinja2
  TEST_DEPS: bc bats clang node-d3 moreutils fakeroot
jobs:
  build-on-ubuntu-lts:
    needs: style-checks
    runs-on: ubuntu-22.04
    timeout-minutes: 15
    steps:
    - uses: actions/checkout@v4
    - uses: actions/cache@v4
      with:
        path: ~/.cache/debs
        key: build-on-ubuntu-lts-debs-${{ needs.style-checks.outputs.week }}
    # TODO: This and saving the debs can be dropped and and the debs can be saved directly like in docker
    # when https://github.com/actions/cache/issues/324 gets fixed
    - name: restore-cached-debs
      run: |
        [ -d ~/.cache/debs ] && sudo cp ~/.cache/debs/* /var/cache/apt/archives/ || mkdir -p ~/.cache/debs
    - uses: firebuild/apt-eatmydata-action@v1
    - uses: firebuild/firebuild-action@v4.2
      with:
        key: build-on-ubuntu-lts
    - name: install-deps
      run: |
        sudo apt-get -y install $BUILD_DEPS $TEST_DEPS doxygen graphviz lcov
    - name: build-out-of-tree
      run: |
        mkdir build
        cd build
        firebuild cmake -DCMAKE_BUILD_TYPE=Release ..
        firebuild make -j$(getconf _NPROCESSORS_ONLN)
    - name: doc
      run: |
        cd build
        firebuild doxygen
    - name: build-in-tree
      run: |
        firebuild cmake -DWITH_JEMALLOC=OFF -DCMAKE_BUILD_TYPE=Debug .
        firebuild make -j$(getconf _NPROCESSORS_ONLN) all check-bins
    - name: test
      run: |
        make check
    - name: coverage
      # tests don't run with out of tree builds at the moment
      run: |
        git clean -dxf
        firebuild cmake -DCOVERAGE=1 -DCMAKE_BUILD_TYPE=Debug .
        firebuild make all check-bins
        make -j$(getconf _NPROCESSORS_ONLN) check coverage-info
        [ $(echo "$(make coverage-info | grep '^[\.0-9]*$') >= 74" | bc) = 1 ]
    - name: save-cached-debs
      run: |
        rm -f ~/.cache/debs/*
        cp /var/cache/apt/archives/*deb ~/.cache/debs/

  test-with-valgrind:
    needs: style-checks
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
    - uses: actions/checkout@v4
    - uses: actions/cache@v4
      with:
        path: ~/.cache/debs
        key: test-with-valgrind-debs-${{ needs.style-checks.outputs.week }}
    # TODO: This and saving the debs can be dropped and and the debs can be saved directly like in docker
    # when https://github.com/actions/cache/issues/324 gets fixed
    - name: restore-cached-debs
      run: |
        [ -d ~/.cache/debs ] && sudo cp ~/.cache/debs/* /var/cache/apt/archives/ || mkdir -p ~/.cache/debs
    - uses: firebuild/apt-eatmydata-action@v1
    - uses: firebuild/firebuild-action@v4.2
      with:
        key: test-with-valgrind
    - name: install-deps
      run: |
        sudo apt-get -y install $BUILD_DEPS $TEST_DEPS valgrind
    - name: build-in-tree
      run: |
        firebuild cmake -DWITH_JEMALLOC=OFF -DCMAKE_BUILD_TYPE=Debug .
        firebuild make -j$(getconf _NPROCESSORS_ONLN) all check-bins
    - name: test
      run: |
        make valgrind-check
    - name: save-cached-debs
      run: |
        rm -f ~/.cache/debs/*
        cp /var/cache/apt/archives/*deb ~/.cache/debs/

  # build on various Debian derivative releases in docker
  build-in-docker:
    strategy:
      matrix:
        container: ["ubuntu:rolling", "ubuntu:devel", "i386/debian"]
    needs: style-checks
    runs-on: ubuntu-latest
    container: ${{ matrix.container }}
    timeout-minutes: 15
    steps:
    - name: disable-apt-docker-clean
      run: |
        # don't clean apt archive cache to make deb caching work
        rm -f /etc/apt/apt.conf.d/docker-clean
    - name: apt update
      run: |
        sed -i 's|/archive.ubuntu.com|/azure.archive.ubuntu.com|' /etc/apt/sources.list || true
        apt-get -qq update
    - uses: firebuild/apt-eatmydata-action@v1
    - name: install-deps
      run: |
        # configure tzdata in advance to prevent hanging at the prompt
        TZ=Europe/Budapest
        ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
        echo $TZ > /etc/timezone
        apt-get -y install $BUILD_DEPS $TEST_DEPS g++ gcc git
        [ ${{ matrix.container }} = "i386/debian" ] || apt-get install -y software-properties-common
        [ ${{ matrix.container }} = "i386/debian" ] || add-apt-repository ppa:firebuild/qemu-backports
        [ ${{ matrix.container }} = "i386/debian" ] || apt-get install -y qemu-user-interposable
    # use checkout@v1 that works in i386 containers without node
    - uses: actions/checkout@v1
      with:
        fetch-depth: 0
    - name: build-out-of-tree
      run: |
        # avoid git error about repository ownership
        git config --global --add safe.directory $PWD
        mkdir build
        cd build
        cmake -DCMAKE_BUILD_TYPE=Release ..
        make -j$(getconf _NPROCESSORS_ONLN)
        # Version should be set in the source before tagging a release,
        # then the version should be unset right in the next commit.
        BUILT_VERSION=$(src/firebuild/firebuild --version | head -n1 | cut -d" "  -f2)
        GIT_VERSION=$(git describe --tags  | sed s/^v//)
        dpkg --compare-versions $BUILT_VERSION ge $GIT_VERSION || (echo "ERROR: built version $BUILT_VERSION < git version $GIT_VERSION" ; exit 1)
    - name: build-in-tree
      run: |
        cmake -DCMAKE_BUILD_TYPE=Debug .
        make -j$(getconf _NPROCESSORS_ONLN) all check-bins
        make -j$(getconf _NPROCESSORS_ONLN) check

  clang-build:
    needs: style-checks
    runs-on: ubuntu-22.04
    timeout-minutes: 15
    steps:
    - uses: actions/checkout@v4
    - uses: actions/cache@v4
      with:
        path: ~/.cache/debs
        key: clang-build-debs-${{ needs.style-checks.outputs.week }}
    - name: restore-cached-debs
      run: |
        [ -d ~/.cache/debs ] && sudo cp ~/.cache/debs/* /var/cache/apt/archives/ || mkdir -p ~/.cache/debs
    - uses: firebuild/apt-eatmydata-action@v1
    - uses: firebuild/firebuild-action@v4.2
      with:
        key: clang-build
    - name: install-deps
      run: |
        sudo apt-get -y install clang-tools $BUILD_DEPS $TEST_DEPS valgrind
    - name: build
      run: |
        env CC=clang CXX=clang++ LD=ld.lld cmake .
        firebuild make -j$(getconf _NPROCESSORS_ONLN) all check-bins
    - name: test
      run: |
        make check
        make valgrind-check
    - name: clean
      run: make clean
    - name: scan-build
      run: |
        # work around static analyzer report about emmintrin.h with XXH_INLINE_ALL
        scan-build cmake -DENABLE_XXH_INLINE_ALL=OFF .
        scan-build --status-bugs make -j$(getconf _NPROCESSORS_ONLN)
    - name: save-cached-debs
      run: |
        rm -f ~/.cache/debs/*
        cp /var/cache/apt/archives/*deb ~/.cache/debs/

  rebuild-self:
    needs: style-checks
    runs-on: ubuntu-22.04
    timeout-minutes: 15
    steps:
    - uses: firebuild/apt-eatmydata-action@v1
    - uses: actions/checkout@v4
    - uses: actions/cache@v4
      with:
        path: ~/.cache/debs
        key: rebuild-self-debs-${{ needs.style-checks.outputs.week }}
    - name: restore-cached-debs
      run: |
        [ -d ~/.cache/debs ] && sudo cp ~/.cache/debs/* /var/cache/apt/archives/ || mkdir -p ~/.cache/debs
    - uses: firebuild/firebuild-action@v4.2
      with:
        key: rebuild-self
    - name: install-deps
      run: |
        sudo apt-get -y install $BUILD_DEPS
    - name: rebuild self
      run: |
        tools/rebuild-self build
        # rebuild again, to test shortcutting
        cd build-first-build/test
        ./run-firebuild make -C ../../build clean
        time ./run-firebuild make -j$(getconf _NPROCESSORS_ONLN) -C ../../build all
        du -sh test_cache_dir
    - name: rebuild self with -j8
      run: |
        cd build-first-build/test
        rm -r test_cache_dir
        ./run-firebuild make -C ../../build clean
        time ./run-firebuild make -j8 -C ../../build all
        ./run-firebuild make -C ../../build clean
        time ./run-firebuild make -j8 -C ../../build all
    - name: save-cached-debs
      run: |
        rm -f ~/.cache/debs/*
        cp /var/cache/apt/archives/*deb ~/.cache/debs/

  build-other-projects:
    needs: style-checks
    runs-on: ubuntu-22.04
    timeout-minutes: 15
    steps:
    - uses: actions/checkout@v4
    - uses: actions/cache@v4
      with:
        path: ~/.cache/debs
        key: build-other-projects-debs-${{ needs.style-checks.outputs.week }}
    - name: restore-cached-debs
      run: |
        [ -d ~/.cache/debs ] && sudo cp ~/.cache/debs/* /var/cache/apt/archives/ || mkdir -p ~/.cache/debs
    - uses: firebuild/apt-eatmydata-action@v1
    - uses: firebuild/firebuild-action@v4.2
      with:
        key: build-other-projects
    - name: install-deps
      run: |
        sudo sed -i 's/# deb-src/deb-src/' /etc/apt/sources.list
        # work around https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1979244
        echo 'APT::Get::Always-Include-Phased-Updates "true";' | sudo tee /etc/apt/apt.conf.d/99-firebuild-phased-updates
        sudo apt-get update
        sudo apt-get -y install devscripts $BUILD_DEPS $TEST_DEPS
        sudo apt-get build-dep vte2.91
    - name: build-in-tree
      run: |
        firebuild cmake -DWITH_JEMALLOC=OFF -DSANITIZE=ON .
        firebuild make -j$(getconf _NPROCESSORS_ONLN) all check-bins
        make -j$(getconf _NPROCESSORS_ONLN) check
    - name: build-vte
      run: |
        apt-get source vte2.91
        cd vte2.91-*
        meson build
        cd ../test
        ./run-firebuild ninja -j8 -C ../vte2.91-*/build
        ninja -C ../vte2.91-*/build clean
        ./run-firebuild ninja -j8 -C ../vte2.91-*/build
    - name: save-cached-debs
      run: |
        rm -f ~/.cache/debs/*
        cp /var/cache/apt/archives/*deb ~/.cache/debs/

  build-deb:
    strategy:
      matrix:
        os: [ubuntu-22.04, ubuntu-24.04]
    needs: style-checks
    runs-on: ${{ matrix.os }}
    timeout-minutes: 15
    steps:
    - uses: actions/checkout@v4
    - uses: actions/cache@v4
      with:
        path: ~/.cache/debs
        key: build-deb-debs-${{ matrix.os }}-${{ needs.style-checks.outputs.week }}
    - name: restore-cached-debs
      run: |
        [ -d ~/.cache/debs ] && sudo cp ~/.cache/debs/* /var/cache/apt/archives/ || mkdir -p ~/.cache/debs
    - uses: firebuild/apt-eatmydata-action@v1
    - uses: firebuild/firebuild-action@v4.2
      with:
        key: build-deb-${{ matrix.os }}
    - name: install-deps
      run: |
        sudo apt update
        sudo apt-get build-dep .
    - name: install-patched-qemu
      run: |
        sudo add-apt-repository ppa:firebuild/qemu-backports
        sudo apt-get install -y qemu-user-interposable
    - name: deb
      run: |
        # skip dh_buildinfo step
        printf '\noverride_dh_buildinfo:\n' >> debian/rules
        # don't intercept bats and ldd to avoid breaking firebuild's own tests
        firebuild  -o 'processes.dont_intercept += "bats"' -o 'processes.dont_intercept += "ldd"' env DEB_BUILD_OPTIONS=noautodbgsym dpkg-buildpackage -jauto -zfast --no-sign -b
        echo debconf firebuild/license-accepted select true | sudo debconf-set-selections
        sudo apt-get install -y --allow-downgrades ../*.deb
        firebuild -- ls
    - name: save-cached-debs
      run: |
        rm -f ~/.cache/debs/*
        cp /var/cache/apt/archives/*deb ~/.cache/debs/

  build-on-macos:
    env:
        HOMEBREW_NO_AUTO_UPDATE: 1
    strategy:
      matrix:
        os: [macos-14]
    needs: style-checks
    runs-on: ${{ matrix.os }}
    timeout-minutes: 30
    steps:
    - name: check if SIP is enabled on this runner
      run: |
        csrutil status | grep "System Integrity Protection status: disabled"
    - uses: actions/checkout@v4
    - uses: hendrikmuhs/ccache-action@v1
      with:
        key: build-on-macos-12
    - name: install-deps
      run: |
        brew update
        # brew often fails due to existing files, hence the --overwrite parameter and the retry
        brew bundle -f || (for v in 3.11 3.12; do brew link --overwrite python@${v} ; done; brew bundle -f)
    - name: configure vm
      run: |
        # library validation would prevent loading libfirebuild to some binaries
        sudo defaults write /Library/Preferences/com.apple.security.libraryvalidation.plist DisableLibraryValidation -bool true
    - name: build-out-of-tree
      run: |
        HOMEBREW_PREFIX=$(ls -d /opt/homebrew /usr/local 2> /dev/null| head -n1)
        export XML_CATALOG_FILES=${HOMEBREW_PREFIX}/etc/xml/catalog
        export PATH=${HOMEBREW_PREFIX}/opt/ccache/libexec:$PATH
        export PYTHONPATH=$(ls -d ${HOMEBREW_PREFIX}/Cellar/jinja2-cli/*/libexec/lib/*/site-packages | tail -n1)
        cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_SYSROOT=macosx -B build-make
        make -C build-make -j$(getconf _NPROCESSORS_ONLN)
    - name: test
      run: |
        # tests are failing on m1 due to missing arm64e ABI configuration: https://github.com/actions/runner-images/issues/9461
        make -C build-make check || [ ${{ matrix.os }} = macos-14 ]
    - name: install firebuild
      run: |
        sudo make -C build-make install
    - name: build-with-xcode
      run: |
        HOMEBREW_PREFIX=$(ls -d /opt/homebrew /usr/local 2> /dev/null| head -n1)
        export XML_CATALOG_FILES=${HOMEBREW_PREFIX}/etc/xml/catalog
        export PATH=${HOMEBREW_PREFIX}/opt/ccache/libexec:$PATH
        export PYTHONPATH=$(ls -d ${HOMEBREW_PREFIX}/Cellar/jinja2-cli/*/libexec/lib/*/site-packages | tail -n1)
        cmake -G Xcode -B build-xcode
        cd build-xcode
        xcodebuild

  style-checks:
    runs-on: ubuntu-22.04
    outputs:
      week: ${{ steps.week-of-year.outputs.week }} # map step output to job output
    timeout-minutes: 2
    steps:
    - uses: actions/checkout@v4
    - name: install-deps
      run: |
        # TODO(rbalint) use packaged cpplint when it becomes available https://bugs.debian.org/960847
        pip3 install cpplint==1.5.4
    - name: style-check
      run: env PATH=$HOME/.local/bin:$PATH cpplint --recursive src test
      # this will be used by other jobs to invalidate cache after a week
    - name: week of year
      id: week-of-year
      run: echo "week=$(/bin/date -u "+%V")" >> $GITHUB_OUTPUT

  build-on-rpm-based-distros:
    needs: style-checks
    runs-on: ubuntu-latest
    container: almalinux:9
    timeout-minutes: 20
    steps:
    - name: Install Git
      run: |
        dnf -y install git
    - name: Checkout source
      uses: actions/checkout@v4
      with:
        fetch-depth: 0
    - name: Install build tools and dependencies
      run: |
        dnf -y install dnf-plugins-core epel-release
        dnf -y groupinstall "Development Tools"
        dnf config-manager --set-enabled crb
        dnf builddep -y firebuild.spec
        cd ~
        git clone https://github.com/Tessil/hopscotch-map.git
        cd hopscotch-map/
        cmake .
        make install
    - name: Prepare sources for RPM build
      run: |
        mkdir -p ~/rpmbuild/SOURCES ~/rpmbuild/SPECS/
        cp firebuild.spec ~/rpmbuild/SPECS/
        git config --global --add safe.directory $PWD
        # Create source tarball
        SOURCE_VERSION=$(grep -m 1 set.FIREBUILD_VERSION CMakeLists.txt | sed 's/.* "//;s/".*//')
        git archive --format=tar.gz --prefix=firebuild-${SOURCE_VERSION}/ -o ~/rpmbuild/SOURCES/firebuild-${SOURCE_VERSION}.tar.gz HEAD
    - name: Build RPM
      run: |
        rpmbuild -ba ~/rpmbuild/SPECS/firebuild.spec
    - name: List built RPMs
      run: |
        ls -lh ~/rpmbuild/RPMS/*/*.rpm ~/rpmbuild/SRPMS/*.rpm || true