Skip to content

Commit 91bd6b4

Browse files
committed
Add misc workflows
1 parent 48cb84a commit 91bd6b4

File tree

5 files changed

+224
-15
lines changed

5 files changed

+224
-15
lines changed

.github/workflows/generate_workflows.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
from generate_workflows_lib import (
44
generate_test_workflow,
5-
generate_lint_workflow
5+
generate_lint_workflow,
6+
generate_misc_workflow
67
)
78

89
tox_ini_path = Path(__file__).parent.parent.parent.joinpath("tox.ini")
910
workflows_directory_path = Path(__file__).parent
1011

1112
generate_test_workflow(tox_ini_path, workflows_directory_path, "ubuntu-latest")
1213
generate_lint_workflow(tox_ini_path, workflows_directory_path)
14+
generate_misc_workflow(tox_ini_path, workflows_directory_path)

.github/workflows/generate_workflows_lib/src/generate_workflows_lib/__init__.py

+42-14
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
from collections import defaultdict
99

1010

11+
_tox_test_env_regex = re_compile(
12+
r"(?P<python_version>py\w+)-test-"
13+
r"(?P<name>[-\w]+\w)-?(?P<test_requirements>\d+)?"
14+
)
15+
_tox_lint_env_regex = re_compile(r"lint-(?P<name>[-\w]+)")
16+
_tox_contrib_env_regex = re_compile(
17+
r"py38-test-(?P<name>[-\w]+\w)-?(?P<contrib_requirements>\d+)?"
18+
)
19+
20+
1121
def get_tox_envs(tox_ini_path: Path) -> list:
1222

1323
tox_ini = ToxIni(tox_ini_path)
@@ -55,15 +65,10 @@ def get_test_job_datas(tox_envs: list, operating_systems: list) -> list:
5565

5666
test_job_datas = []
5767

58-
tox_test_env_regex = re_compile(
59-
r"(?P<python_version>py\w+)-test-"
60-
r"(?P<name>[-\w]+\w)-?(?P<test_requirements>\d+)?"
61-
)
62-
6368
for operating_system in operating_systems:
6469
for tox_env in tox_envs:
6570

66-
tox_test_env_match = tox_test_env_regex.match(tox_env)
71+
tox_test_env_match = _tox_test_env_regex.match(tox_env)
6772

6873
if tox_test_env_match is None:
6974
continue
@@ -106,11 +111,9 @@ def get_lint_job_datas(tox_envs: list) -> list:
106111

107112
lint_job_datas = []
108113

109-
tox_lint_env_regex = re_compile(r"lint-(?P<name>[-\w]+)")
110-
111114
for tox_env in tox_envs:
112115

113-
tox_lint_env_match = tox_lint_env_regex.match(tox_env)
116+
tox_lint_env_match = _tox_lint_env_regex.match(tox_env)
114117

115118
if tox_lint_env_match is None:
116119
continue
@@ -133,13 +136,9 @@ def get_contrib_job_datas(tox_envs: list) -> list:
133136

134137
contrib_job_datas = []
135138

136-
tox_contrib_env_regex = re_compile(
137-
r"py38-test-(?P<name>[-\w]+\w)-?(?P<contrib_requirements>\d+)?"
138-
)
139-
140139
for tox_env in tox_envs:
141140

142-
tox_contrib_env_match = tox_contrib_env_regex.match(tox_env)
141+
tox_contrib_env_match = _tox_contrib_env_regex.match(tox_env)
143142

144143
if tox_contrib_env_match is None:
145144
continue
@@ -170,6 +169,23 @@ def get_contrib_job_datas(tox_envs: list) -> list:
170169
return contrib_job_datas
171170

172171

