Build E2SAR .deb and .rpms #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build E2SAR .deb and .rpms | |
on: | |
workflow_dispatch: | |
env: | |
E2SAR_VER: 0.1.1 | |
E2SAR_DEP: boost-1.85.0-grpc-1.54.1 | |
FINAL_INSTALL: /usr/local | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] | |
steps: | |
- name: Set up environment | |
run: | | |
if [[ ${{ matrix.os }} == *"ubuntu"* ]]; then | |
sudo apt-get -yq update | |
sudo apt-get -yq install python3-pip build-essential autoconf cmake libtool pkg-config libglib2.0-dev ninja-build openssl libssl-dev libsystemd-dev protobuf-compiler libre2-dev rubygems build-essential squashfs-tools | |
sudo gem install fpm | |
elif [[ ${{ matrix.os }} == *"rocky"* ]]; then | |
sudo dnf -yq install epel-release | |
sudo dnf -yq --enablerepo=devel update | |
sudo dnf -yq --enablerepo=devel install gcc gcc-c++ kernel-devel make | |
sudo dnf -yq --enablerepo=devel install python3-pip autoconf cmake libtool pkg-config ninja-build openssl protobuf-compiler glib2-devel re2-devel libquadmath-devel python39-devel python39 rpm-build squashfs-tools ruby | |
sudo update-alternatives --set python /usr/bin/python3.9 | |
sudo update-alternatives --set python3 /usr/bin/python3.9 | |
pip3 install --user meson pybind11 | |
sudo gem install fpm | |
fi | |
- name: Install Python dependencies | |
run: | | |
if [[ ${{ matrix.os }} == "ubuntu-20.04" ]]; then | |
echo Installing Python3.10 | |
sudo apt-get -yq update | |
sudo apt-get install -yq software-properties-common | |
sudo add-apt-repository -y ppa:deadsnakes/ppa | |
sudo apt-get -yq update | |
sudo apt-get -yq install python3.10 python3.10-venv libpython3.10-dev | |
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 | |
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2 | |
elif [[ ${{ matrix.os }} == "ubuntu-22.04" ]]; then | |
sudo apt-get install -yq python3-venv libpython3-dev | |
elif [[ ${{ matrix.os }} == "ubuntu-24.04" ]]; then | |
sudo apt-get install -yq python3-venv libpython3-dev | |
fi | |
python3 -m venv ~/venv | |
. ~/venv/bin/activate | |
pip3 install meson pybind11 | |
- name: Set up authentication for HTTPS | |
run: | | |
git config --global url."https://github.com/".insteadOf "[email protected]:" # Force HTTPS to use PAT | |
- name: Checkout E2SAR code | |
uses: actions/checkout@v4 | |
with: | |
path: E2SAR | |
submodules: true | |
token: ${{ secrets.CLASSIC_REPO_PAT }} | |
- name: Create install directories | |
run: | | |
mkdir -p package/usr/local/include/ | |
mkdir -p package/usr/local/lib | |
mkdir -p package/usr/local/lib64 | |
- name: Download built boost and grpc artifact | |
if: steps.cache.outputs.cache-hit != 'true' # Only run if cache wasn't hit | |
id: download-artifact | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
workflow: builddeps.yml | |
name: ${{ matrix.os }}-package-e2sar-deps-${{ env.E2SAR_VER }} | |
path: ./ | |
- name: Untar the grpc and boost install tree | |
run: | | |
ls ./ | |
tar -zxf package-e2sar-deps-${{ env.E2SAR_VER }}.tar.gz | |
ls -l package/usr/local/bin | |
- name: Build E2SAR using Meson | |
run: | | |
. ~/venv/bin/activate | |
export IDIR=`pwd`/package/usr/local | |
cd E2SAR | |
BOOST_ROOT=${IDIR} PATH=${IDIR}/bin:$PATH LD_LIBRARY_PATH=${IDIR}/lib meson setup -Dpkg_config_path=${IDIR}/lib/pkgconfig/:${IDIR}/lib64/pkgconfig/ --prefix ${IDIR} build && sed -i 's/-std=c++11//g' build/build.ninja | |
PATH=${IDIR}/bin:$PATH LD_LIBRARY_PATH=${IDIR}/lib meson compile -C build | |
PATH=${IDIR}/bin:$PATH LD_LIBRARY_PATH=${IDIR}/lib meson test -C build --suite=unit --timeout=0 | |
PATH=${IDIR}/bin:$PATH LD_LIBRARY_PATH=${IDIR}/lib meson install -C build | |
- name: Update pkgconfig prefix files for final installation | |
run: | | |
# update pkgconfig files for the install location. DESTDIR didn't work | |
export IDIR=`pwd`/package/usr/local | |
echo Updating pkgconfig files prefix from ${IDIR} to ${{ env.FINAL_INSTALL }} | |
for file in `ls -1 ${IDIR}/lib/pkgconfig`; do sed -i "s|${IDIR}|${{ env.FINAL_INSTALL }}|g" ${IDIR}/lib/pkgconfig/${file}; done | |
echo Updating E2SAR pkgconfig | |
sed -i "s|${IDIR}|${{ env.FINAL_INSTALL }}|g" ${IDIR}/lib/x86_64-linux-gnu/pkgconfig/e2sar.pc | |
- name: Package project into .deb or .rpm | |
run: | | |
pushd package/ && tar -zcf ../e2sar.tar.gz usr/ && popd | |
if [[ ${{ matrix.os }} == *"ubuntu"* ]]; then | |
fpm -s tar -t deb -n e2sar -v ${{ env.E2SAR_VER }} --prefix=/ e2sar.tar.gz | |
elif [[ ${{ matrix.os }} == *"rocky"* ]]; then | |
fpm -s tar -t deb -n e2sar -v ${{ env.E2SAR_VER }} --prefix=/ e2sar.tar.gz | |
fi | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-e2sar-${{ github.ref_name }}-${{ env.E2SAR_VER }}-package | |
path: | | |
*.deb | |
*.rpm |