| # SPDX-FileCopyrightText: 2024 Emil Velikov <emil.l.velikov@gmail.com> |
| # SPDX-FileCopyrightText: 2024 Lucas De Marchi <lucas.de.marchi@gmail.com> |
| # |
| # SPDX-License-Identifier: LGPL-2.1-or-later |
| |
| name: Build and Test |
| |
| on: |
| push: |
| branches: [master, ci-test] |
| pull_request: |
| branches: [master] |
| schedule: |
| - cron: "30 2 * * 0" |
| |
| permissions: |
| contents: read |
| |
| jobs: |
| build: |
| env: |
| CC: ${{ matrix.compiler }} |
| runs-on: ubuntu-24.04 |
| strategy: |
| fail-fast: false |
| matrix: |
| include: |
| - compiler: 'gcc' |
| container: 'alpine:latest' |
| meson_setup: '-Ddocs=false -Db_sanitize=none' |
| - compiler: 'gcc' |
| container: 'archlinux:multilib-devel' |
| - compiler: 'gcc' |
| container: 'debian:bullseye-slim' |
| meson_setup: '-Dzstd=disabled -Dxz=disabled -Dzlib=disabled -Dopenssl=enabled -Dtools=true' |
| - compiler: 'gcc' |
| container: 'debian:unstable' |
| - compiler: 'gcc' |
| container: 'fedora:latest' |
| - compiler: 'gcc' |
| container: 'fedora:latest' |
| meson_setup: '-Dxz=disabled -Ddlopen=all' |
| - compiler: 'gcc' |
| container: 'ubuntu:22.04' |
| - compiler: 'gcc' |
| container: 'ubuntu:22.04' |
| meson_setup: '-Ddlopen=zstd,zlib' |
| - compiler: 'gcc' |
| container: 'ubuntu:24.04' |
| |
| # clang variations of the same builds |
| |
| - compiler: 'clang' |
| container: 'alpine:latest' |
| meson_setup: '-Ddocs=false -Db_sanitize=none' |
| - compiler: 'clang' |
| container: 'archlinux:multilib-devel' |
| - compiler: 'clang' |
| container: 'debian:unstable' |
| # Disabled because it doesn't work |
| # - compiler: 'clang' |
| # container: 'debian:bullseye-slim' |
| # meson_setup: '-Dzstd=disabled -Dxz=disabled -Dzlib=disabled -Dopenssl=enabled -Dtools=true' |
| - compiler: 'clang' |
| container: 'fedora:latest' |
| - compiler: 'clang' |
| container: 'fedora:latest' |
| meson_setup: '-Dxz=disabled -Ddlopen=all' |
| - compiler: 'clang' |
| container: 'ubuntu:22.04' |
| - compiler: 'clang' |
| container: 'ubuntu:22.04' |
| meson_setup: '-Ddlopen=zstd,zlib' |
| - compiler: 'clang' |
| container: 'ubuntu:24.04' |
| |
| # Test some configurations with 32bits |
| |
| - compiler: 'gcc' |
| container: 'archlinux:multilib-devel' |
| x32: 'true' |
| meson_setup: '-Dzstd=disabled -Dxz=disabled -Dzlib=disabled -Dopenssl=disabled' |
| # fails on LD_PRELOAD |
| skip_test: 'true' |
| - compiler: 'gcc' |
| container: 'ubuntu:24.04' |
| x32: 'true' |
| meson_setup: '-Dzstd=disabled -Dxz=disabled -Dzlib=disabled -Dopenssl=disabled' |
| - compiler: 'clang' |
| container: 'archlinux:multilib-devel' |
| x32: 'true' |
| meson_setup: '-Dzstd=disabled -Dxz=disabled -Dzlib=disabled -Dopenssl=disabled' |
| # fails on LD_PRELOAD |
| skip_test: 'true' |
| - compiler: 'clang' |
| container: 'ubuntu:24.04' |
| x32: 'true' |
| meson_setup: '-Dzstd=disabled -Dxz=disabled -Dzlib=disabled -Dopenssl=disabled' |
| |
| # Special configurations |
| |
| # Variant with lld as linker |
| - compiler: 'clang' |
| container: 'archlinux:multilib-devel' |
| linker: 'lld' |
| |
| # Variants with moduledir |
| - compiler: 'gcc' |
| container: 'archlinux:multilib-devel' |
| meson_setup: '-Dmoduledir=/usr/lib/modules' |
| - compiler: 'gcc' |
| container: 'archlinux:multilib-devel' |
| meson_setup: '-Dmoduledir=/kernel-modules' |
| |
| container: |
| image: ${{ matrix.container }} |
| |
| steps: |
| - name: Sparse checkout the local actions |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| with: |
| sparse-checkout: .github |
| path: local-actions |
| |
| - name: Setup OS |
| uses: ./local-actions/.github/actions/setup-os |
| |
| - name: Cleanup local actions |
| run: | |
| rm -rf local-actions |
| # The sparse checkout with REST API creates the current dir with the wrong |
| # user. Tell git to just ignore. |
| git config --global --add safe.directory '*' |
| |
| - name: Checkout |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| |
| - name: Set the environment |
| run: | |
| .github/print-kdir.sh >> "$GITHUB_ENV" |
| |
| - name: configure checks |
| run: | |
| should_fail() { |
| rm -rf build-setup-test/ |
| if meson setup "$@" build-setup-test/; then |
| echo Command was expected to fail, but was successful |
| return 1 |
| fi |
| } |
| should_pass() { |
| rm -rf build-setup-test/ |
| meson setup "$@" build-setup-test/ |
| } |
| |
| should_fail -D distconfdir=relative/ |
| should_fail -D moduledir=relative/ |
| should_fail -D dlopen=nonexistent |
| should_fail -D xz=disabled -D dlopen=xz |
| |
| should_pass -D dlopen=xz |
| should_pass -D dlopen=xz -D xz=enabled |
| |
| - name: configure |
| run: | |
| setup_options="${{ matrix.meson_setup }}" |
| |
| if [[ "${{ matrix.x32 }}" == "true" ]]; then |
| export CC="$CC -m32" |
| fi |
| |
| if [[ -n "${{ matrix.linker }}" ]]; then |
| export CC_LD="${{ matrix.linker }}" |
| fi |
| |
| meson setup --native-file build-dev.ini $setup_options build |
| |
| - name: build |
| run: cd build && meson compile |
| |
| - name: test |
| if: ${{ matrix.skip_test != 'true' }} |
| run: cd build && meson test || meson test --verbose |
| |
| - name: install |
| run: cd build && DESTDIR=$PWD/inst meson install |
| |
| - name: distcheck |
| run: cd build && meson dist |