Skip to content

Workflow file for this run

name: Build and test deb package for linupdate
on:
push:
branches: [ python ]
pull_request:
push:
branches: [ main ]
jobs:
build-deb:
name: Build deb package
runs-on: ubuntu-latest
container:
image: debian:latest
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
- name: Install dependencies packages
run: apt-get update && apt-get install build-essential binutils lintian debhelper dh-make devscripts -y
- name: Create build environment
run: |
mkdir -p /tmp/linupdate-build/DEBIAN
mkdir -p /tmp/linupdate-build/etc/linupdate/modules
mkdir -p /tmp/linupdate-build/opt/linupdate
mkdir -p /tmp/linupdate-build/opt/linupdate/src/
# TODO: service not working for now
# mkdir -p /tmp/linupdate-build/opt/linupdate/service/
# mkdir -p /tmp/linupdate-build/lib/systemd/system/
- name: Copy files to include in the build
run: |
cp -r ${GITHUB_WORKSPACE}/src/* /tmp/linupdate-build/opt/linupdate/src/
cp ${GITHUB_WORKSPACE}/linupdate.py /tmp/linupdate-build/opt/linupdate/linupdate.py
cp ${GITHUB_WORKSPACE}/version /tmp/linupdate-build/opt/linupdate/version
# TODO: service not working for now
# cp -r ${GITHUB_WORKSPACE}/service/* /tmp/linupdate-build/opt/linupdate/service/
# cp -r ${GITHUB_WORKSPACE}/service/linupdate.systemd.template /tmp/linupdate-build/lib/systemd/system/linupdate.service
- name: Copy control file
run: |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/deb/control /tmp/linupdate-build/DEBIAN/control
sed -i "s/__VERSION__/${{ env.VERSION }}/g" /tmp/linupdate-build/DEBIAN/control
- name: Copy preinst and postinst script
run: |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/deb/preinst /tmp/linupdate-build/DEBIAN/preinst
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/deb/postinst /tmp/linupdate-build/DEBIAN/postinst
chmod 755 /tmp/linupdate-build/DEBIAN/preinst /tmp/linupdate-build/DEBIAN/postinst
- name: Build package
run: |
cd /tmp
dpkg-deb --build linupdate-build
mv /tmp/linupdate-build.deb /tmp/linupdate-test-build_${{ env.VERSION }}_all.deb
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: linupdate-test-build_${{ env.VERSION }}_all.deb
path: /tmp/linupdate-test-build_${{ env.VERSION }}_all.deb
retention-days: 1
# Linupdate 3 is not working on Debian 10
# Try to install package on Debian 10
# install-debian-10:
# name: Install on Debian 10
# needs:
# build-deb
# runs-on: ubuntu-latest
# container:
# image: debian:10
# options: --user root
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Get linupdate version
# run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
# # Download builded deb package artifact
# - name: Download artifact
# uses: actions/download-artifact@v3
# with:
# name: linupdate-test-build_${{ env.VERSION }}_all.deb
# - name: Install package
# run: |
# apt-get update -y
# apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb
# - name: Launch linupdate
# run: python3 /opt/linupdate/linupdate.py --check-updates
# Try to install package on Debian 11
install-debian-11:
name: Install on Debian 11
needs:
build-deb
runs-on: ubuntu-latest
container:
image: debian:11
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
# Download builded deb package artifact
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build_${{ env.VERSION }}_all.deb
- name: Install package
run: |
apt-get update -y
apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb
- name: Launch linupdate
run: python3 /opt/linupdate/linupdate.py --check-updates
# Try to install package on Ubuntu (latest)
install-ubuntu:
name: Install on Ubuntu (latest)
needs:
build-deb
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
# Download builded deb package artifact
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build_${{ env.VERSION }}_all.deb
- name: Install package
run: |
sudo apt-get update -y
sudo apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb
- name: Launch linupdate
run: sudo python3 /opt/linupdate/linupdate.py --check-updates