Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion .github/scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,25 @@
set -e

LINUPDATE_CMD="${LINUPDATE_CMD:-python3 /opt/linupdate/linupdate.py}"
LINUPDATE_PROFILE="${LINUPDATE_PROFILE:ci-default}"
LINUPDATE_PROFILE="${LINUPDATE_PROFILE:-ci-default}"

# Get OS family (either "debian" or "rhel")
OS_FAMILY=""
if [ -f /etc/os-release ]; then
. /etc/os-release
case "$ID" in
ubuntu|debian)
OS_FAMILY="debian"
;;
centos|rocky|almalinux|fedora)
OS_FAMILY="rhel"
;;
*)
echo "Unsupported OS: $ID"
exit 1
;;
esac
fi

# Wrapper that runs linupdate using the configured command (allowing a sudo
# prefix). Word-splitting on LINUPDATE_CMD is intentional here.
Expand All @@ -35,6 +53,16 @@ run_test() {
echo "::endgroup::"
}

install_cowsay() {
if [ "$OS_FAMILY" = "debian" ]; then
apt-get install -y cowsay
elif [ "$OS_FAMILY" = "rhel" ]; then
dnf install -y cowsay
fi
}

run_test "install cowsay for testing purposes" install_cowsay

run_test "print help" \
linupdate --help

Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/build-and-test-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ jobs:
# install-debian-10:

# Try to install package on Debian 11
install-debian-11:
name: Install and test on Debian 11
needs:
- build-deb
- upload
uses: ./.github/workflows/install-and-test-on-debian11.yml
secrets: inherit
# EOL: fails on packages update test
# install-debian-11:
# name: Install and test on Debian 11
# needs:
# - build-deb
# - upload
# uses: ./.github/workflows/install-and-test-on-debian11.yml
# secrets: inherit

# Try to install package on Debian 12
install-debian-12:
Expand Down
41 changes: 34 additions & 7 deletions .github/workflows/build-and-test-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,40 @@ jobs:
secrets: inherit

# Fedora 41
# test-fedora41:
# name: Install and test on Fedora 41
# needs:
# - build-rpm
# - upload
# uses: ./.github/workflows/install-and-test-on-fedora41.yml
# secrets: inherit
test-fedora41:
name: Install and test on Fedora 41
needs:
- build-rpm
- upload
uses: ./.github/workflows/install-and-test-on-fedora41.yml
secrets: inherit

# Fedora 42
test-fedora42:
name: Install and test on Fedora 42
needs:
- build-rpm
- upload
uses: ./.github/workflows/install-and-test-on-fedora42.yml
secrets: inherit

# Fedora 43
test-fedora43:
name: Install and test on Fedora 43
needs:
- build-rpm
- upload
uses: ./.github/workflows/install-and-test-on-fedora43.yml
secrets: inherit

# Fedora 44
test-fedora44:
name: Install and test on Fedora 44
needs:
- build-rpm
- upload
uses: ./.github/workflows/install-and-test-on-fedora44.yml
secrets: inherit

# Rocky Linux
test-rockylinux9:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-and-test-on-almalinux10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

jobs:
# Try to install package on Alma Linux 10
install-almalinux10:
install-test-almalinux10:
runs-on: ubuntu-latest
container:
image: almalinux:10
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-and-test-on-almalinux9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

jobs:
# Try to install package on Alma Linux 9
install-almalinux9:
install-test-almalinux9:
runs-on: ubuntu-latest
container:
image: almalinux:9
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-and-test-on-centos8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:

jobs:
install-centos8:
install-test-centos8:
runs-on: ubuntu-latest
container:
image: centos:8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-and-test-on-debian11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:

jobs:
install-debian-11:
install-test-debian-11:
runs-on: ubuntu-latest
container:
image: debian:11
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-and-test-on-debian12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:

jobs:
install-debian-12:
install-test-debian-12:
runs-on: ubuntu-latest
container:
# Intentionally using an old image to have a list of packages to update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-and-test-on-debian13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:

jobs:
install-debian-13:
install-test-debian-13:
runs-on: ubuntu-latest
container:
image: debian:13
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/install-and-test-on-fedora40.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

jobs:
# Try to install package on Fedora 40
install-fedora40:
install-test-fedora40:
runs-on: ubuntu-latest
container:
image: fedora:40
Expand All @@ -16,9 +16,6 @@ jobs:
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV

# - name: Enable CRB repository (required to install python3-pygments for python3-rich)
# run: dnf config-manager --set-enabled crb

- name: Update system
run: dnf update -y

Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/install-and-test-on-fedora41.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

jobs:
# Try to install package on Fedora 41
install-fedora41:
install-test-fedora41:
runs-on: ubuntu-latest
container:
image: fedora:41
Expand All @@ -16,9 +16,6 @@ jobs:
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV

# - name: Enable CRB repository (required to install python3-pygments for python3-rich)
# run: dnf config-manager --set-enabled crb

- name: Update system
run: dnf update -y

Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/install-and-test-on-fedora42.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Try to install package on Fedora 42 and run some basic commands to check if it's working
on:
workflow_call:

jobs:
# Try to install package on Fedora 42
install-test-fedora42:
runs-on: ubuntu-latest
container:
image: fedora:42
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV

- name: Update system
run: dnf update -y

# Download builded rpm package artifact
- name: Download artifact
uses: actions/download-artifact@v8
with:
name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm

- name: Install package
run: dnf --nogpgcheck install -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm

