Skip to content

Workflow file for this run

name: Build and test rpm package for linupdate
on:
push:
branches: [ python ]
pull_request:
push:
branches: [ main ]
jobs:
build-rpm:
name: Build rpm package
runs-on: ubuntu-latest
container:
image: centos:8
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 CentOS8 archive repositories
run: |
rm /etc/yum.repos.d/* -f
echo "[os]
name=os repo
baseurl=https://vault.centos.org/8-stream/BaseOS/x86_64/os/
enabled=1
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256
gpgcheck=1" > /etc/yum.repos.d/os.repo
echo "[appstream]
name=updates repo
baseurl=https://vault.centos.org/8-stream/AppStream/x86_64/os/
enabled=1
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256
gpgcheck=1" > /etc/yum.repos.d/appstream.repo
echo "[extras]
name=extras repo
baseurl=https://vault.centos.org/8-stream/extras/x86_64/extras-common/
enabled=1
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256
gpgcheck=1" > /etc/yum.repos.d/extras.repo
dnf clean all
- name: Install dependencies packages
run: |
dnf install rpmdevtools rpmlint -y
- name: Create build environment
run: |
mkdir -p $HOME/rpmbuild/BUILD
mkdir -p $HOME/rpmbuild/BUILDROOT
mkdir -p $HOME/rpmbuild/RPMS
mkdir -p $HOME/rpmbuild/SOURCES
mkdir -p $HOME/rpmbuild/SPECS
mkdir -p /etc/linupdate/modules
mkdir -p /opt/linupdate
mkdir -p /opt/linupdate/src/
mkdir -p /opt/linupdate/service/
mkdir -p /lib/systemd/system/
- name: Copy files to include in the build
run: |
cp -r ${GITHUB_WORKSPACE}/src/* /opt/linupdate/src/
cp -r ${GITHUB_WORKSPACE}/service/* /opt/linupdate/service/
cp ${GITHUB_WORKSPACE}/linupdate.py /opt/linupdate/linupdate.py
cp ${GITHUB_WORKSPACE}/version /opt/linupdate/version
cp -r ${GITHUB_WORKSPACE}/service/linupdate.systemd.template /lib/systemd/system/linupdate.service
- name: Copy spec file
run: |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/rpm/spec $HOME/rpmbuild/SPECS/linupdate.spec
sed -i "s/__VERSION__/${{ env.VERSION }}/g" $HOME/rpmbuild/SPECS/linupdate.spec
- name: Build package
run: |
cd $HOME/rpmbuild/SPECS
rpmbuild --target noarch -bb linupdate.spec
mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-stable.noarch.rpm /tmp/linupdate-test-build-${{ env.VERSION }}.noarch.rpm
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm
path: /tmp/linupdate-test-build-${{ env.VERSION }}.noarch.rpm
retention-days: 1
# Try to install package on CentOS8
# install-centos8:
# name: Install on CentOS8
# needs:
# build-rpm
# runs-on: ubuntu-latest
# container:
# image: centos:8
# options: --user root
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Install CentOS8 archive repositories
# run: |
# rm /etc/yum.repos.d/* -f
# echo "[os]
# name=os repo
# baseurl=https://vault.centos.org/8-stream/BaseOS/x86_64/os/
# enabled=1
# gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256
# gpgcheck=1" > /etc/yum.repos.d/os.repo
# echo "[appstream]
# name=updates repo
# baseurl=https://vault.centos.org/8-stream/AppStream/x86_64/os/
# enabled=1
# gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256
# gpgcheck=1" > /etc/yum.repos.d/appstream.repo
# echo "[extras]
# name=extras repo
# baseurl=https://vault.centos.org/8-stream/extras/x86_64/extras-common/
# enabled=1
# gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256
# gpgcheck=1" > /etc/yum.repos.d/extras.repo
# dnf clean all
# - 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 }}.noarch.rpm
# - name: Install package
# run: |
# dnf update -y
# dnf clean all
# dnf --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm
# - name: Launch linupdate
# run: python3 /opt/linupdate/linupdate.py --check-updates
# - name: Test some params
# run: |
# python3 /opt/linupdate/linupdate.py --help
# python3 /opt/linupdate/linupdate.py --version
# python3 /opt/linupdate/linupdate.py --check-updates
# python3 /opt/linupdate/linupdate.py --profile container
# python3 /opt/linupdate/linupdate.py --env test
# Try to install package on latest Fedora
install-fedora:
name: Install on latest Fedora
needs:
build-rpm
runs-on: ubuntu-latest
container:
image: fedora:latest
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 }}.noarch.rpm
- name: Install package
run: |
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y
dnf clean all
dnf update -y
dnf --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm
- name: Launch linupdate
run: python3 /opt/linupdate/linupdate.py --check-updates
- name: Test some params
run: |
python3 /opt/linupdate/linupdate.py --help
python3 /opt/linupdate/linupdate.py --version
python3 /opt/linupdate/linupdate.py --check-updates
python3 /opt/linupdate/linupdate.py --profile container
python3 /opt/linupdate/linupdate.py --env test