Skip to content

Commit bacb1ae

Browse files
committed
ci(manual-wkflow): add a manually triggered validation pipeline to project
1 parent f4b4863 commit bacb1ae

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed

.github/workflows/manual.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: CI (Manual)
2+
3+
on:
4+
# Enable execution directly from Actions page
5+
workflow_dispatch:
6+
inputs:
7+
linux:
8+
description: 'Test on Linux?'
9+
type: boolean
10+
required: true
11+
default: true
12+
windows:
13+
description: 'Test on Windows?'
14+
type: boolean
15+
required: true
16+
default: true
17+
python3-13:
18+
description: 'Test Python 3.13?'
19+
type: boolean
20+
required: true
21+
default: true
22+
python3-12:
23+
description: 'Test Python 3.12?'
24+
type: boolean
25+
required: true
26+
default: true
27+
python3-11:
28+
description: 'Test Python 3.11?'
29+
type: boolean
30+
required: true
31+
default: true
32+
python3-10:
33+
description: 'Test Python 3.10?'
34+
type: boolean
35+
required: true
36+
default: true
37+
python3-9:
38+
description: 'Test Python 3.9?'
39+
type: boolean
40+
required: true
41+
default: true
42+
python3-8:
43+
description: 'Test Python 3.8?'
44+
type: boolean
45+
required: true
46+
default: true
47+
48+
49+
# default token permissions = none
50+
permissions: {}
51+
52+
env:
53+
COMMON_PYTHON_VERSION: '3.11'
54+
55+
jobs:
56+
57+
eval-input:
58+
name: Evaluate inputs
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- name: Setup | Install Python ${{ env.COMMON_PYTHON_VERSION }}
63+
uses: actions/setup-python@v5
64+
with:
65+
python-version: ${{ env.COMMON_PYTHON_VERSION }}
66+
67+
- name: Setup | Write file
68+
uses: DamianReeves/write-file-action@v1.3
69+
with:
70+
path: .github/manual_eval_input.py
71+
write-mode: overwrite
72+
contents: |
73+
import json, os
74+
75+
version_list = list(filter(None, [
76+
"3.8" if str(os.getenv("INPUT_PY3_8", False)).lower() == str(True).lower() else None,
77+
"3.9" if str(os.getenv("INPUT_PY3_9", False)).lower() == str(True).lower() else None,
78+
"3.10" if str(os.getenv("INPUT_PY3_10", False)).lower() == str(True).lower() else None,
79+
"3.11" if str(os.getenv("INPUT_PY3_11", False)).lower() == str(True).lower() else None,
80+
"3.12" if str(os.getenv("INPUT_PY3_12", False)).lower() == str(True).lower() else None,
81+
"3.13" if str(os.getenv("INPUT_PY3_13", False)).lower() == str(True).lower() else None,
82+
]))
83+
84+
linux_versions = (
85+
version_list
86+
if str(os.getenv("INPUT_LINUX", False)).lower() == str(True).lower()
87+
else []
88+
)
89+
windows_versions = (
90+
version_list
91+
if str(os.getenv("INPUT_WINDOWS", False)).lower() == str(True).lower()
92+
else []
93+
)
94+
95+
print(f"PYTHON_VERSIONS_LINUX={json.dumps(linux_versions)}")
96+
print(f"PYTHON_VERSIONS_WINDOWS={json.dumps(windows_versions)}")
97+
98+
99+
- name: Evaluate | Generate Test Matrix
100+
id: test-matrix
101+
env:
102+
INPUT_PY3_8: ${{ inputs.python3-8 }}
103+
INPUT_PY3_9: ${{ inputs.python3-9 }}
104+
INPUT_PY3_10: ${{ inputs.python3-10 }}
105+
INPUT_PY3_11: ${{ inputs.python3-11 }}
106+
INPUT_PY3_12: ${{ inputs.python3-12 }}
107+
INPUT_PY3_13: ${{ inputs.python3-13 }}
108+
INPUT_LINUX: ${{ inputs.linux }}
109+
INPUT_WINDOWS: ${{ inputs.windows }}
110+
run: |
111+
if ! vars="$(python3 .github/manual_eval_input.py)"; then
112+
printf '%s\n' "::error::Failed to evaluate input"
113+
exit 1
114+
fi
115+
printf '%s\n' "$vars"
116+
printf '%s\n' "$vars" >> $GITHUB_OUTPUT
117+
118+
outputs:
119+
python-versions-linux: ${{ steps.test-matrix.outputs.PYTHON_VERSIONS_LINUX }}
120+
python-versions-windows: ${{ steps.test-matrix.outputs.PYTHON_VERSIONS_WINDOWS }}
121+
122+
123+
validate:
124+
needs: eval-input
125+
uses: ./.github/workflows/validate.yml
126+
with:
127+
python-versions-linux: ${{ needs.eval-input.outputs.python-versions-linux }}
128+
python-versions-windows: ${{ needs.eval-input.outputs.python-versions-windows }}
129+
# There is no way to check for file changes on a manual workflow so
130+
# we just assume everything has changed
131+
build-files-changed: true
132+
ci-files-changed: true
133+
doc-files-changed: true
134+
src-files-changed: true
135+
test-files-changed: true
136+
files-changed: true
137+
permissions: {}
138+
secrets: {}

0 commit comments

Comments
 (0)