Repository navigation
143 lines (121 loc) · 4.42 KB
/
Copy pathpython_push.yml
File metadata and controls
143 lines (121 loc) · 4.42 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
name: python build
on:
# Keep workflow triggers unrestricted so skipped jobs satisfy required checks.
# The change filter includes the shared fixture consumed by Python tests.
pull_request:
types: [opened, synchronize]
merge_group:
types: [checks_requested]
push:
# Run relevant Python jobs on main to seed build caches that can be reused
# by pull request and merge queue runs.
branches:
- main
jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
python: ${{ steps.changes.outputs.python }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Detect Python changes
id: changes
shell: bash
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha || github.event.after }}
run: |
changed_files=$(git diff --name-only "$BASE_SHA...$HEAD_SHA" -- \
.github/workflows/python_push.yml \
Taskfile.yml \
acceptance/bundle/python/ \
go.mod \
go.sum \
libs/dyn/dynvar/testdata/reference_vectors.json \
python/ \
tools/task/ \
)
if [[ -n "$changed_files" ]]; then
echo "python=true" >> "$GITHUB_OUTPUT"
else
echo "python=false" >> "$GITHUB_OUTPUT"
fi
python_tests:
needs: changes
if: ${{ always() && (needs.changes.result != 'success' || needs.changes.outputs.python == 'true') }}
name: tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pyVersion: ['3.10', '3.11', '3.12', '3.13']
steps:
- name: Fail if change detection did not succeed
if: ${{ needs.changes.result != 'success' }}
run: |
echo "Python change detection did not succeed"
exit 1
- name: Checkout repository and submodules
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
python-version: ${{ matrix.pyVersion }}
version: "0.6.5"
- name: Run tests
run: go tool -modfile=tools/task/go.mod task pydabs-test
python_linters:
needs: changes
if: ${{ always() && (needs.changes.result != 'success' || needs.changes.outputs.python == 'true') }}
name: lint
runs-on: ubuntu-latest
steps:
- name: Fail if change detection did not succeed
if: ${{ needs.changes.result != 'success' }}
run: |
echo "Python change detection did not succeed"
exit 1
- name: Checkout repository and submodules
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
version: "0.6.5"
- name: Run lint
run: go tool -modfile=tools/task/go.mod task pydabs-lint
python_docs:
needs: changes
if: ${{ always() && (needs.changes.result != 'success' || needs.changes.outputs.python == 'true') }}
name: docs
runs-on: ubuntu-latest
steps:
- name: Fail if change detection did not succeed
if: ${{ needs.changes.result != 'success' }}
run: |
echo "Python change detection did not succeed"
exit 1
- name: Checkout repository and submodules
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
version: "0.6.5"
- name: Run docs
run: go tool -modfile=tools/task/go.mod task pydabs-docs