Skip to content
name: Build and test deb package for linupdate
on:
push:
branches: [ devel ]
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@v4
- 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/
mkdir -p /tmp/linupdate-build/opt/linupdate/templates/
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 -r ${GITHUB_WORKSPACE}/templates/* /tmp/linupdate-build/opt/linupdate/templates/
cp ${GITHUB_WORKSPACE}/linupdate.py /tmp/linupdate-build/opt/linupdate/linupdate.py
cp ${GITHUB_WORKSPACE}/service.py /tmp/linupdate-build/opt/linupdate/service.py
cp ${GITHUB_WORKSPACE}/version /tmp/linupdate-build/opt/linupdate/version
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@v4
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@v4
# - 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@v4
# 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 (Debian 11)
needs:
build-deb
runs-on: ubuntu-latest
container:
image: debian:11
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v4
- 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@v4
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
# Tests some params
- name: "Run test: print help"
run: python3 /opt/linupdate/linupdate.py --help
- name: "Run test: print configuration"
run: python3 /opt/linupdate/linupdate.py --show-config
- name: "Run test: print version"
run: python3 /opt/linupdate/linupdate.py --version
- name: "Run test: switch profile"
run: python3 /opt/linupdate/linupdate.py --profile container
- name: "Run test: switch environment"
run: python3 /opt/linupdate/linupdate.py --env test
- name: "Run test: disable mail"
run: python3 /opt/linupdate/linupdate.py --mail-enable false
- name: "Run test: set mail recipient"
run: python3 /opt/linupdate/linupdate.py --set-mail-recipient [email protected],[email protected]
- name: "Run test: set mail smtp host"
run: python3 /opt/linupdate/linupdate.py --set-mail-smtp-host localhost
- name: "Run test: get mail smtp host"
run: python3 /opt/linupdate/linupdate.py --get-mail-smtp-host
- name: "Run test: set mail smtp port"
run: python3 /opt/linupdate/linupdate.py --set-mail-smtp-port 25
- name: "Run test: get mail smtp port"
run: python3 /opt/linupdate/linupdate.py --get-mail-smtp-port
- name: "Run test: set package exclusions"
run: python3 /opt/linupdate/linupdate.py --exclude "kernel.*"
- name: "Run test: get package exclusions"
run: python3 /opt/linupdate/linupdate.py --get-exclude
- name: "Run test: set package exclusions on major update"
run: python3 /opt/linupdate/linupdate.py --exclude-major "apache2,mysql.*"
- name: "Run test: get package exclusions on major update"
run: python3 /opt/linupdate/linupdate.py --get-exclude-major
- name: "Run test: set services to restart after update"
run: python3 /opt/linupdate/linupdate.py --service-restart "apache2,mysql"
- name: "Run test: get services to restart after update"
run: python3 /opt/linupdate/linupdate.py --get-service-restart
- name: "Run test: check updates"
run: python3 /opt/linupdate/linupdate.py --check-updates
- name: "Run text: update specific packages"
run: python3 /opt/linupdate/linupdate.py --update curl,wget,apache2 --assume-yes
- name: "Run test: list available modules"
run: python3 /opt/linupdate/linupdate.py --mod-list
- name: "Run test: enable reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-enable reposerver
- name: "Run test: configure reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.repomanager.net
- name: "Run test: register to reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
- name: "Run test: send all informations to reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --send-all-info
- name: "Run test: unregister from reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --unregister
# Try to install package on Debian 12
install-debian-12:
name: Install (Debian 12)
needs:
build-deb
runs-on: ubuntu-latest
container:
image: debian:12
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v4
- 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@v4
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
# Tests some params
- name: "Run test: print help"
run: python3 /opt/linupdate/linupdate.py --help
- name: "Run test: print configuration"
run: python3 /opt/linupdate/linupdate.py --show-config
- name: "Run test: print version"
run: python3 /opt/linupdate/linupdate.py --version
- name: "Run test: switch profile"
run: python3 /opt/linupdate/linupdate.py --profile container
- name: "Run test: switch environment"
run: python3 /opt/linupdate/linupdate.py --env test
- name: "Run test: disable mail"
run: python3 /opt/linupdate/linupdate.py --mail-enable false
- name: "Run test: set mail recipient"
run: python3 /opt/linupdate/linupdate.py --set-mail-recipient [email protected],[email protected]
- name: "Run test: set mail smtp host"
run: python3 /opt/linupdate/linupdate.py --set-mail-smtp-host localhost
- name: "Run test: get mail smtp host"
run: python3 /opt/linupdate/linupdate.py --get-mail-smtp-host
- name: "Run test: set mail smtp port"
run: python3 /opt/linupdate/linupdate.py --set-mail-smtp-port 25
- name: "Run test: get mail smtp port"
run: python3 /opt/linupdate/linupdate.py --get-mail-smtp-port
- name: "Run test: set package exclusions"
run: python3 /opt/linupdate/linupdate.py --exclude "kernel.*"
- name: "Run test: get package exclusions"
run: python3 /opt/linupdate/linupdate.py --get-exclude
- name: "Run test: set package exclusions on major update"
run: python3 /opt/linupdate/linupdate.py --exclude-major "apache2,mysql.*"
- name: "Run test: get package exclusions on major update"
run: python3 /opt/linupdate/linupdate.py --get-exclude-major
- name: "Run test: set services to restart after update"
run: python3 /opt/linupdate/linupdate.py --service-restart "apache2,mysql"
- name: "Run test: get services to restart after update"
run: python3 /opt/linupdate/linupdate.py --get-service-restart
- name: "Run test: check updates"
run: python3 /opt/linupdate/linupdate.py --check-updates
- name: "Run text: update specific packages"
run: python3 /opt/linupdate/linupdate.py --update curl,wget,apache2 --assume-yes
- name: "Run test: list available modules"
run: python3 /opt/linupdate/linupdate.py --mod-list
- name: "Run test: enable reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-enable reposerver
- name: "Run test: configure reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.repomanager.net
- name: "Run test: register to reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
- name: "Run test: send all informations to reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --send-all-info
- name: "Run test: unregister from reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --unregister
# Try to install package on Ubuntu 22.04
install-ubuntu-2204:
name: Install (Ubuntu 22.04)
needs:
build-deb
runs-on: ubuntu-latest
container:
image: ubuntu:22.04
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v4
- 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@v4
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
# Tests some params
- name: "Run test: print help"
run: python3 /opt/linupdate/linupdate.py --help
- name: "Run test: print configuration"
run: python3 /opt/linupdate/linupdate.py --show-config
- name: "Run test: print version"
run: python3 /opt/linupdate/linupdate.py --version
- name: "Run test: switch profile"
run: python3 /opt/linupdate/linupdate.py --profile container
- name: "Run test: switch environment"
run: python3 /opt/linupdate/linupdate.py --env test
- name: "Run test: disable mail"
run: python3 /opt/linupdate/linupdate.py --mail-enable false
- name: "Run test: set mail recipient"
run: python3 /opt/linupdate/linupdate.py --set-mail-recipient [email protected],[email protected]
- name: "Run test: set mail smtp host"
run: python3 /opt/linupdate/linupdate.py --set-mail-smtp-host localhost
- name: "Run test: get mail smtp host"
run: python3 /opt/linupdate/linupdate.py --get-mail-smtp-host
- name: "Run test: set mail smtp port"
run: python3 /opt/linupdate/linupdate.py --set-mail-smtp-port 25
- name: "Run test: get mail smtp port"
run: python3 /opt/linupdate/linupdate.py --get-mail-smtp-port
- name: "Run test: set package exclusions"
run: python3 /opt/linupdate/linupdate.py --exclude "kernel.*"
- name: "Run test: get package exclusions"
run: python3 /opt/linupdate/linupdate.py --get-exclude
- name: "Run test: set package exclusions on major update"
run: python3 /opt/linupdate/linupdate.py --exclude-major "apache2,mysql.*"
- name: "Run test: get package exclusions on major update"
run: python3 /opt/linupdate/linupdate.py --get-exclude-major
- name: "Run test: set services to restart after update"
run: python3 /opt/linupdate/linupdate.py --service-restart "apache2,mysql"
- name: "Run test: get services to restart after update"
run: python3 /opt/linupdate/linupdate.py --get-service-restart
- name: "Run test: check updates"
run: python3 /opt/linupdate/linupdate.py --check-updates
- name: "Run text: update specific packages"
run: python3 /opt/linupdate/linupdate.py --update curl,wget,apache2 --assume-yes
- name: "Run test: list available modules"
run: python3 /opt/linupdate/linupdate.py --mod-list
- name: "Run test: enable reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-enable reposerver
- name: "Run test: configure reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.repomanager.net
- name: "Run test: register to reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
- name: "Run test: send all informations to reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --send-all-info
- name: "Run test: unregister from reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --unregister
# Try to install package on Ubuntu (latest)
install-ubuntu-latest:
name: Install (latest Ubuntu)
needs:
build-deb
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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@v4
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
# Tests some params
- name: "Run test: print help"
run: sudo python3 /opt/linupdate/linupdate.py --help
- name: "Run test: print configuration"
run: sudo python3 /opt/linupdate/linupdate.py --show-config
- name: "Run test: print version"
run: sudo python3 /opt/linupdate/linupdate.py --version
- name: "Run test: switch profile"
run: sudo python3 /opt/linupdate/linupdate.py --profile container
- name: "Run test: switch environment"
run: sudo python3 /opt/linupdate/linupdate.py --env test
- name: "Run test: disable mail"
run: sudo python3 /opt/linupdate/linupdate.py --mail-enable false
- name: "Run test: set mail recipient"
run: sudo python3 /opt/linupdate/linupdate.py --set-mail-recipient [email protected],[email protected]
- name: "Run test: set mail smtp host"
run: sudo python3 /opt/linupdate/linupdate.py --set-mail-smtp-host localhost
- name: "Run test: get mail smtp host"
run: sudo python3 /opt/linupdate/linupdate.py --get-mail-smtp-host
- name: "Run test: set mail smtp port"
run: sudo python3 /opt/linupdate/linupdate.py --set-mail-smtp-port 25
- name: "Run test: get mail smtp port"
run: sudo python3 /opt/linupdate/linupdate.py --get-mail-smtp-port
- name: "Run test: set package exclusions"
run: sudo python3 /opt/linupdate/linupdate.py --exclude "kernel.*"
- name: "Run test: get package exclusions"
run: sudo python3 /opt/linupdate/linupdate.py --get-exclude
- name: "Run test: set package exclusions on major update"
run: sudo python3 /opt/linupdate/linupdate.py --exclude-major "apache2,mysql.*"
- name: "Run test: get package exclusions on major update"
run: sudo python3 /opt/linupdate/linupdate.py --get-exclude-major
- name: "Run test: set services to restart after update"
run: sudo python3 /opt/linupdate/linupdate.py --service-restart "apache2,mysql"
- name: "Run test: get services to restart after update"
run: sudo python3 /opt/linupdate/linupdate.py --get-service-restart
- name: "Run test: check updates"
run: sudo python3 /opt/linupdate/linupdate.py --check-updates
- name: "Run text: update specific packages"
run: sudo python3 /opt/linupdate/linupdate.py --update curl,wget,apache2 --assume-yes
- name: "Run test: list available modules"
run: sudo python3 /opt/linupdate/linupdate.py --mod-list
- name: "Run test: enable reposerver module"
run: sudo python3 /opt/linupdate/linupdate.py --mod-enable reposerver
- name: "Run test: configure reposerver module"
run: sudo python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.repomanager.net
- name: "Run test: register to reposerver"
run: sudo python3 /opt/linupdate/linupdate.py --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
- name: "Run test: send all informations to reposerver"
run: sudo python3 /opt/linupdate/linupdate.py --mod-configure reposerver --send-all-info
- name: "Run test: unregister from reposerver"
run: sudo python3 /opt/linupdate/linupdate.py --mod-configure reposerver --unregister
# Try to migrate from old linupdate (bash) to new linupdate (python) package on Debian 12
migrate-debian-12:
name: Migrate bash linupdate to python linupdate (Debian 12)
needs:
build-deb
runs-on: ubuntu-latest
container:
image: debian:12
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
# Install linupdate bash version
- name: Install linupdate bash version
run: |
apt-get update -y
apt-get install -y curl gpg
curl -sS https://packages.repomanager.net/repo/gpgkeys/packages.repomanager.net.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/packages.repomanager.net.gpg
echo "deb https://packages.repomanager.net/repo/linupdate/bullseye/main_prod bullseye main" > /etc/apt/sources.list.d/linupdate.list
apt-get update -y
apt-get install -y linupdate
# Set up some params
- name: Set up linupdate bash version
run: |
linupdate --profile test-migration
linupdate --env test-migration
linupdate --exclude package1,package2
linupdate --exclude-major package3,package4
sed -i 's/MAIL_RECIPIENT=.*/MAIL_RECIPIENT="[email protected]"/g' /etc/linupdate/linupdate.conf
sed -i 's/SERVICE_RESTART=.*/SERVICE_RESTART="service1,service2"/g' /etc/linupdate/linupdate.conf
linupdate --mod-enable reposerver
linupdate --mod-configure reposerver --url https://packages.repomanager.net --fail-level 3
linupdate --mod-configure reposerver --get-packages-conf-from-reposerver no
linupdate --mod-configure reposerver --get-repos-from-reposerver no
linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
linupdate --mod-configure reposerver --unregister
# Download builded deb package artifact
- name: Download artifact
uses: actions/download-artifact@v4
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
# Tests some params
- name: Print config files content
run: |
cat /etc/linupdate/linupdate.yml /etc/linupdate/update.yml
- name: "Run test: print help"
run: python3 /opt/linupdate/linupdate.py --help
- name: "Run test: print version"
run: python3 /opt/linupdate/linupdate.py --version
- name: "Run test: print profile"
run: python3 /opt/linupdate/linupdate.py --profile
- name: "Run test: print environment"
run: python3 /opt/linupdate/linupdate.py --env
- name: "Run test: get mail recipient"
run: python3 /opt/linupdate/linupdate.py --get-mail-recipient
- name: "Run test: get package exclusions"
run: python3 /opt/linupdate/linupdate.py --get-exclude
- name: "Run test: get package exclusions on major update"
run: python3 /opt/linupdate/linupdate.py --get-exclude-major
- name: "Run test: get services to restart after update"
run: python3 /opt/linupdate/linupdate.py --get-service-restart
- name: "Run test: enable reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-enable reposerver
- name: "Run test: check updates"
run: python3 /opt/linupdate/linupdate.py --check-updates
- name: "Run text: update specific packages"
run: python3 /opt/linupdate/linupdate.py --update curl,wget,apache2 --assume-yes
- name: "Run test: print raw configuration"
run: python3 /opt/linupdate/linupdate.py --show-config
- name: "Run test: print config files"
run: ls -l /etc/linupdate/ /etc/linupdate/modules/