Maintain compatibility with el7 #182
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 rpm package for linupdate | |
on: | |
push: | |
branches: [ devel ] | |
pull_request: | |
push: | |
branches: [ main ] | |
jobs: | |
build-rpm: | |
name: Build rpm package | |
runs-on: ubuntu-latest | |
container: | |
image: rockylinux:9.3 | |
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: | | |
yum update -y | |
yum 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/mods-available/ | |
mkdir -p /opt/linupdate/mods-enabled/ | |
mkdir -p /opt/linupdate/agents-available/ | |
mkdir -p /opt/linupdate/agents-enabled/ | |
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}/mods-available/* /opt/linupdate/mods-available/ | |
cp -r ${GITHUB_WORKSPACE}/service/* /opt/linupdate/service/ | |
cp ${GITHUB_WORKSPACE}/linupdate /opt/linupdate/linupdate | |
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 | |
sed -i "s/__RELEASEVER__/el9/g" $HOME/rpmbuild/SPECS/linupdate.spec | |
- name: Build package | |
run: | | |
cd $HOME/rpmbuild/SPECS | |
rpmbuild --target noarch -bb --quiet linupdate.spec | |
mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-el9.noarch.rpm /tmp/linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm | |
path: /tmp/linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm | |
retention-days: 1 | |
# Try to install package on latest Fedora | |
install-fedora: | |
name: Install on Fedora 37 | |
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 }}-el9.noarch.rpm | |
- name: Install package | |
run: | | |
dnf update -y | |
yum clean all | |
yum --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm | |