From c6b5d6f85beebe3327d8604b8ea933052c7908b3 Mon Sep 17 00:00:00 2001 From: Jiri Hnidek Date: Thu, 12 Dec 2024 14:12:53 +0100 Subject: [PATCH] chore[ci]: Added Github action for regular testing package * Added CI job for testing python-iniparse on latest Fedoras and CentOS 10. Tests are triggered on PR request and should be triggered every week on Monday morning * Added script for installing required packages * Also dded configuration for dependabot --- .github/dependabot.yml | 9 +++++++ .github/workflows/pytest.yml | 44 +++++++++++++++++++++++++++++++++++ scripts/container-pre-test.sh | 10 ++++++++ 3 files changed, 63 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/pytest.yml create mode 100644 scripts/container-pre-test.sh diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..13e4e05 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + target-branch: "main" + commit-message: + prefix: "ci" diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..226727e --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,44 @@ +name: pytest + +on: + pull_request: + workflow_dispatch: + schedule: + # at 5:00 every 1st of the month + - cron: 0 5 1 * * + +jobs: + pytest: + name: "pytest" + + permissions: + issues: write + pull-requests: write + + strategy: + fail-fast: false + matrix: + include: + - name: "CentOS Stream 10" + image: "quay.io/centos/centos:stream10" + - name: "Fedora latest" + image: "fedora:latest" + - name: "Fedora Rawhide" + image: "fedora:rawhide" + + runs-on: ubuntu-latest + container: + image: ${{ matrix.image }} + + steps: + - name: "Checkout repository" + uses: actions/checkout@v4 + + - name: "Run container-pre-test.sh" + run: | + bash scripts/container-pre-test.sh + + - name: "Run pytest" + env: + PYTEST_ADDOPTS: "--color=yes --code-highlight=yes --showlocals" + run: python3 -m pytest ${{ matrix.pytest_args }} diff --git a/scripts/container-pre-test.sh b/scripts/container-pre-test.sh new file mode 100644 index 0000000..7c6a407 --- /dev/null +++ b/scripts/container-pre-test.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +source /etc/os-release +# This repository is required for python3-pytest and python3-test +# on Centos Stream +if [[ $ID == "centos" ]]; then + dnf config-manager --enable crb +fi + +dnf install -y python3-setuptools python3-pip python3-devel python3-pytest python3-test