# Run common test suite (shared across all distributions)
- name: Run test suite
env:
REPOSITORY_TEST_URL: ${{ secrets.REPOSITORY_TEST_URL }}
REPOSITORY_TEST_TOKEN: ${{ secrets.REPOSITORY_TEST_TOKEN }}
REPOS_CONFIG_DIR: /etc/yum.repos.d
LINUPDATE_PROFILE: linupdate-ci-rhel-systems
run: bash ${GITHUB_WORKSPACE}/.github/scripts/run-tests.sh
38 changes: 38 additions & 0 deletions .github/workflows/install-and-test-on-fedora43.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Try to install package on Fedora 43 and run some basic commands to check if it's working
on:
workflow_call:

jobs:
# Try to install package on Fedora 43
install-test-fedora43:
runs-on: ubuntu-latest
container:
image: fedora:43
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV

- name: Update system
run: dnf update -y

# Download builded rpm package artifact
- name: Download artifact
uses: actions/download-artifact@v8
with:
name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm

- name: Install package
run: dnf --nogpgcheck install -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm

# Run common test suite (shared across all distributions)
- name: Run test suite
env:
REPOSITORY_TEST_URL: ${{ secrets.REPOSITORY_TEST_URL }}
REPOSITORY_TEST_TOKEN: ${{ secrets.REPOSITORY_TEST_TOKEN }}
REPOS_CONFIG_DIR: /etc/yum.repos.d
LINUPDATE_PROFILE: linupdate-ci-rhel-systems
run: bash ${GITHUB_WORKSPACE}/.github/scripts/run-tests.sh
38 changes: 38 additions & 0 deletions .github/workflows/install-and-test-on-fedora44.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Try to install package on Fedora 44 and run some basic commands to check if it's working
on:
workflow_call:

jobs:
# Try to install package on Fedora 44
install-test-fedora44:
runs-on: ubuntu-latest
container:
image: fedora:44
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV

- name: Update system
run: dnf update -y

# Download builded rpm package artifact
- name: Download artifact
uses: actions/download-artifact@v8
with:
name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm

- name: Install package
run: dnf --nogpgcheck install -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm

# Run common test suite (shared across all distributions)
- name: Run test suite
env:
REPOSITORY_TEST_URL: ${{ secrets.REPOSITORY_TEST_URL }}
REPOSITORY_TEST_TOKEN: ${{ secrets.REPOSITORY_TEST_TOKEN }}
REPOS_CONFIG_DIR: /etc/yum.repos.d
LINUPDATE_PROFILE: linupdate-ci-rhel-systems
run: bash ${GITHUB_WORKSPACE}/.github/scripts/run-tests.sh
2 changes: 1 addition & 1 deletion .github/workflows/install-and-test-on-rockylinux9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

jobs:
# Try to install package on Rocky Linux 9
install-rockylinux9:
install-test-rockylinux9:
runs-on: ubuntu-latest
container:
image: rockylinux/rockylinux:9
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-and-test-on-ubuntu-2204.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:

jobs:
install-ubuntu-2204:
install-test-ubuntu-2204:
runs-on: ubuntu-latest
container:
image: ubuntu:22.04
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-and-test-on-ubuntu-2404.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:

jobs:
install-ubuntu-2404:
install-test-ubuntu-2404:
runs-on: ubuntu-latest
container:
image: ubuntu:24.04
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-and-test-on-ubuntu-2604.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:

jobs:
install-ubuntu-2604:
install-test-ubuntu-2604:
runs-on: ubuntu-latest
container:
image: ubuntu:26.04
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/packaging/deb/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ fi
# Delete service symlink if exists
rm -f /etc/systemd/system/linupdate.service

# Only if systemd is installed (not the case on github runners)
if [ -f "/usr/bin/systemctl" ];then
# Only if systemd is installed and actually running as init (not the case on github runners)
if [ -f "/usr/bin/systemctl" ] && [ -d "/run/systemd/system" ];then
# Stop service if started
if /usr/bin/systemctl is-active --quiet linupdate;then
# Do not stop if there is a /tmp/linupdate.restart-needed file, the service will restart itself
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/packaging/rpm/spec
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ fi
# Delete service symlink if exists
rm -f /etc/systemd/system/linupdate.service

# Only if systemd is installed (not the case on github runners)
if [ -f "/usr/bin/systemctl" ];then
# Only if systemd is installed and actually running as init (not the case on github runners)
if [ -f "/usr/bin/systemctl" ] && [ -d "/run/systemd/system" ];then
# Stop service if started
if /usr/bin/systemctl is-active --quiet linupdate;then
# Do not stop if there is a /tmp/linupdate.restart-needed file, the service will restart itself
Expand Down Expand Up @@ -94,8 +94,8 @@ ln -sf /opt/linupdate/linupdate.py /usr/bin/linupdate
chmod 750 /etc/linupdate
chmod 750 /opt/linupdate

# Only if systemd is installed (not the case on github runners)
if [ -f "/usr/bin/systemctl" ];then
# Only if systemd is installed and actually running as init (not the case on github runners)
if [ -f "/usr/bin/systemctl" ] && [ -d "/run/systemd/system" ];then
# Copy systemd unit file if not exists
if [ ! -f "/lib/systemd/system/linupdate.service" ];then
cp /opt/linupdate/templates/linupdate.systemd.template /lib/systemd/system/linupdate.service
Expand Down
Loading