Skip to content

Commit ce1cf3f

Browse files
authored
Merge pull request #5681 from plotly/add-ci-codegen-check
Add codegen check CI job
2 parents 01b9d44 + 66aec2f commit ce1cf3f

3 files changed

Lines changed: 67 additions & 4 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Check Python codegen
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, reopened, synchronize]
9+
10+
jobs:
11+
check-python-codegen:
12+
name: Check Python codegen
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
- name: Set up Python
17+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
18+
with:
19+
python-version: "3.x"
20+
21+
- name: Set up uv
22+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
23+
24+
- name: Install dependencies
25+
run: |
26+
uv venv
27+
source .venv/bin/activate
28+
uv lock --check
29+
uv sync --extra dev_codegen
30+
- name: Run codegen
31+
run: |
32+
source .venv/bin/activate
33+
python commands.py codegen
34+
- name: Check for changes
35+
run: |
36+
# Fail if codegen produced any changes to the working directory.
37+
# This means the committed generated files are out of date and codegen
38+
# needs to be re-run locally and the results committed.
39+
if [ -n "$(git status --porcelain)" ]; then
40+
echo "::error::Generated files are out of date. Please run 'python commands.py codegen' locally and commit the result."
41+
echo "The following files differ after running codegen:"
42+
git status --porcelain
43+
echo ""
44+
exit 1
45+
fi
46+
echo "Generated files are up to date."

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,20 @@ dev_build = [
5353
"build",
5454
"jupyterlab"
5555
]
56+
dev_codegen = [ # Dependencies for running Python codegen
57+
"plotly[dev_core]",
58+
"inflect"
59+
]
5660
dev_optional = [
5761
"plotly[dev_build]",
62+
"plotly[dev_codegen]",
5863
"plotly[express]",
5964
"plotly[kaleido]",
6065
"anywidget",
6166
"colorcet",
6267
# fiona>1.9.6 is not compatible with geopandas<1; geopandas>=1 is not compatible with python 3.8
6368
"fiona<=1.9.6;python_version<='3.8'",
6469
"geopandas",
65-
"inflect",
6670
"orjson",
6771
"pandas",
6872
"pdfrw",

uv.lock

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)