Skip to content

Advanced features

Advanced features #16

Workflow file for this run

name: Build & Release cpp_unix_bindings
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "**" ]
release:
types: [ created ]
jobs:
build:
name: Build shared library
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build in manylinux2014 container
run: |
docker run --rm -v "${{ github.workspace }}:/project" -w /project quay.io/pypa/manylinux2014_x86_64 /bin/bash -c "yum install -y cmake3 devtoolset-11-gcc devtoolset-11-gcc-c++ && ln -sf /usr/bin/cmake3 /usr/bin/cmake && source /opt/rh/devtoolset-11/enable && cmake -S . -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j\$(nproc)"
- name: Upload library artifact
uses: actions/upload-artifact@v4
with:
name: libcpp_unix_bindings
path: build/libcpp_unix_bindings.so
retention-days: 14
- name: Attach library to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: build/libcpp_unix_bindings.so
# ------------------------------------------------------------
# Build distribution packages (.deb / .rpm) for selected distros
package:
name: Build & Package
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
distro: [ubuntu22, ubuntu24, fedora41, fedora42]
include:
- distro: ubuntu22
image: ubuntu:22.04
generator: DEB
ext: deb
- distro: ubuntu24
image: ubuntu:24.04
generator: DEB
ext: deb
- distro: fedora41
image: fedora:41
generator: RPM
ext: rpm
- distro: fedora42
image: fedora:42
generator: RPM
ext: rpm
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build and package inside ${{ matrix.image }}
run: |
docker run --rm -v "${{ github.workspace }}:/project" -w /project ${{ matrix.image }} /bin/bash -e -c "\
if [ '${{ matrix.generator }}' = 'DEB' ]; then \
apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential cmake fakeroot debhelper dpkg-dev; \
else \
dnf -y update --skip-broken && \
dnf -y install cmake make gcc gcc-c++ rpm-build rpmdevtools; \
fi; \
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release; \
cmake --build build -j$(nproc); \
cpack --config build/CPackConfig.cmake -G ${{ matrix.generator }}; "
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: cpp_unix_bindings_${{ matrix.distro }}
path: build/*.${{ matrix.ext }}
retention-days: 14
- name: Attach package to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: build/*.${{ matrix.ext }}