Skip to content

Commit

Permalink
chore: improve tox pipeline (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
hille721 authored Sep 7, 2023
1 parent cd81517 commit 0aad426
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 28 deletions.
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
day: saturday
interval: weekly
labels:
- "dependencies"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
day: saturday
interval: weekly
labels:
- "dependencies"
65 changes: 53 additions & 12 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,69 @@
# This will run tox with https://github.com/ymyzk/tox-gh-actions
name: Tox
# This will run tox with https://github.com/coactions/dynamic-matrix
name: tox

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

env:
FORCE_COLOR: 1 # tox, pytest, ansible-lint
PY_COLORS: 1

jobs:
test:
pre:
name: pre
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
steps:
- name: Determine matrix
id: generate_matrix
uses: coactions/dynamic-matrix@v1
with:
other_names: |
py38-2.11
py38-2.12
py38-2.13
py39-2.11
py39-2.12
py39-2.13
py39-2.14
py39-2.15
py310-2.12
py310-2.13
py310-2.14
py310-2.15
py310-devel
py311-2.14
py311-2.15
py311-devel
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
needs: pre
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
matrix: ${{ fromJson(needs.pre.outputs.matrix) }}

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
with:
fetch-depth: 0

- name: Set up python ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
python-version: ${{ matrix.python_version }}

- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox
python -m pip install -U pip
pip install tox
- run: tox run -e ${{ matrix.passed_name }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ credentials.yml
.tox
.cache
.pytest_cache
.ruff_cache
results.xml
coverage.xml
# Development
Expand Down
26 changes: 10 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
[tox]
env_list =
linters
py39-ansible{211,212,213,214,215}
py310
py311-ansible{215,devel}
py38-{2.11,2.12,2.13}
py39-{2.11,2.12,2.13,2.14,2.15}
py310-{2.12,2.13,2.14,2.15,devel}
py311-{2.14,2.15,devel}
minversion = 4.4.11

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311

[testenv]
description = run the tests with pytest
package = wheel
wheel_build_env = .pkg
deps =
pytest>=6
ansible211: ansible-core==2.11.*
ansible212: ansible-core==2.12.*
ansible213: ansible-core==2.13.*
ansible214: ansible-core==2.14.*
ansible215: ansible-core==2.15.*
ansibledevel: git+https://github.com/ansible/ansible
2.11: ansible-core==2.11.*
2.12: ansible-core==2.12.*
2.13: ansible-core==2.13.*
2.14: ansible-core==2.14.*
2.15: ansible-core==2.15.*
devel: git+https://github.com/ansible/ansible

commands =
pytest {tty:--color=yes} -v {posargs}
Expand Down

0 comments on commit 0aad426

Please sign in to comment.