Moving CI to RockyLinux as CentOS7 is deprecated #186
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: [ 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@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/ | |
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 | |
- 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 | |
# 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 | |
# 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 |