-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (81 loc) · 2.65 KB
/
module.execute-module.yaml
File metadata and controls
106 lines (81 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
## File: .github/workflows/module.execute-module.yaml
name: Execute Target Package Module
on:
workflow_call:
inputs:
params:
required: false
type: string
jobs:
workflow:
uses: ./.github/workflows/module.validate-parameters.yaml
with:
workflow_inputs: >-
{
"workflow": "module.exectute-module",
"inputs": {
"params": {
"id": "Workflow Parameters", "value": ${{ inputs.params }}
}
}
}
execute-module-parameters:
needs: workflow
runs-on: ubuntu-latest
steps:
- name: Module - Execute-Module (Parameters)
id: workflow_parameters
run: |
echo -e "Package Location: ${{ fromJson(
needs.workflow.outputs.validated ).params.package_location }}" ;
execute-module:
needs: [ workflow, execute-module-parameters ]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ${{ fromJson(vars.PYTHON_VERSIONS).python }}
env:
package_location: ${{ fromJson(
needs.workflow.outputs.validated ).params.package_location }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Restore Cached Dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: pip-${{ matrix.python-version }}-
- name: Download requirements.txt
uses: actions/download-artifact@v4
with:
name: requirements-${{ matrix.python-version }}
path: .
- name: Verify requirements.txt Exists
run: |
if [[ ! -f requirements.txt ]]; then
echo "ERROR: requirements.txt is missing!" ;
exit 1 ;
fi ;
echo "requirements.txt found!" ;
cat requirements.txt ;
- name: Install Python and Dependencies
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Reinstall Dependencies from Cache
run: |
python -m pip install --upgrade pip ;
python -m pip install -r requirements.txt ;
- name: Set PYTHONPATH to Repository Root
run: |
echo "PYTHONPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV ;
echo -e "PYTHONPATH set to: ${GITHUB_WORKSPACE}" ;
- name: Execute Python Module
run: |
package_module=$(
echo -e "${{ env.package_location }}" | sed 's/\//./g'
) ;
echo "Executing Python module: ${package_module}" ;
python -m $package_module ;