Repository navigation
175 lines (165 loc) · 5.34 KB
/
Copy pathpy.yml
File metadata and controls
175 lines (165 loc) · 5.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
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
name: Python CI
on:
push:
branches:
# Release branches: keep in sync with publish.yml
- "main"
pull_request:
branches:
- "main"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
request:
runs-on: ubuntu-24.04
outputs:
run: ${{ steps.filter.outputs.run }}
steps:
- uses: envoyproxy/toolshed/actions/github/should-run@9bd3b300cf19f67cd2ef8b6e4aaa920f79894c24 # actions-v0.4.29
id: filter
with:
config: |
paths:
- py/VERSION.txt
- '.github/workflows/py.yml'
- 'pants.toml'
- 'pants.ci.toml'
- '.coveragerc'
- '.flake8'
- '.flake8.lock'
- 'mypy.ini'
- 'pytest.ini'
- 'py/**'
test:
runs-on: ubuntu-24.04
needs: request
if: >-
github.repository_owner == 'envoyproxy'
&& fromJSON(needs.request.outputs.run)
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Initialize Pants
uses: pantsbuild/actions/init-pants@0aaef864bd133c4055feb6adad0bfdce0de1c2e4 # v11
with:
gha-cache-key: "v0-${{ runner.os }}"
named-caches-hash: "${{ hashFiles('pants*toml') }}"
- name: Run pants test
run: "pants --colors test ::"
- name: Archive code coverage results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage
path: dist/coverage/python/htmlcov/
lint:
runs-on: ubuntu-24.04
needs: request
if: >-
fromJSON(needs.request.outputs.run)
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Initialize Pants
uses: pantsbuild/actions/init-pants@0aaef864bd133c4055feb6adad0bfdce0de1c2e4 # v11
with:
gha-cache-key: "v0-${{ runner.os }}"
named-caches-hash: "${{ hashFiles('pants*toml') }}"
- name: Run pants lint
run: "pants --colors lint ::"
typecheck:
runs-on: ubuntu-24.04
needs: request
if: >-
fromJSON(needs.request.outputs.run)
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Initialize Pants
uses: pantsbuild/actions/init-pants@0aaef864bd133c4055feb6adad0bfdce0de1c2e4 # v11
with:
gha-cache-key: "v0-${{ runner.os }}"
named-caches-hash: "${{ hashFiles('pants*toml') }}"
- name: Run pants (type) check
run: "pants --colors check ::"
docs:
runs-on: ubuntu-24.04
# TODO: reenable once plugin is fixed
if: false
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Initialize Pants
uses: pantsbuild/actions/init-pants@0aaef864bd133c4055feb6adad0bfdce0de1c2e4 # v11
with:
gha-cache-key: "v0-${{ runner.os }}"
named-caches-hash: "${{ hashFiles('pants*toml') }}"
- name: Run pants README
run: "pants --colors readme --check=README.md ::"
package:
runs-on: ubuntu-24.04
needs:
- request
- test
- lint
- typecheck
# - docs
if: >-
fromJSON(needs.request.outputs.run)
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Initialize Pants
uses: pantsbuild/actions/init-pants@0aaef864bd133c4055feb6adad0bfdce0de1c2e4 # v11
with:
gha-cache-key: "v0-${{ runner.os }}"
named-caches-hash: "${{ hashFiles('pants*toml') }}"
- name: Run pants package
run: "pants --colors package ::"
- name: Verify wheel METADATA matches setup.cfg
run: |
python -m pip install --quiet packaging
python py/tools/publish_check/check_wheel_metadata.py
- name: Archive wheels
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: python-artifacts
path: dist/*.whl
if-no-files-found: error
- name: Archive sdists
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: python-source
path: dist/*.tar.gz
if-no-files-found: error
status:
runs-on: ubuntu-24.04
if: >-
always()
&& github.event_name == 'pull_request'
name: Python
needs:
- request
- test
- lint
- typecheck
- package
steps:
- run: |
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "One or more jobs failed or were cancelled"
exit 1
fi
echo "All required jobs passed or were skipped"