Skip to content

Commit 39d89ef

Browse files
authored
Adopt tox workflow using coactions/dynamic-matrix (#1883)
1 parent 8668a57 commit 39d89ef

File tree

10 files changed

+219
-23
lines changed

10 files changed

+219
-23
lines changed

.config/dictionary.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
CAs
12
assertIn

.github/CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* @pycontribs/jira
2+
/.github/ @ssbarnea

.github/workflows/jira_ci.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
name: ci
22

3+
# runs only after tox workflow finished successfully
34
on:
4-
# Trigger the workflow on push or pull request,
5-
# but only for the main branch
6-
push:
7-
branches:
8-
- main
9-
pull_request:
10-
branches:
11-
- main
5+
workflow_run:
6+
workflows: [tox]
7+
branches: [main]
8+
types:
9+
- completed
1210

1311
jobs:
1412
server:
13+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1514
uses: pycontribs/jira/.github/workflows/jira_server_ci.yml@main
1615

1716
cloud:

.github/workflows/tox.yml

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
---
2+
name: tox
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
11+
cancel-in-progress: true
12+
13+
env:
14+
FORCE_COLOR: 1 # tox, pytest
15+
PY_COLORS: 1
16+
17+
jobs:
18+
prepare:
19+
name: prepare
20+
runs-on: ubuntu-24.04
21+
outputs:
22+
matrix: ${{ steps.generate_matrix.outputs.matrix }}
23+
steps:
24+
- name: Determine matrix
25+
id: generate_matrix
26+
uses: coactions/dynamic-matrix@v3
27+
with:
28+
min_python: "3.9"
29+
max_python: "3.12"
30+
default_python: "3.9"
31+
other_names: |
32+
lint
33+
docs
34+
pkg
35+
# ^ arm64 runner is using py311 for matching python version used in AAP 2.5
36+
platforms: linux,macos,linux-arm64:ubuntu-24.04-arm64-2core
37+
skip_explode: "1"
38+
build:
39+
name: ${{ matrix.name }}
40+
runs-on: ${{ matrix.os || 'ubuntu-24.04' }}
41+
needs:
42+
- prepare
43+
strategy:
44+
fail-fast: false
45+
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
46+
steps:
47+
48+
- uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0 # needed by setuptools-scm
51+
submodules: true
52+
53+
- name: Set pre-commit cache
54+
uses: actions/cache@v4
55+
if: ${{ contains(matrix.name, 'lint') }}
56+
with:
57+
path: |
58+
~/.cache/pre-commit
59+
key: pre-commit-${{ matrix.name }}-${{ hashFiles('.pre-commit-config.yaml') }}
60+
61+
- name: Set up Python ${{ matrix.python_version || '3.10' }}
62+
uses: actions/setup-python@v5
63+
with:
64+
cache: pip
65+
python-version: ${{ matrix.python_version || '3.10' }}
66+
cache-dependency-path: "*requirements*.txt"
67+
68+
- name: Install tox
69+
run: |
70+
python3 -m pip install --upgrade pip wheel tox
71+
72+
- run: ${{ matrix.command }}
73+
74+
- run: ${{ matrix.command2 }}
75+
if: ${{ matrix.command2 }}
76+
77+
- run: ${{ matrix.command3 }}
78+
if: ${{ matrix.command3 }}
79+
80+
- run: ${{ matrix.command4 }}
81+
if: ${{ matrix.command4 }}
82+
83+
- run: ${{ matrix.command5 }}
84+
if: ${{ matrix.command5 }}
85+
86+
- name: Archive logs
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: logs-${{ matrix.name }}.zip
90+
if-no-files-found: error
91+
path: |
92+
.tox/**/log/
93+
.tox/**/coverage.xml
94+
95+
- name: Report failure if git reports dirty status
96+
run: |
97+
if [[ -n $(git status -s) ]]; then
98+
# shellcheck disable=SC2016
99+
echo -n '::error file=git-status::'
100+
printf '### Failed as git reported modified and/or untracked files\n```\n%s\n```\n' "$(git status -s)" | tee -a "$GITHUB_STEP_SUMMARY"
101+
exit 99
102+
fi
103+
# https://github.com/actions/toolkit/issues/193
104+
check:
105+
if: always()
106+
environment: check
107+
permissions:
108+
id-token: write
109+
checks: read
110+
111+
needs:
112+
- build
113+
114+
runs-on: ubuntu-24.04
115+
116+
steps:
117+
# checkout needed for codecov action which needs codecov.yml file
118+
- uses: actions/checkout@v4
119+
120+
- name: Set up Python # likely needed for coverage
121+
uses: actions/setup-python@v5
122+
with:
123+
python-version: "3.12"
124+
125+
- run: pip3 install 'coverage>=7.5.1'
126+
127+
- name: Merge logs into a single archive
128+
uses: actions/upload-artifact/merge@v4
129+
with:
130+
name: logs.zip
131+
pattern: logs-*.zip
132+
# artifacts like py312.zip and py312-macos do have overlapping files
133+
separate-directories: true
134+
135+
- name: Download artifacts
136+
uses: actions/download-artifact@v4
137+
with:
138+
name: logs.zip
139+
path: .
140+
141+
- name: Check for expected number of coverage reports
142+
run: .github/check-coverage.sh
143+
144+
# Single uploads inside check job for codecov to allow use to retry
145+
# it when it fails without running tests again. Fails often enough!
146+
- name: Upload junit xml reports
147+
# PRs from forks might not have access to the secret
148+
if: env.CODECOV_TOKEN
149+
env:
150+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN || env.CODECOV_TOKEN }}
151+
uses: codecov/test-results-action@v1
152+
with:
153+
name: ${{ matrix.name }}
154+
files: "*/tests/output/junit/*.xml"
155+
fail_ci_if_error: true
156+
token: ${{ secrets.CODECOV_TOKEN }}
157+
158+
- name: Upload coverage data
159+
uses: codecov/codecov-action@v4
160+
with:
161+
name: ${{ matrix.name }}
162+
# verbose: true # optional (default = false)
163+
fail_ci_if_error: true
164+
use_oidc: true # cspell:ignore oidc
165+
files: "*/tests/output/reports/coverage.xml"
166+
167+
# - name: Check codecov.io status
168+
# if: github.event_name == 'pull_request'
169+
# uses: coactions/codecov-status@main
170+
171+
- name: Decide whether the needed jobs succeeded or failed
172+
uses: re-actors/alls-green@release/v1
173+
with:
174+
jobs: ${{ toJSON(needs) }}
175+
176+
- name: Delete Merged Artifacts
177+
uses: actions/upload-artifact/merge@v4
178+
with:
179+
delete-merged: true

.pre-commit-config.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ repos:
2525
types: [text]
2626
args: []
2727
require_serial: false
28-
additional_dependencies: []
28+
additional_dependencies:
29+
- tomli; python_version<'3.11'
2930
- repo: https://github.com/astral-sh/ruff-pre-commit
3031
rev: "v0.6.2"
3132
hooks:

README.rst

-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ Jira Python Library
1111
.. image:: https://img.shields.io/github/issues/pycontribs/jira.svg
1212
:target: https://github.com/pycontribs/jira/issues
1313

14-
.. image:: https://img.shields.io/badge/irc-%23pycontribs-blue
15-
:target: irc:///#pycontribs
16-
17-
------------
18-
1914
.. image:: https://readthedocs.org/projects/jira/badge/?version=main
2015
:target: https://jira.readthedocs.io/
2116

docs/conf.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@
8181
# The encoding of source files.
8282
# source_encoding = 'utf-8-sig'
8383

84-
# The master toctree document.
85-
master_doc = "index"
84+
root_doc = "index"
8685

8786
# General information about the project.
8887
project = py_pkg.__name__

jira/client.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3279,7 +3279,7 @@ def create_temp_project_avatar(
32793279
32803280
This method returns a dict of properties that can be used to crop a subarea of a larger image for use.
32813281
This dict should be saved and passed to :py:meth:`confirm_project_avatar` to finish the avatar creation process.
3282-
If you want to cut out the middleman and confirm the avatar with Jira's default cropping,
3282+
If you want to confirm the avatar with Jira's default cropping,
32833283
pass the 'auto_confirm' argument with a truthy value and :py:meth:`confirm_project_avatar` will be called for you before this method returns.
32843284
32853285
Args:
@@ -3825,7 +3825,7 @@ def create_temp_user_avatar(
38253825
38263826
This method returns a dict of properties that can be used to crop a subarea of a larger image for use.
38273827
This dict should be saved and passed to :py:meth:`confirm_user_avatar` to finish the avatar creation process.
3828-
If you want to cut out the middleman and confirm the avatar with Jira's default cropping, pass the ``auto_confirm`` argument with a truthy value and
3828+
If you want to confirm the avatar with Jira's default cropping, pass the ``auto_confirm`` argument with a truthy value and
38293829
:py:meth:`confirm_user_avatar` will be called for you before this method returns.
38303830
38313831
Args:
@@ -4234,7 +4234,7 @@ def _add_client_cert_to_session(self):
42344234
42354235
If configured through the constructor.
42364236
4237-
https://docs.python-requests.org/en/master/user/advanced/#client-side-certificates
4237+
https://docs.python-requests.org/en/latest/user/advanced/#client-side-certificates
42384238
- str: a single file (containing the private key and the certificate)
42394239
- Tuple[str,str] a tuple of both files’ paths
42404240
"""
@@ -4246,7 +4246,7 @@ def _add_ssl_cert_verif_strategy_to_session(self):
42464246
42474247
If configured through the constructor.
42484248
4249-
https://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification
4249+
https://docs.python-requests.org/en/latest/user/advanced/#ssl-cert-verification
42504250
- str: Path to a `CA_BUNDLE` file or directory with certificates of trusted CAs.
42514251
- bool: True/False
42524252
"""

pyproject.toml

+19-2
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,31 @@ test = [
9393
jirashell = "jira.jirashell:main"
9494

9595
[tool.codespell]
96+
check-filenames = true
97+
check-hidden = true
98+
quiet-level = 0
99+
write-changes = true
100+
enable-colors = true
96101
skip = [
102+
"./.eggs",
103+
"./.git",
104+
"./.mypy_cache",
105+
"./.tox",
97106
"./build",
98107
"./docs/build",
99108
"./node_modules",
109+
"./pip-wheel-metadata",
110+
"./tests/icon.png",
111+
".DS_Store",
112+
".ruff_cache",
100113
"AUTHORS",
101-
"ChangeLog"
114+
"ChangeLog",
115+
"__pycache__",
116+
"coverage.xml",
117+
"dist",
102118
]
103-
ignore-words = ".config/dictionary.txt"
119+
builtin = ["clear", "rare", "usage", "names", "code"]
120+
ignore-words = [".config/dictionary.txt"]
104121

105122
[tool.files]
106123
packages = """

tox.ini

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ requires =
66
# tox-extra
77
# tox-pyenv
88
envlist =
9+
lint
10+
pkg
11+
docs
912
py311
1013
py310
1114
py39
@@ -99,7 +102,7 @@ commands =
99102
'import pathlib; '\
100103
'docs_dir = pathlib.Path(r"{toxworkdir}") / "docs_out"; index_file = docs_dir / "index.html"; print(f"\nDocumentation available under `file://\{index_file\}`\n\nTo serve docs, use `python3 -m http.server --directory \{docs_dir\} 0`\n")'
101104

102-
[testenv:packaging]
105+
[testenv:pkg]
103106
basepython = python3
104107
description =
105108
Build package, verify metadata, install package and assert behavior when ansible is missing.

0 commit comments

Comments
 (0)