172+
def get_misc_job_datas(tox_envs: list) -> list:
173+
174+
misc_job_datas = []
175+
176+
for tox_env in tox_envs:
177+
if (
178+
_tox_test_env_regex.match(tox_env) is not None or
179+
_tox_lint_env_regex.match(tox_env) is not None or
180+
_tox_contrib_env_regex.match(tox_env) is not None
181+
):
182+
continue
183+
184+
misc_job_datas.append(tox_env)
185+
186+
return misc_job_datas
187+
188+
173189
def _generate_workflow(
174190
job_datas: list, name: str, workflow_directory_path: Path
175191
):
@@ -234,3 +250,15 @@ def generate_contrib_workflow(
234250
"contrib",
235251
workflow_directory_path
236252
)
253+
254+
255+
def generate_misc_workflow(
256+
tox_ini_path: Path,
257+
workflow_directory_path: Path,
258+
) -> None:
259+
260+
_generate_workflow(
261+
get_misc_job_datas(get_tox_envs(tox_ini_path)),
262+
"misc",
263+
workflow_directory_path
264+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Do not edit this file.
2+
# This file is generated automatically by executing tox -e generate_workflows
3+
4+
name: Misc {{ file_number }}
5+
6+
on:
7+
push:
8+
branches-ignore:
9+
- 'release/*'
10+
pull_request:
11+
env:
12+
PIP_EXISTS_ACTION: w
13+
14+
jobs:
15+
{%- for job_data in job_datas %}
16+
17+
{{ job_data }}:
18+
name: {{ job_data }}
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repo @ SHA - ${% raw %}{{ github.sha }}{% endraw %}
22+
uses: actions/checkout@v4
23+
{%- if job_data.os != "shellcheck" %}
24+
25+
- name: Set up Python 3.12
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.12"
29+
{%- endif %}
30+
31+
- name: Install tox
32+
run: pip install tox
33+
34+
- name: Run tests
35+
run: tox -e {{ job_data }} -- -ra
36+
{%- if job_data == "generate_workflows" %}
37+
38+
- name: Check workflows are up to date
39+
run: git diff --exit-code || (echo 'Generated workflows are out of date, run "tox -e generate_workflows" and commit the changes in this PR.' && exit 1)
40+
{%- endif %}
41+
{%- if job_data == "generate" %}
42+
43+
- name: Check workflows are up to date
44+
run: git diff --exit-code || (echo 'Generated code is out of date, run "tox -e generate" and commit the changes in this PR.' && exit 1)
45+
{%- endif %}
46+
{%- endfor %}

.github/workflows/misc_0.yml

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Do not edit this file.
2+
# This file is generated automatically by executing tox -e generate_workflows
3+
4+
name: Misc 0
5+
6+
on:
7+
push:
8+
branches-ignore:
9+
- 'release/*'
10+
pull_request:
11+
env:
12+
PIP_EXISTS_ACTION: w
13+
14+
jobs:
15+
16+
benchmark-sdk-extension-aws:
17+
name: benchmark-sdk-extension-aws
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repo @ SHA - ${{ github.sha }}
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Python 3.12
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.12"
27+
28+
- name: Install tox
29+
run: pip install tox
30+
31+
- name: Run tests
32+
run: tox -e benchmark-sdk-extension-aws -- -ra
33+
34+
benchmark-propagator-aws-xray:
35+
name: benchmark-propagator-aws-xray
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout repo @ SHA - ${{ github.sha }}
39+
uses: actions/checkout@v4
40+
41+
- name: Set up Python 3.12
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: "3.12"
45+
46+
- name: Install tox
47+
run: pip install tox
48+
49+
- name: Run tests
50+
run: tox -e benchmark-propagator-aws-xray -- -ra
51+
52+
spellcheck:
53+
name: spellcheck
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Checkout repo @ SHA - ${{ github.sha }}
57+
uses: actions/checkout@v4
58+
59+
- name: Set up Python 3.12
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: "3.12"
63+
64+
- name: Install tox
65+
run: pip install tox
66+
67+
- name: Run tests
68+
run: tox -e spellcheck -- -ra
69+
70+
docker-tests:
71+
name: docker-tests
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: Checkout repo @ SHA - ${{ github.sha }}
75+
uses: actions/checkout@v4
76+
77+
- name: Set up Python 3.12
78+
uses: actions/setup-python@v5
79+
with:
80+
python-version: "3.12"
81+
82+
- name: Install tox
83+
run: pip install tox
84+
85+
- name: Run tests
86+
run: tox -e docker-tests -- -ra
87+
88+
docs:
89+
name: docs
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Checkout repo @ SHA - ${{ github.sha }}
93+
uses: actions/checkout@v4
94+
95+
- name: Set up Python 3.12
96+
uses: actions/setup-python@v5
97+
with:
98+
python-version: "3.12"
99+
100+
- name: Install tox
101+
run: pip install tox
102+
103+
- name: Run tests
104+
run: tox -e docs -- -ra
105+
106+
generate:
107+
name: generate
108+
runs-on: ubuntu-latest
109+
steps:
110+
- name: Checkout repo @ SHA - ${{ github.sha }}
111+
uses: actions/checkout@v4
112+
113+
- name: Set up Python 3.12
114+
uses: actions/setup-python@v5
115+
with:
116+
python-version: "3.12"
117+
118+
- name: Install tox
119+
run: pip install tox
120+
121+
- name: Run tests
122+
run: tox -e generate -- -ra
123+
124+
- name: Check workflows are up to date
125+
run: git diff --exit-code || (echo 'Generated code is out of date, run "tox -e generate" and commit the changes in this PR.' && exit 1)

tox.ini

+8
Original file line numberDiff line numberDiff line change
@@ -1300,3 +1300,11 @@ commands_pre =
13001300

13011301
commands =
13021302
python {toxinidir}/.github/workflows/generate_workflows.py
1303+
1304+
[testenv:shellcheck]
1305+
1306+
commands_pre =
1307+
sudo apt update && sudo apt install --assume-yes shellcheck
1308+
1309+
commands =
1310+
find . -name \*.sh | xargs shellcheck --severity=warning

0 commit comments

Comments
 (0)