Skip to content

Commit

Permalink
feat(ci): new RPM stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
BradleyChatha committed Jan 1, 2024
1 parent 5e22a0b commit bb6683c
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 70 deletions.
28 changes: 28 additions & 0 deletions .github/actions/meson-dist/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Create Meson Dist
description: Runs 'meson dist' as well as uploading the rendered devops files.
runs:
using: composite
steps:
# This is largely to render the template files
- name: Build
shell: sh
run: meson compile -C build

- name: Create Source Dist
shell: sh
run: meson dist -C build --no-tests --formats gztar --allow-dirty

- name: Move Source Dist
shell: sh
run: mv build/meson-dist/*.tar.gz .

- name: Create DevOps Dist
shell: sh
run: tar -czvf devops.tar.gz build/devops/pkg

- uses: actions/upload-artifact@v2
with:
name: dists
path: |
juptune-*.tar.gz
devops.tar.gz
62 changes: 3 additions & 59 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,8 @@ jobs:
echo " github.ref: ${{ github.ref }} "
exit 1
fi
# This is largely to render the template files
- name: Build
run: meson compile -C build

- name: Create Source Dist
run: meson dist -C build --no-tests --formats gztar

- name: Rename Source Dist
run: mv build/meson-dist/*.tar.gz juptune-source.tar.gz

- name: Create DevOps Dist
run: tar -czvf devops.tar.gz build/devops/pkg

- uses: actions/upload-artifact@v2
with:
name: dists
path: |
juptune-source.tar.gz
devops.tar.gz
- uses: ./.github/actions/meson-dist

# I can't sign up for the OpenSUSE Build Service because the login page is broken.
# Dodgy unsigned RPMs it is.
Expand All @@ -61,42 +43,4 @@ jobs:
path: dists

- name: Unzip DevOps Dist
run: tar -xzvf dists/devops.tar.gz

- name: Install Build Dependencies
run: |
zypper -n in --no-recommends --auto-agree-with-licenses \
meson \
ldc \
ldc-phobos-devel \
ldc-runtime-devel \
libsodium-devel \
pkg-config \
rpm-build
- name: Get rpm topdir
run: echo "RPM_TOPDIR=$(rpm --eval '%{_topdir}')" >> $GITHUB_ENV

- name: Setup RPM Build Environment
run: mkdir -p ${RPM_TOPDIR}/SOURCES

- name: Copy Source Dist
run: cp dists/juptune-source.tar.gz ${RPM_TOPDIR}/SOURCES

- name: Perform build
run: rpmbuild -ba build/devops/pkg/opensuse-rpm/juptune.spec

- name: Rename RPMs
run: |
mkdir upload
for file in $(ls ${RPM_TOPDIR}/RPMS/x86_64/); do
mv -v ${RPM_TOPDIR}/RPMS/x86_64/${file} upload/opensuse-${file}
done
for file in $(ls ${RPM_TOPDIR}/SRPMS/); do
mv -v ${RPM_TOPDIR}/SRPMS/${file} upload/opensuse-${file}
done
- uses: softprops/action-gh-release@v1
with:
files: |
upload/*.rpm
run: tar -xzvf dists/devops.tar.gz
63 changes: 63 additions & 0 deletions .github/workflows/package_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Package Test

on:
pull_request:
push:

jobs:
# create_dists:
# name: Create Dist Artifacts
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/meson-setup
# - uses: ./.github/actions/meson-dist

opensuse_rpm:
name: Test OpenSUSE RPM
# needs: create_dists
runs-on: ubuntu-latest
container: opensuse/tumbleweed:latest
steps:
- uses: actions/checkout@v4

# - name: Install Node (only needed when using act)
# run: zypper -n install -y nodejs

- uses: actions/download-artifact@v2
with:
name: dists
path: dists

- name: Unzip DevOps Dist
run: tar -xzvf dists/devops.tar.gz

- name: Refresh Package Metadata
run: zypper refresh

- name: Install Build Dependencies
run: |
zypper -n in --no-recommends --auto-agree-with-licenses \
meson \
ldc \
ldc-phobos-devel \
ldc-runtime-devel \
libsodium-devel \
pkg-config \
rpm-build \
rpmlint
- name: Get rpm topdir
run: echo "RPM_TOPDIR=$(rpm --eval '%{_topdir}')" >> $GITHUB_ENV

- name: Setup RPM Build Environment
run: mkdir -p ${RPM_TOPDIR}/SOURCES

- name: Copy Source Dist
run: cp dists/juptune-*.tar.gz ${RPM_TOPDIR}/SOURCES

- name: Perform build
run: rpmbuild -ba --nosignature --undefine _enable_debug_packages build/devops/pkg/opensuse-rpm/juptune.spec

- name: Lint RPMs
run: rpmlint -i ${RPM_TOPDIR}/**/*.rpm
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: Unittests

