Repository navigation
202 lines (172 loc) · 7.61 KB
/
Copy pathci.yml
File metadata and controls
202 lines (172 loc) · 7.61 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
192
193
194
195
196
197
198
199
200
201
202
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install uv
uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --dev --python ${{ matrix.python-version }}
- name: Run tests
run: uv run --python ${{ matrix.python-version }} pytest tests/ -v
test-pyarrow:
# The oldest supported pyarrow (pyproject: pyarrow>=19.0.0) on the oldest Python, 20.0.0
# (still lacking some kernels of later versions, e.g. decimal32/64 `filter`), and the
# latest pyarrow on PyPI. The pytest run itself asserts the pyarrow it imports
# (STARFIX_EXPECT_PYARROW) and prints it in the session header.
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- pyarrow: "19.0.0"
python-version: "3.10"
- pyarrow: "20.0.0"
python-version: "3.10"
- pyarrow: "latest"
python-version: "3.13"
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install uv
uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --dev --python ${{ matrix.python-version }}
- name: Resolve the pyarrow version
id: pyarrow
run: |
if [ "${{ matrix.pyarrow }}" = latest ]; then
version=$(curl -fsSL https://pypi.org/pypi/pyarrow/json | jq -r .info.version)
else
version="${{ matrix.pyarrow }}"
fi
test -n "$version"
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Run tests on pyarrow ${{ steps.pyarrow.outputs.version }}
env:
STARFIX_EXPECT_PYARROW: ${{ steps.pyarrow.outputs.version }}
run: |
uv run --python ${{ matrix.python-version }} --with "pyarrow==$STARFIX_EXPECT_PYARROW" python -c "import pyarrow; assert pyarrow.__version__ == '$STARFIX_EXPECT_PYARROW', pyarrow.__version__; print('pyarrow', pyarrow.__version__)"
uv run --python ${{ matrix.python-version }} --with "pyarrow==$STARFIX_EXPECT_PYARROW" pytest tests/ -v
legacy-differential:
# starfix.legacy.v0_4 must stay byte-identical to the released starfix-python 0.4.0 (PyPI).
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install uv
uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5
- name: Set up Python 3.12
run: uv python install 3.12
- name: Install dependencies
run: uv sync --dev --python 3.12
- name: Compare starfix.legacy.v0_4 with starfix==0.4.0 from PyPI
run: uv run --python 3.12 python scripts/legacy_differential.py
license-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install uv
uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5
- name: Install dependencies
run: uv sync --dev
- name: Check dependency licenses
run: >-
uv run pip-licenses
--allow-only="MIT;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;Python-2.0;PSF-2.0"
--partial-match
dependency-review:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
contents: read
pull-requests: read # required by actions/dependency-review-action to fetch PR diff
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Dependency review
uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4
with:
deny-licenses: >-
GPL-2.0-only, GPL-2.0-or-later,
GPL-3.0-only, GPL-3.0-or-later,
AGPL-3.0-only, AGPL-3.0-or-later,
LGPL-2.0-only, LGPL-2.0-or-later,
LGPL-2.1-only, LGPL-2.1-or-later,
LGPL-3.0-only, LGPL-3.0-or-later
golden-sync-check:
runs-on: ubuntu-latest
# Secrets are not available to fork PRs, so skip the check there.
# Internal PRs and pushes to main always run it.
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: read
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
with:
app-id: ${{ secrets.STARFIX_APP_ID }}
private-key: ${{ secrets.STARFIX_APP_PRIVATE_KEY }}
repositories: starfix
- name: Fetch authoritative fixture from starfix
run: |
gh api repos/nauticalab/starfix/contents/tests/golden/include_metadata_v0.3.json \
--jq '.content' | base64 -d > /tmp/upstream.json
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Fail on fixture drift
run: |
if [ ! -s /tmp/upstream.json ]; then
echo "ERROR: Could not fetch fixture from nauticalab/starfix main."
echo "Ensure nauticalab/starfix#main has tests/golden/include_metadata_v0.3.json"
echo "(starfix PLT-1735 PR must be merged before this check can pass)"
exit 1
fi
if ! diff tests/golden/include_metadata_v0.3.json /tmp/upstream.json; then
echo "ERROR: tests/golden/include_metadata_v0.3.json has drifted from nauticalab/starfix main."
echo "Copy the updated fixture from the starfix repo and commit it."
exit 1
fi
- name: Fetch authoritative format-2 fixtures from starfix
run: |
# Raw media type: no 1 MB limit (format2_v0.5.json is append-only and grows).
# Tolerate missing files here so the next step prints the explanation.
# On failure gh prints the error body to stdout, so keep the file only on success.
for f in format2_v0.5.json format1_to_format2.json python_literals_format1_inputs.json; do
if ! gh api -H "Accept: application/vnd.github.raw" \
"repos/nauticalab/starfix/contents/tests/golden/$f" > "/tmp/upstream_$f"; then
rm -f "/tmp/upstream_$f"
fi
done
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Fail on format-2 fixture drift
run: |
for f in format2_v0.5.json format1_to_format2.json python_literals_format1_inputs.json; do
if [ ! -s "/tmp/upstream_$f" ]; then
echo "ERROR: Could not fetch tests/golden/$f from nauticalab/starfix main."
echo "(the starfix ITL-898 PR must be merged before this check can pass)"
exit 1
fi
if ! diff "tests/golden/$f" "/tmp/upstream_$f" > /dev/null; then
echo "ERROR: tests/golden/$f has drifted from nauticalab/starfix main."
echo "Copy the updated fixture from the starfix repo and commit it."
exit 1
fi
done