-
Notifications
You must be signed in to change notification settings - Fork 14
81 lines (74 loc) · 2.8 KB
/
niceplots.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
79
80
81
# This workflow should install niceplots and dependencies the check formatting with flake8 and black and then check the the examples run without error
name: niceplots
on:
push:
branches: [main]
tags:
- v*.*.*
pull_request:
jobs:
black:
uses: mdolab/.github/.github/workflows/black.yaml@main
flake8:
uses: mdolab/.github/.github/workflows/flake8.yaml@main
test:
runs-on: ubuntu-latest
strategy:
matrix: # Test 3 versions of python, and the latest and oldest supported versions of numpy and matplotlib, according to https://scientific-python.org/specs/spec-0000/
python-version: ["3.9", "3.10", "3.11"]
numpy-version: ["1.23.*", "1.26.*"]
mpl-version: ["3.6.*", "3.8.*"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install apt dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: fonts-cmu nodejs npm
version: 1.0
- name: Install node dependencies
run: |
sudo npm install -g odiff-bin
- name: Install Prompt font
run: |
mkdir Prompt
cd Prompt
wget "https://fonts.google.com/download?family=Prompt" -O Prompt.zip
unzip Prompt.zip
mkdir ~/.fonts
cp *.ttf ~/.fonts
- name: Install python dependencies
run: |
pip install --upgrade pip wheel
pip install numpy==${{ matrix.numpy-version }}
pip install matplotlib==${{ matrix.mpl-version }}
pip install .
- name: Test examples
run: |
cd examples
bash testExamples.sh
- name: Compare against reference images
if: ${{ success() && matrix.python-version == '3.11' && matrix.numpy-version == '1.26.*' && matrix.mpl-version == '3.8.*' }}
run: |
cd examples
bash ImageComparisonTest.sh
- name: Upload examples if failed
uses: actions/upload-artifact@v3
if: ${{ failure() && matrix.python-version == '3.11' && matrix.numpy-version == '1.26.*' && matrix.mpl-version == '3.8.*' }}
with:
name: Examples
path: examples/
# - name: Upload new reference images
# if: ${{ github.event_name == 'push' && success() && matrix.python-version == '3.10' && matrix.numpy-version == '1.24.*' && matrix.mpl-version == '3.6.*' }}
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# file_pattern: 'examples/ref/*.png'
# commit_message: Update reference images
# --- publish to PyPI
pypi:
needs: [test, flake8, black]
uses: mdolab/.github/.github/workflows/pypi.yaml@main
secrets: inherit