on:
pull_request:
Expand Down
46 changes: 37 additions & 9 deletions devops/pkg/opensuse-rpm/juptune.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,22 @@
%define lib_name lib%{name}
%define include_dir juptune
%define pkgconfig_name juptune
%define meson_buildtype release

Name: juptune
Version: @JUPTUNE_VERSION@
Release: 0
Summary: Async I/O framework for D
License: MPL-2.0 and ISC
License: MPL-2.0
Group: System/Libraries
URL: https://github.com/Juptune/juptune
Source0: juptune-source.tar.gz
Source0: juptune-%{version}.tar.gz
BuildRequires: meson
BuildRequires: ldc
BuildRequires: ldc-phobos-devel
BuildRequires: ldc-runtime-devel
BuildRequires: libsodium-devel
BuildRequires: pkg-config
Requires: libdruntime-ldc102
Requires: libphobos2-ldc102
Requires: libsodium23
ExclusiveArch: x86_64

%description
Expand All @@ -49,7 +47,7 @@ client/server implementations.
%package devel
Summary: Development files for %{name}
Requires: %{name} = %{version}
License: MPL-2.0
License: MPL-2.0 and ISC
Group: Development/Language/D

%description devel
Expand All @@ -59,23 +57,53 @@ developing applications that use %{name}.
%prep
%autosetup -p1

# For some reason, `osc build` is adding in a bad `--flto=auto` flag which LDC2 doesn't support.
# This doesn't happen with a raw `rpmbuild`. It's simple enough to fix though - we just won't use the meson setup macro.
%build
%meson
/usr/bin/meson setup \
--buildtype=%{meson_buildtype} \
--prefix=%{_prefix} \
--libdir=%{_libdir} \
--libexecdir=%{_libexecdir} \
--bindir=%{_bindir} \
--sbindir=%{_sbindir} \
--includedir=%{_includedir} \
--datadir=%{_datadir} \
--mandir=%{_mandir} \
--infodir=%{_infodir} \
--localedir=%{_localedir} \
--sysconfdir=%{_sysconfdir} \
--localstatedir=%{_localstatedir} \
--sharedstatedir=%{_sharedstatedir} \
--wrap-mode=nodownload \
--auto-features=enabled \
--strip \
%{_vpath_srcdir} \
%{_vpath_builddir}
%meson_build

%install
%meson_install

%if "%{meson_buildtype}" == "debug" || "%{meson_buildtype}" == "debugoptimized"
%check
%meson_test
%endif

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%license LICENSE.txt
%doc README.md
%{_libdir}/%{lib_name}*.so*
%{_libdir}/%{lib_name}.so.*

%files devel
%{_includedir}/d/%{include_dir}/*
%defattr(-,root,root,-)
%dir %{_includedir}/d/
%{_includedir}/d/%{include_dir}/
%{_libdir}/pkgconfig/%{pkgconfig_name}.pc
%{_libdir}/%{lib_name}.so

%changelog
2 changes: 1 addition & 1 deletion src/juptune/event/fiber.d
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ unittest

auto bb = b;
alloc.freeBlock(b);
assertThrown!Error(alloc.freeBlock(bb));
debug assertThrown!Error(alloc.freeBlock(bb)); // Only works when debug blocks are enabled
}

@("FiberAllocator - zero out block config")
Expand Down

0 comments on commit bb6683c

Please sign in to comment.