Skip to content

Commit

Permalink
Add Python 3.11 testing (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shrews authored Apr 14, 2023
1 parent 768d35c commit 8aa6855
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
50 changes: 33 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@ jobs:
sanity:
name: ${{ matrix.test.name }}
runs-on: ubuntu-22.04
container:
image: quay.io/ansible/ansible-builder-test-container:2.0.0
env:
PIP_CACHE_DIR: ${{ runner.temp }}/.cache/pip
TOXENV: ${{ matrix.test.tox_env }}
env:
TOXENV: ${{ matrix.test.tox_env }}

strategy:
fail-fast: false
matrix:
test:
- name: Lint
tox_env: linters-py39
tox_env: linters-py310

- name: Docs
tox_env: docs
Expand All @@ -29,6 +26,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install tox
run: |
python3 -m pip install --upgrade pip
python3 -m pip install tox
- name: Create tox environment
run: tox --notest

Expand Down Expand Up @@ -119,6 +121,8 @@ jobs:
- name: '3.10'
tox_env: integration-py310

- name: '3.11'
tox_env: integration-py311

steps:
- name: Checkout
Expand All @@ -143,20 +147,16 @@ jobs:
tox
- name: Upload coverage report
run: |
curl --silent --show-error --output codecov https://ansible-ci-files.s3.us-east-1.amazonaws.com/codecov/linux/codecov
chmod +x codecov
./codecov --file test/coverage/reports/coverage.xml --flags {{ matrix.py_version.tox_env }}
uses: codecov/codecov-action@v3
with:
files: test/coverage/reports/coverage.xml
flags: ${{ matrix.py_version.tox_env }}

unit:
name: Unit - ${{ matrix.py_version.name}}
runs-on: ubuntu-22.04
container:
image: quay.io/ansible/ansible-builder-test-container:2.0.0
env:
PIP_CACHE_DIR: ${{ runner.temp }}/.cache/pip
TOXENV: ${{ matrix.py_version.tox_env }}
env:
TOXENV: ${{ matrix.py_version.tox_env }}

strategy:
fail-fast: false
Expand All @@ -168,15 +168,31 @@ jobs:
- name: '3.10'
tox_env: unit-py310

- name: '3.11'
tox_env: unit-py311

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Python ${{ matrix.py_version.name }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py_version.name }}

- name: Install tox
run: |
python3 -m pip install --upgrade pip
python3 -m pip install tox
- name: Create tox environment
run: tox --notest

- name: Run tests
run: tox

- name: Upload coverage report
run: codecov --file test/coverage/reports/coverage.xml --flags {{ matrix.py_version.tox_env }}
uses: codecov/codecov-action@v3
with:
files: test/coverage/reports/coverage.xml
flags: ${{ matrix.py_version.tox_env }}
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ deps =
-r {toxinidir}/test/requirements.txt
commands = pytest {posargs}

[testenv:linters{,-py39,-py310}]
[testenv:linters{,-py39,-py310,-py311}]
description = Run code linters
commands =
flake8 --version
Expand All @@ -18,19 +18,19 @@ commands =
yamllint -s .
mypy ansible_builder

[testenv:unit{,-py39,-py310}]
[testenv:unit{,-py39,-py310,-py311}]
description = Run unit tests
commands = pytest {posargs:test/unit}

[testenv:pulp-integration{,-py310}]
[testenv:pulp-integration{-py39,-py310,-py311}]
# Some of these tests must run serially because of a shared resource
# (the system policy.json file).
description = Run pulp integration tests
commands =
pytest -n 1 -m "serial" {posargs:test/pulp_integration}
pytest -m "not serial" {posargs:test/pulp_integration}

[testenv:integration{,-py39,-py310}]
[testenv:integration{,-py39,-py310,-py311}]
description = Run integration tests
# rootless podman reads $HOME
passenv =
Expand Down

0 comments on commit 8aa6855

Please sign in to comment.