Skip to content

Commit 7872279

Browse files
author
Cecylia Borek
committed
update test github workflow
1 parent 8a298ae commit 7872279

File tree

4 files changed

+84
-16
lines changed

4 files changed

+84
-16
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Setup Python Testing Environment
2+
description: Sets up Python and dependencies for tests
3+
inputs:
4+
python-version:
5+
required: true
6+
runs:
7+
using: composite
8+
steps:
9+
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
10+
- name: Setup Python
11+
uses: actions/setup-python@9322b3ca74000aeb2c01eb777b646334015ddd72
12+
with:
13+
python-version: ${{ inputs.python-version }}
14+
- name: Install dependencies
15+
run: pip install tox
16+
shell: bash

.github/workflows/test.yml

Lines changed: 65 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,26 @@ name: Python CI
22
on: [push, workflow_dispatch]
33

44
jobs:
5-
build:
5+
unit-tests:
6+
runs-on: ${{ matrix.os }}
7+
strategy:
8+
matrix:
9+
os: [ubuntu-latest]
10+
python-version: [3.9, 3.13]
11+
include:
12+
- os: ubuntu-22.04
13+
python-version: 3.7
14+
fail-fast: false
15+
steps:
16+
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
17+
- uses: ./.github/actions/setup-python
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Run Unit Tests
21+
run: tox -e py -- tests/unit
22+
23+
integration-tests:
24+
needs: unit-tests
625
runs-on: ${{ matrix.os }}
726
strategy:
827
fail-fast: false
@@ -11,25 +30,58 @@ jobs:
1130
python-version: [3.9]
1231
splunk-version: [9.4, latest]
1332
include:
14-
# Oldest possible configuration
15-
# Last Ubuntu version with Python 3.7 binaries available
1633
- os: ubuntu-22.04
1734
python-version: 3.7
18-
splunk-version: 9.1
19-
# Latest possible configuration
35+
splunk-version: "9.1"
2036
- os: ubuntu-latest
2137
python-version: 3.13
2238
splunk-version: latest
2339
steps:
24-
- name: Checkout code
25-
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
40+
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
41+
42+
- uses: ./.github/actions/setup-python
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
os: ${{ matrix.os }}
46+
2647
- name: Run docker compose
2748
run: SPLUNK_VERSION=${{ matrix.splunk-version }} docker compose up -d
28-
- name: Setup Python
29-
uses: actions/setup-python@9322b3ca74000aeb2c01eb777b646334015ddd72
49+
50+
- name: Wait for Splunk setup completion
51+
run: make wait_up
52+
53+
- name: Run integration tests
54+
run: tox -e py -- tests/integration
55+
56+
system-tests:
57+
needs: unit-tests
58+
runs-on: ${{ matrix.os }}
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
os: [ubuntu-latest]
63+
python-version: [3.9]
64+
splunk-version: [9.4, latest]
65+
include:
66+
- os: ubuntu-22.04
67+
python-version: 3.7
68+
splunk-version: "9.1"
69+
- os: ubuntu-latest
70+
python-version: 3.13
71+
splunk-version: latest
72+
steps:
73+
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
74+
75+
- uses: ./.github/actions/setup-python
3076
with:
3177
python-version: ${{ matrix.python-version }}
32-
- name: Install tox
33-
run: pip install tox
34-
- name: Test Execution
35-
run: tox -e py
78+
os: ${{ matrix.os }}
79+
80+
- name: Run docker compose (System)
81+
run: SPLUNK_VERSION=${{matrix.splunk-version}} docker compose up -d
82+
83+
- name: Wait for Splunk setup completion
84+
run: make wait_up
85+
86+
- name: Run System Tests
87+
run: tox -e py -- tests/system

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ docs:
3434
.PHONY: test
3535
test:
3636
@echo "$(ATTN_COLOR)==> test $(NO_COLOR)"
37-
@tox -e py37,py39
37+
@tox
3838

3939
.PHONY: test_specific
4040
test_specific:

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = clean,docs,py37,py39,313
2+
envlist = clean,py{37,39,313}
33
skipsdist = {env:TOXBUILD:false}
44

55
[testenv:pep8]
@@ -32,7 +32,7 @@ deps = pytest
3232

3333
distdir = build
3434
commands =
35-
{env:TOXBUILD:python -m pytest --junitxml=test-reports/junit-{envname}.xml --cov --cov-config=.coveragerc} {posargs}
35+
{env:TOXBUILD:python -m pytest --junitxml=test-reports/junit-{envname}.xml --cov --cov-config=.coveragerc} {posargs:tests}
3636

3737
[testenv:clean]
3838
deps = coverage

0 commit comments

Comments
 (0)