-
Notifications
You must be signed in to change notification settings - Fork 12
59 lines (53 loc) · 1.34 KB
/
python-job.yml
File metadata and controls
59 lines (53 loc) · 1.34 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
name: Python Job
on:
workflow_call:
inputs:
python-version:
type: string
default: "3.9"
runner:
type: string
default: ubuntu-latest
run:
required: true
type: string
artifact:
type: string
default: ''
required: false
artifact_path:
type: string
default: ''
required: false
jobs:
run:
runs-on: ${{ inputs.runner }}
defaults:
run:
shell: bash
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
ref: "${{ github.head_ref || github.ref }}"
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: ${{ inputs.python-version }}
- name: Install project dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev,test]
- name: Run Command
run: |
${{ inputs.run }}
env:
GH_TOKEN: ${{ github.token }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ inputs.artifact != '' && inputs.artifact_path != '' }}
with:
name: ${{ inputs.artifact }}
path: ${{ inputs.artifact_path }}
if-no-files-found: ignore