Skip to content

Commit fca76ff

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

File tree

4 files changed

+83
-19
lines changed

4 files changed

+83
-19
lines changed

.github/workflows/setup-python.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Setup Python Testing Environment
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-version:
7+
required: true
8+
type: string
9+
os:
10+
required: false
11+
type: string
12+
default: ubuntu-latest
13+
14+
jobs:
15+
setup-python:
16+
runs-on: ${{ inputs.os }}
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@9322b3ca74000aeb2c01eb777b646334015ddd72
23+
with:
24+
python-version: ${{ inputs.python-version }}
25+
26+
- name: Install tox
27+
run: pip install tox

.github/workflows/test.yml

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,71 @@ name: Python CI
22
on: [push, workflow_dispatch]
33

44
jobs:
5-
build:
6-
runs-on: ${{ matrix.os }}
5+
unit-tests:
6+
uses: ./.github/workflows/setup-python.yml
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+
with:
16+
python-version: ${{ matrix.python-version }}
17+
os: ${{ matrix.os }}
18+
steps:
19+
- name: Run Unit Tests
20+
run: tox -e py -- tests/unit
21+
22+
integration-tests:
23+
needs: unit-tests
24+
uses: ./.github/workflows/setup-python.yml
725
strategy:
826
fail-fast: false
927
matrix:
1028
os: [ubuntu-latest]
1129
python-version: [3.9]
1230
splunk-version: [9.4, latest]
1331
include:
14-
# Oldest possible configuration
15-
# Last Ubuntu version with Python 3.7 binaries available
1632
- os: ubuntu-22.04
1733
python-version: 3.7
18-
splunk-version: 9.1
19-
# Latest possible configuration
34+
splunk-version: "9.1"
2035
- os: ubuntu-latest
2136
python-version: 3.13
2237
splunk-version: latest
2338
steps:
24-
- name: Checkout code
25-
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
2639
- name: Run docker compose
2740
run: SPLUNK_VERSION=${{ matrix.splunk-version }} docker compose up -d
28-
- name: Setup Python
29-
uses: actions/setup-python@9322b3ca74000aeb2c01eb777b646334015ddd72
30-
with:
31-
python-version: ${{ matrix.python-version }}
32-
- name: Install tox
33-
run: pip install tox
34-
- name: Test Execution
35-
run: tox -e py
41+
42+
- name: Wait for Splunk setup completion
43+
run: make wait_up
44+
45+
- name: Run Integration Tests
46+
run: tox -e py -- tests/integration
47+
48+
system-tests:
49+
needs: unit-tests
50+
uses: ./.github/workflows/setup-python.yml
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
os: [ubuntu-latest]
55+
python-version: [3.9]
56+
splunk-version: [9.4, latest]
57+
include:
58+
- os: ubuntu-22.04
59+
python-version: 3.7
60+
splunk-version: "9.1"
61+
- os: ubuntu-latest
62+
python-version: 3.13
63+
splunk-version: latest
64+
steps:
65+
- name: Run docker compose (System)
66+
run: SPLUNK_VERSION=${{matrix.splunk-version}} docker compose up -d
67+
68+
- name: Wait for Splunk setup completion
69+
run: make wait_up
70+
71+
- name: Run System Tests
72+
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 tests/ --junitxml=test-reports/junit-{envname}.xml --cov --cov-config=.coveragerc} {posargs}
3636

3737
[testenv:clean]
3838
deps = coverage

0 commit comments

Comments
 (0)