Skip to content

Commit

Permalink
ci: add meson build permutation
Browse files Browse the repository at this point in the history
Things are a quite hairy in here, so bear with me:

Atm the checkout action pulls the whole repo as tarball, since git is
missing. Since we install packages via local actions, we need to first
do an initial sparse checkout, install the packages (git including) and
do a proper second checkout.

At which point, the second checkout action claims to set safe.directory
(it's the default) although in practise we need to do it again. Not sure
why, haven't found a bug about it either.

In addition, we cannot use conditionals within the run actions, because
coreutils (for [ and test) are not installed on Debian/Ubuntu. Even
after doing so, even though find, ls and command finds them the script
simply fails.

Once we get all that, meson dist will work. Otherwise it throws a less
than helpful error message as below. Meson issue was reported ~2 years
ago and we're about to get a fix soon (tm).

  Dist currently only works with Git or Mercurial repos

Signed-off-by: Emil Velikov <[email protected]>
  • Loading branch information
evelikov authored and lucasdemarchi committed Sep 3, 2024
1 parent 7ed0628 commit 29df660
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .github/actions/setup-alpine/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ runs:
automake \
bash \
build-base \
git \
gtk-doc \
libtool \
linux-edge-dev \
meson \
openssl-dev \
scdoc \
xz-dev \
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/setup-archlinux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ runs:
pacman --noconfirm -Su \
linux-headers \
meson \
scdoc \
git \
gtk-doc
2 changes: 2 additions & 0 deletions .github/actions/setup-debian/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ runs:
build-essential \
autoconf \
automake \
git \
gtk-doc-tools \
libssl-dev \
liblzma-dev \
libssl-dev \
libtool \
libzstd-dev \
linux-headers-generic \
meson \
scdoc \
zlib1g-dev \
zstd
2 changes: 2 additions & 0 deletions .github/actions/setup-fedora/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ runs:
zlib-devel \
xz-devel \
libzstd-devel \
meson \
openssl-devel \
git \
gtk-doc \
libtool \
scdoc
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/setup-ubuntu/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ runs:
build-essential \
autoconf \
automake \
git \
gtk-doc-tools \
libssl-dev \
liblzma-dev \
libssl-dev \
libtool \
libzstd-dev \
linux-headers-generic \
meson \
scdoc \
zlib1g-dev \
zstd
95 changes: 58 additions & 37 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,24 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- container: 'ubuntu:22.04'
test: 'yes'
- container: 'ubuntu:24.04'
test: 'yes'
- container: 'archlinux:base-devel'
test: 'yes'
- container: 'fedora:latest'
test: 'yes'
- container: 'alpine:latest'
test: 'no'
- container: 'debian:unstable'
test: 'yes'
container:
- 'ubuntu:22.04'
- 'ubuntu:24.04'
- 'archlinux:base-devel'
- 'fedora:latest'
- 'alpine:latest'
- 'debian:unstable'
build:
- 'meson'
- 'autotools'

container:
image: ${{ matrix.container }}

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
sparse-checkout: .github

- uses: ./.github/actions/setup-ubuntu
if: ${{ startsWith(matrix.container, 'ubuntu') }}
Expand All @@ -47,8 +46,12 @@ jobs:
- uses: ./.github/actions/setup-debian
if: ${{ startsWith(matrix.container, 'debian') }}

- name: Set the KDIR environment variable
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set the environment
run: |
git config --global --add safe.directory '*'
for moddir in /usr/lib/modules /lib/modules; do
if [ -e "$moddir" ]; then
kernel=$(find "$moddir" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;)
Expand All @@ -62,30 +65,48 @@ jobs:
fi
echo "KDIR=$moddir/$kernel/build" >> "$GITHUB_ENV"
- name: configure
run: |
mkdir build
cd build
../autogen.sh c
if [ ${{ startsWith(matrix.container, 'alpine') }} == 'true' ]; then
echo "test=false" >> "$GITHUB_ENV"
else
echo "test=true" >> "$GITHUB_ENV"
fi
- name: build
run: |
cd build
make -j$(nproc)
- name: configure (meson)
if: ${{ matrix.build == 'meson' }}
run: mkdir build && cd build && ../meson.sh c -D build-tests=$test

- name: test
if: ${{ matrix.test == 'yes' }}
run: |
cd build
make -j$(nproc) check
- name: configure (autotools)
if: ${{ matrix.build == 'autotools' }}
run: mkdir build && cd build && ../autogen.sh c

- name: install
run: |
cd build
DESTDIR=$PWD/inst make install
- name: build (meson)
if: ${{ matrix.build == 'meson' }}
run: cd build && meson compile

- name: distcheck
if: ${{ matrix.test == 'yes' }}
run: |
cd build
make distcheck
- name: build (autotools)
if: ${{ matrix.build == 'autotools' }}
run: cd build && make -j$(nproc)

- name: test (meson)
if: ${{ env.test == 'true' && matrix.build == 'meson' }}
run: cd build && meson test

- name: test (autotools)
if: ${{ env.test == 'true' && matrix.build == 'autotools' }}
run: cd build && make -j$(nproc) check

- name: install (meson)
if: ${{ matrix.build == 'meson' }}
run: cd build && DESTDIR=$PWD/inst meson install

- name: install (autotools)
if: ${{ matrix.build == 'autotools' }}
run: cd build && DESTDIR=$PWD/inst make install

- name: distcheck (meson)
if: ${{ env.test == 'true' && matrix.build == 'meson' }}
run: cd build && meson dist

- name: distheck (autotools)
if: ${{ env.test == 'true' && matrix.build == 'autotools' }}
run: cd build && make distcheck

0 comments on commit 29df660

Please sign in to comment.