Adding license #265
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |