From 82d554d0efaebff782539df73a76739443b595cd Mon Sep 17 00:00:00 2001 From: mhorky Date: Wed, 7 Feb 2024 10:56:52 +0100 Subject: [PATCH] feat(ci): Add CI tests * Card ID: CCT-364 Start running our small test suite when PR is opened or updated. (Adapted from 397fe6f2ba7d03057cb49453775e952e4d53d8bc) --- .github/workflows/pytest.yml | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/pytest.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 00000000..cf428b82 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,41 @@ +name: pytest + +on: + pull_request: + paths: + - "src/**" + +jobs: + pytest: + strategy: + fail-fast: false + matrix: + include: + - name: "CentOS 7" + image: "quay.io/centos/centos:7" + + runs-on: "ubuntu-latest" + container: + image: ${{ matrix.image }} + + steps: + - name: "Checkout the repository" + uses: actions/checkout@v4 + + - name: "Install dependencies" + # We can't run 'pip install' over the core repo, pip 20 doesn't understand the 'extras_require' in its setup.py + run: | + yum install -y epel-release git-core + yum install -y python-pip + python -m pip install --upgrade 'pip<21' + python -m pip install -r src/insights_client/tests/requirements.txt + git clone https://github.com/RedHatInsights/insights-core.git /tmp/egg + + - name: "Run pytest" + env: + PYTEST_ADDOPTS: "--color=yes --code-highlight=yes --showlocals" + PYTHONPATH: "src/:/tmp/egg/" + EGG: "/tmp/egg/" + BYPASS_GPG: "true" + run: | + python -m pytest src/insights_client/tests