Skip to content

Commit

Permalink
.github/workflows: Use Meson build in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Daiki Ueno <[email protected]>
  • Loading branch information
ueno committed Apr 11, 2024
1 parent b87a79d commit 4343481
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 112 deletions.
6 changes: 6 additions & 0 deletions .github/scan-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
scan-build --html-title="PKCS#11 Provider ($GITHUB_SHA)" \
--keep-cc \
--status-bugs \
--keep-going \
"$@"
28 changes: 14 additions & 14 deletions .github/workflows/address-sanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ jobs:
- name: Install Dependencies
run: |
if [ -f /etc/fedora-release ]; then
dnf -y install git clang gcc automake libtool pkgconf-pkg-config \
autoconf-archive openssl-devel openssl diffutils expect \
dnf -y install git clang gcc pkgconf-pkg-config meson \
openssl-devel openssl diffutils expect \
softhsm opensc p11-kit-devel p11-kit-server gnutls-utils \
nss-softokn nss-tools nss-softokn-devel \
dnf-command\(debuginfo-install\) libasan
dnf -y debuginfo-install openssl
elif [ -f /etc/debian_version ]; then
cat .github/sid.debug.list > /etc/apt/sources.list.d/debug.list
apt-get -q update
apt-get -yq install git gcc clang make automake \
libtool pkg-config autoconf-archive libssl-dev openssl expect \
apt-get -yq install git gcc clang meson \
pkg-config libssl-dev openssl expect \
procps libnss3 libnss3-tools libnss3-dev softhsm2 opensc p11-kit \
libp11-kit-dev p11-kit-modules gnutls-bin \
openssl-dbgsym libssl3t64-dbgsym
Expand All @@ -47,23 +47,23 @@ jobs:
# that is not compabitlbe with LD_PRELOAD so we force the absolute path.
run: |
if [ -f /etc/fedora-release ]; then
autoreconf -fiv
CC=gcc \
./configure --with-address-sanitizer=/usr/lib64/libasan.so.8.0.0
meson setup builddir -Db_sanitize=address -Dpreload_libasan=/usr/lib64/libasan.so.8.0.0
elif [ -f /etc/debian_version ]; then
autoreconf -fiv
CC=gcc \
./configure --with-address-sanitizer
meson setup builddir -Db_sanitize=address -Dpreload_libasan=/usr/lib/x86_64-linux-gnu/libasan.so.8.0.0
fi
- name: Build and Test
run: make check
run: |
meson compile -C builddir
meson test --num-processes 1 -C builddir
- uses: actions/upload-artifact@v3
if: failure()
with:
name: Address sanitizer logs on ${{ matrix.name }}
path: |
tests/*.log
tests/openssl.cnf
tests/tmp.${{ matrix.token }}/p11prov-debug.log
tests/tmp.${{ matrix.token }}/testvars
config.log
builddir/meson-logs/
builddir/tests/tmp.${{ matrix.token }}/p11prov-debug.log
builddir/tests/tmp.${{ matrix.token }}/testvars
builddir/tests/tmp.${{ matrix.token }}/openssl.cnf
60 changes: 30 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ jobs:
steps:
- name: Install Dependencies
run: |
if [ "${{ matrix.name }}" = centos ]; then
dnf_opts="--enablerepo=crb"
fi
if [ -f /etc/redhat-release ]; then
dnf -y install git ${{ matrix.compiler }} automake libtool \
pkgconf-pkg-config autoconf-archive openssl-devel openssl \
dnf -y install $dnf_opts \
git ${{ matrix.compiler }} meson \
pkgconf-pkg-config openssl-devel openssl \
diffutils expect valgrind
if [ "${{ matrix.token }}" = "softokn" ]; then
dnf -y install nss-softokn nss-tools nss-softokn-devel
Expand All @@ -40,8 +44,8 @@ jobs:
fi
elif [ -f /etc/debian_version ]; then
apt-get -q update
apt-get -yq install git ${{ matrix.compiler }} make automake \
libtool pkg-config autoconf-archive libssl-dev openssl expect \
apt-get -yq install git ${{ matrix.compiler }} meson \
pkg-config libssl-dev openssl expect \
valgrind procps
if [ "${{ matrix.token }}" = "softokn" ]; then
apt-get -yq install libnss3 libnss3-tools libnss3-dev
Expand All @@ -54,35 +58,34 @@ jobs:
uses: actions/checkout@v4
- name: Setup
run: |
autoreconf -fiv
CC=${{ matrix.compiler }} ./configure
CC=${{ matrix.compiler }} meson setup builddir
- name: Build and Test
run: make check
run: |
meson compile -C builddir
meson test --num-processes 1 -C builddir
- uses: actions/upload-artifact@v3
if: failure()
with:
name: Test logs ${{ matrix.name }}, ${{ matrix.compiler }}, ${{ matrix.token }}
path: |
tests/*.log
tests/openssl.cnf
tests/tmp.${{ matrix.token }}/p11prov-debug.log
tests/tmp.${{ matrix.token }}/testvars
config.log
builddir/meson-logs/
builddir/tests/tmp.${{ matrix.token }}/p11prov-debug.log
builddir/tests/tmp.${{ matrix.token }}/testvars
builddir/tests/tmp.${{ matrix.token }}/openssl.cnf
- name: Run tests with valgrind
run: |
if [ "${{ matrix.compiler }}" = "gcc" ]; then
make check-valgrind-memcheck
meson test --num-processes 1 -C builddir --setup=valgrind
fi
- uses: actions/upload-artifact@v3
if: failure()
with:
name: Test valgrind logs ${{ matrix.name }}, ${{ matrix.compiler }}, ${{ matrix.token }}
path: |
tests/*.log
tests/openssl.cnf
tests/tmp.${{ matrix.token }}/p11prov-debug.log
tests/tmp.${{ matrix.token }}/testvars
config.log
builddir/meson-logs/
builddir/tests/tmp.${{ matrix.token }}/p11prov-debug.log
builddir/tests/tmp.${{ matrix.token }}/testvars
builddir/tests/tmp.${{ matrix.token }}/openssl.cnf
build-macos:
name: CI with software token
runs-on: ${{ matrix.os }}
Expand All @@ -96,9 +99,7 @@ jobs:
run: |
brew update
brew install \
autoconf-archive \
automake \
libtool \
meson \
openssl@3 \
pkg-config
if [ "${{ matrix.token }}" = "softokn" ]; then
Expand All @@ -116,21 +117,20 @@ jobs:
export PKG_CONFIG_PATH=$(brew --prefix openssl@3)/lib/pkgconfig
export PATH=$(brew --prefix openssl@3)/bin:$PATH
autoreconf -fiv
CC=clang ./configure
CC=clang meson setup builddir
- name: Build and Test
run: |
export PATH=$(brew --prefix openssl@3)/bin:$PATH
make -j$(sysctl -n hw.ncpu || echo 2)
make check
meson compile -j$(sysctl -n hw.ncpu || echo 2) -C builddir
meson test --num-processes 1 -C builddir
- uses: actions/upload-artifact@v3
if: failure()
with:
name: Test logs on macOS-12 with ${{ matrix.token }}
path: |
tests/*.log
tests/openssl.cnf
tests/tmp.${{ matrix.token }}/p11prov-debug.log
tests/tmp.${{ matrix.token }}/testvars
config.log
builddir/meson-logs/*
builddir/tests/tmp.${{ matrix.token }}/p11prov-debug.log
builddir/tests/tmp.${{ matrix.token }}/testvars
builddir/tests/tmp.${{ matrix.token }}/openssl.cnf
14 changes: 6 additions & 8 deletions .github/workflows/coverity-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ jobs:
steps:
- name: Install Dependencies
run: |
dnf -y install git gcc automake libtool pkgconf-pkg-config \
autoconf-archive openssl-devel openssl \
dnf -y install git gcc meson pkgconf-pkg-config \
openssl-devel openssl \
nss-softokn nss-tools nss-softokn-devel
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup
run: |
autoreconf -fiv
./configure
meson setup builddir
- name: Check for changes
run: |
echo "RUN_COV=0" >> $GITHUB_ENV;
Expand Down Expand Up @@ -54,8 +53,8 @@ jobs:
steps:
- name: Install Dependencies
run: |
dnf -y install git gcc automake libtool pkgconf-pkg-config \
autoconf-archive openssl-devel openssl \
dnf -y install git gcc meson pkgconf-pkg-config \
openssl-devel openssl \
nss-softokn nss-tools nss-softokn-devel \
gh
- name: Find PR
Expand All @@ -67,8 +66,7 @@ jobs:
ref: ${{steps.get-pr.outputs.merge_commit_sha}}
- name: Setup
run: |
autoreconf -fiv
./configure
meson setup builddir
- name: Coverity Scan
uses: vapier/coverity-scan-action@v1
with:
Expand Down
23 changes: 15 additions & 8 deletions .github/workflows/distcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,20 @@ jobs:
steps:
- name: Install Dependencies
run: |
if [ "${{ matrix.name }}" = centos ]; then
dnf_opts="--enablerepo=crb"
fi
if [ -f /etc/redhat-release ]; then
dnf -y install git gcc automake libtool expect \
pkgconf-pkg-config autoconf-archive openssl-devel openssl xz \
dnf -y install $dnf_opts \
git gcc meson expect \
pkgconf-pkg-config openssl-devel openssl xz \
nss-softokn nss-tools nss-softokn-devel \
softhsm opensc p11-kit-devel p11-kit-server \
rpm-build nss-devel gnutls-utils
elif [ -f /etc/debian_version ]; then
apt-get -q update
apt-get -yq install git gcc make automake expect \
libtool pkg-config autoconf-archive libssl-dev openssl \
apt-get -yq install git gcc meson expect \
pkg-config libssl-dev openssl \
xz-utils libnss3 libnss3-tools libnss3-dev \
softhsm2 opensc p11-kit libp11-kit-dev p11-kit-modules \
gnutls-bin
Expand All @@ -42,14 +46,17 @@ jobs:
uses: actions/checkout@v4
- name: Setup
run: |
autoreconf -fiv
./configure
meson setup builddir
- name: Distcheck
run: make distcheck
run: |
git config --global --add safe.directory \
/__w/pkcs11-provider/pkcs11-provider
git ls-files meson.build
meson dist --no-tests -C builddir
- name: RPM Build
if: ${{ matrix.name == 'fedora' }}
run: |
mkdir -p rpmbuild/SOURCES
cp pkcs11-provider*tar.xz rpmbuild/SOURCES/
cp builddir/meson-dist/pkcs11-provider*tar.xz rpmbuild/SOURCES/
rpmbuild --define "_topdir $PWD/rpmbuild" -ba \
packaging/pkcs11-provider.spec
12 changes: 5 additions & 7 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Build Requirements
run: |
dnf -y install git autoconf autoconf-archive automake libtool \
openssl-devel
run: |\
dnf -y install git meson openssl-devel
- name: Setup, Build and Install pkcs11-provider
run: |
autoreconf -fiv
./configure --libdir=/usr/lib64
make
make install
meson setup -Dlibdir=/usr/lib64 builddir
meson compile -C builddir
meson install -C builddir
- name: Test
run: |
pushd tests/integration
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/scan-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,19 @@ jobs:
steps:
- name: Install Dependencies
run: |
dnf -y install $COMPILER automake libtool pkgconf-pkg-config \
autoconf-archive git openssl-devel clang-analyzer
dnf -y install $COMPILER meson pkgconf-pkg-config \
git openssl-devel clang-analyzer
- uses: actions/checkout@v4
name: Checkout Repository
- name: Setup
run: |
autoreconf -fiv
./configure
meson setup builddir
- name: Scan Build
run: |
scan-build --html-title="PKCS#11 Provider ($GITHUB_SHA)" \
--keep-cc \
--status-bugs \
--keep-going \
-o scan-build.reports make
SCANBUILD=$PWD/.github/scan-build.sh ninja -C builddir scan-build
- uses: actions/upload-artifact@v3
if: failure()
with:
name: Scan Build logs
path: |
scan-build.reports/
builddir/meson-logs/scanbuild/
13 changes: 4 additions & 9 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ jobs:
steps:
- name: Install Dependencies
run: |
dnf -y install $COMPILER automake libtool pkgconf-pkg-config \
autoconf-archive git openssl-devel clang-tools-extra \
dnf -y install gcc meson pkgconf-pkg-config \
git openssl-devel clang-tools-extra \
python3-pip codespell
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install compiledb
run: |
pip install compiledb
- name: Setup
if: ${{ github.event.pull_request.base.sha }}
run: |
Expand All @@ -29,16 +26,14 @@ jobs:
git fetch origin main ${{ github.event.pull_request.base.sha }}
- name: Generate Makefile
run: |
autoreconf -fiv
./configure
compiledb make
meson setup builddir
- name: Run Clang Tidy
run: |
run-clang-tidy \
-checks=-*,readability-braces-around-statements \
-config "{WarningsAsErrors: '*'}" \
-header-filter "src/pkcs11.h" \
-quiet
-quiet -p builddir
- name: Check the Style
run: make check-style || (make check-style-show; exit -1)
- name: Check spelling
Expand Down
14 changes: 5 additions & 9 deletions packaging/pkcs11-provider.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ Source2: https://people.redhat.com/~ssorce/simo_redhat.asc

BuildRequires: openssl-devel >= 3.0.7
BuildRequires: gcc
BuildRequires: autoconf-archive
BuildRequires: automake
BuildRequires: libtool
BuildRequires: make
BuildRequires: meson
%if %{with gpgcheck}
BuildRequires: gnupg2
%endif
Expand Down Expand Up @@ -54,18 +51,17 @@ compatible to previous versions as well.


%build
autoreconf -fi
%configure
%make_build
%meson
%meson_build


%install
%make_install
%meson_install


%check
# do not run them in parrallel with %{?_smp_mflags}
make check || if [ $? -ne 0 ]; then cat tests/*.log; exit 1; fi;
%meson_test --num-processes 1


%files
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ pkcs11_provider = shared_module(
link_depends: [pkcs11_provider_map],
link_args: pkcs11_provider_ldflags,
install: true,
install_dir: libdir / 'ossl-modules',
install_dir: get_option('libdir') / 'ossl-modules',
)
Loading

0 comments on commit 4343481

Please sign in to comment.