-
Notifications
You must be signed in to change notification settings - Fork 1
191 lines (187 loc) · 6.06 KB
/
generic.yml
File metadata and controls
191 lines (187 loc) · 6.06 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Reusable package workflow
on:
workflow_call:
inputs:
packages:
required: true
type: string
secrets:
CC_TEST_REPORTER_ID:
required: true
PYPI_TOKEN:
required: true
GH_TOKEN:
required: true
GIT_AUTHOR_EMAIL:
required: true
GIT_AUTHOR_NAME:
required: true
GIT_COMMITTER_EMAIL:
required: true
GIT_COMMITTER_NAME:
required: true
SLACK_WEBHOOK:
required: true
jobs:
changes:
name: changes
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.changes.outputs.packages }}
steps:
- uses: actions/checkout@v4
- id: changes
uses: ./.github/actions/changes
lint:
name: Linting
needs: [ changes ]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
current_package: ${{ fromJson(inputs.packages) }}
steps:
- name: has change in sub package
id: has_change
run: |
PACKAGE_NAME=$(echo $PACKAGE | cut -d'/' -f3)
echo "has_change=$(echo $CHANGES | jq -r .$PACKAGE_NAME)" >> $GITHUB_OUTPUT
shell: bash
env:
PACKAGE: ${{ matrix.current_package }}
CHANGES: ${{ needs.changes.outputs.packages }}
- uses: actions/checkout@v4
if: ${{ steps.has_change.outputs.has_change != 'false' }}
- id: lint
if: ${{ steps.has_change.outputs.has_change != 'false' }}
uses: ./.github/actions/linting
with:
python-version: ${{ matrix.python-version }}
current_package: ${{ matrix.current_package }}
isort:
name: Isorting
needs: [ changes ]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
current_package: ${{ fromJson(inputs.packages) }}
steps:
- name: has change in sub package
id: has_change
run: |
PACKAGE_NAME=$(echo $PACKAGE | cut -d'/' -f3)
echo "has_change=$(echo $CHANGES | jq -r .$PACKAGE_NAME)" >> $GITHUB_OUTPUT
shell: bash
env:
PACKAGE: ${{ matrix.current_package }}
CHANGES: ${{ needs.changes.outputs.packages }}
- uses: actions/checkout@v4
if: ${{ steps.has_change.outputs.has_change != 'false' }}
- id: isort
if: ${{ steps.has_change.outputs.has_change != 'false' }}
uses: ./.github/actions/isort
with:
python-version: ${{ matrix.python-version }}
current_package: ${{ matrix.current_package }}
black:
name: Black
needs: [ changes ]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
current_package: ${{ fromJson(inputs.packages) }}
steps:
- name: has change in sub package
id: has_change
run: |
PACKAGE_NAME=$(echo $PACKAGE | cut -d'/' -f3)
echo "has_change=$(echo $CHANGES | jq -r .$PACKAGE_NAME)" >> $GITHUB_OUTPUT
shell: bash
env:
PACKAGE: ${{ matrix.current_package }}
CHANGES: ${{ needs.changes.outputs.packages }}
- uses: actions/checkout@v4
if: ${{ steps.has_change.outputs.has_change != 'false' }}
- id: isort
if: ${{ steps.has_change.outputs.has_change != 'false' }}
uses: ./.github/actions/black
with:
python-version: ${{ matrix.python-version }}
current_package: ${{ matrix.current_package }}
test:
name: Test
needs: [isort, lint, black]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
current_package: ${{ fromJson(inputs.packages) }}
steps:
- uses: actions/checkout@v4
- id: tests
if: steps.changes.outputs.${{ matrix.current_package }} == 'true'
uses: ./.github/actions/tests
with:
python-version: ${{ matrix.python-version }}
current_package: ${{ matrix.current_package }}
coverage:
name: Coverage
needs: [test]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
- id: coverage
uses: ./.github/actions/coverage
with:
python-version: ${{ matrix.python-version }}
current_package: ./src/datasource_toolkit
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
semantic_release:
name: Semantic release
needs: [coverage]
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta')
outputs:
new_release_published: ${{ steps.release.outputs.new_release_published }}
new_release_version: ${{ steps.release.outputs.new_release_version }}
strategy:
matrix:
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false # GITHUB_TOKEN must not be set for the semantic release
- id: release
uses: ./.github/actions/release
with:
packages: ${{ inputs.packages }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
pypi:
name: Push to pypi
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') && needs.semantic_release.outputs.new_release_published == 'true'
needs: [semantic_release]
runs-on: ubuntu-latest
strategy:
max-parallel: 6
matrix:
python-version: ['3.10']
current_package: ${{ fromJson(inputs.packages) }}
steps:
- uses: actions/checkout@v4
- id: pypi
uses: ./.github/actions/pypi
with:
current_package: ${{ matrix.current_package }}
python-version: ${{ matrix.python-version }}
pypi_token: ${{ secrets.PYPI_TOKEN }}