-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (96 loc) · 2.95 KB
/
python-package-workflow.yml
File metadata and controls
99 lines (96 loc) · 2.95 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
name: Python Package Make
on:
workflow_call:
inputs:
working_directory:
description: "Working directory in which to run this workflow."
required: false
type: string
default: "./"
make_target:
description: "Make Target to run"
required: false
type: string
default: "release"
timeout_minutes:
description: "timeout for package"
required: false
type: number
default: 5
python_version_matrix:
description: "stringified json list of python version targets"
required: false
type: string
default: '["3.9", "3.10", "3.11"]'
enable_codecov:
description: "Enable codecov upload"
required: false
type: boolean
default: false
codecov_python_version:
description: "Default python version"
required: false
type: string
default: "3.9"
codecov_base_ref:
description: "Base ref for codecov upload"
required: false
type: string
default: "main"
codecov_flags:
description: "Flag to use for codecov upload"
required: false
type: string
default: ""
secrets:
ai-packages-token:
required: false
ai-packages-ssh-private-key:
required: false
codecov-token:
required: false
jobs:
make:
name: make ${{ inputs.make_target }}
runs-on: ubuntu-latest
timeout-minutes: ${{ inputs.timeout_minutes }}
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJSON(inputs.python_version_matrix) }}
env:
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Set up AllenInstitute Repo Authorization
uses: ./.github/actions/setup-ai-github-urls
with:
token: ${{ secrets.ai-packages-token }}
ssh_private_key: ${{ secrets.ai-packages-ssh-private-key }}
- name: Run Release
run: |
cd ${{ inputs.working_directory }}
make ${{ inputs.make_target }}
shell: bash
- name: Upload coverage reports
if: |
${{
success()
&& inputs.enable_codecov
&& (
(github.event_name == 'pull_request' && github.base_ref == inputs.codecov_base_ref ) ||
(github.event_name == 'push' && github.ref_name == inputs.codecov_base_ref )
)
&& matrix.python-version == inputs.codecov_python_version
}}
uses: codecov/codecov-action@v3
with:
# https://github.com/codecov/codecov-action#arguments
token: ${{ secrets.codecov-token }}
env_vars: PYTHON_VERSION
flags: ${{ inputs.codecov_flags }}