forked from vega/altair
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (76 loc) · 3.41 KB
/
build.yml
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
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
jsonschema-version: ["3.0", "latest"]
name: py ${{ matrix.python-version }} js ${{ matrix.jsonschema-version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[all, dev]"
- name: Install specific jsonschema
# Only have to execute this if we don't want the latest jsonschema version
if: ${{ matrix.jsonschema-version != 'latest' }}
run: |
pip install jsonschema==${{ matrix.jsonschema-version }}
- name: Maybe uninstall optional dependencies
# We uninstall pyarrow and vegafusion for one job to test that we have not
# accidentally introduced a hard dependency on these libraries.
# Uninstalling for Python 3.9 is an arbitrary choice.
# Also see https://github.com/vega/altair/pull/3114
if: ${{ matrix.python-version == '3.9' }}
run: |
pip uninstall -y pyarrow vegafusion vegafusion-python-embed vl-convert-python anywidget
- name: Maybe install lowest supported pandas version
# We install the lowest supported pandas version for one job to test that
# it still works. Downgrade to the oldest versions of pandas and numpy that include
# Python 3.9 wheels, so only run this job for Python 3.9
if: ${{ matrix.python-version == '3.9' }}
run: |
pip install pandas==1.1.3 numpy==1.19.3
- name: Test that schema generation has no effect
run: |
pip install vl-convert-python
python tools/generate_schema_wrapper.py
# This gets the paths of all files which were either deleted, modified
# or are not yet tracked by Git
files=`git ls-files --deleted --modified --others --exclude-standard`
# Depending on the shell it can happen that 'files' contains empty
# lines which are filtered out in the for loop below
files_cleaned=()
for i in "${files[@]}"; do
# Skip empty items
if [ -z "$i" ]; then
continue
fi
# Add the rest of the elements to a new array
files_cleaned+=("${i}")
done
if [ ${#files_cleaned[@]} -gt 0 ]; then
echo "The code generation modified the following files:"
echo $files
git diff
exit 1
fi
- name: Test with pytest
run: |
pytest --pyargs --numprocesses=logical --doctest-modules tests
- name: Validate Vega-Lite schema
run: |
# We install all 'format' dependencies of jsonschema as check-jsonschema
# only does the 'format' checks which are installed.
# We can always use the latest jsonschema version here.
# uri-reference check is disabled as the URIs in the Vega-Lite schema do
# not conform RFC 3986.
pip install 'jsonschema[format]' check-jsonschema --upgrade
check-jsonschema --check-metaschema altair/vegalite/v5/schema/vega-lite-schema.json --disable-formats uri-reference