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 and test deb package for linupdate | |
on: | |
push: | |
branches: [ linupdate-2.x.x ] | |
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 | |
with: | |
ref: 'linupdate-2.x.x' | |
- 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/mods-available/ | |
mkdir -p /tmp/linupdate-build/opt/linupdate/mods-enabled/ | |
mkdir -p /tmp/linupdate-build/opt/linupdate/agents-available/ | |
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 -r ${GITHUB_WORKSPACE}/mods-available/* /tmp/linupdate-build/opt/linupdate/mods-available/ | |
cp -r ${GITHUB_WORKSPACE}/service/* /tmp/linupdate-build/opt/linupdate/service/ | |
cp ${GITHUB_WORKSPACE}/linupdate /tmp/linupdate-build/opt/linupdate/linupdate | |
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@v3 | |
with: | |
name: linupdate-test-build_${{ env.VERSION }}_all.deb | |
path: /tmp/linupdate-test-build_${{ env.VERSION }}_all.deb | |
retention-days: 1 | |
# 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 | |
with: | |
ref: 'linupdate-2.x.x' | |
- 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: Test some params | |
# run: | | |
# /opt/linupdate/linupdate --help | |
# /opt/linupdate/linupdate --version | |
# /opt/linupdate/linupdate --check-updates | |
# /opt/linupdate/linupdate --profile container | |
# /opt/linupdate/linupdate --env test | |
# /opt/linupdate/linupdate --mod-enable reposerver | |
# /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 | |
# /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register | |
# /opt/linupdate/linupdate --mod-configure reposerver --send-full-status | |
# /opt/linupdate/linupdate --mod-configure reposerver --unregister | |
# 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 | |
with: | |
ref: 'linupdate-2.x.x' | |
- 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: Test some params | |
# run: | | |
# /opt/linupdate/linupdate --help | |
# /opt/linupdate/linupdate --version | |
# /opt/linupdate/linupdate --check-updates | |
# /opt/linupdate/linupdate --profile container | |
# /opt/linupdate/linupdate --env test | |
# /opt/linupdate/linupdate --mod-enable reposerver | |
# /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 | |
# /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register | |
# /opt/linupdate/linupdate --mod-configure reposerver --send-full-status | |
# /opt/linupdate/linupdate --mod-configure reposerver --unregister | |
# Try to install package on Debian 12 | |
install-debian-12: | |
name: Install on Debian 12 | |
needs: | |
build-deb | |
runs-on: ubuntu-latest | |
container: | |
image: debian:12 | |
options: --user root | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: 'linupdate-2.x.x' | |
- 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: Test some params | |
# run: | | |
# /opt/linupdate/linupdate --help | |
# /opt/linupdate/linupdate --version | |
# /opt/linupdate/linupdate --check-updates | |
# /opt/linupdate/linupdate --profile container | |
# /opt/linupdate/linupdate --env test | |
# /opt/linupdate/linupdate --mod-enable reposerver | |
# /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 | |
# /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register | |
# /opt/linupdate/linupdate --mod-configure reposerver --send-full-status | |
# /opt/linupdate/linupdate --mod-configure reposerver --unregister | |
# 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 | |
with: | |
ref: 'linupdate-2.x.x' | |
- 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: Test some params | |
# run: | | |
# sudo /opt/linupdate/linupdate --help | |
# sudo /opt/linupdate/linupdate --version | |
# sudo /opt/linupdate/linupdate --check-updates | |
# sudo /opt/linupdate/linupdate --profile container | |
# sudo /opt/linupdate/linupdate --env test | |
# sudo /opt/linupdate/linupdate --mod-enable reposerver | |
# sudo /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 | |
# sudo /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register | |
# sudo /opt/linupdate/linupdate --mod-configure reposerver --send-full-status | |
# sudo /opt/linupdate/linupdate --mod-configure reposerver --unregister |