add version file #243
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 will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python package | |
on: | |
push: | |
branches: [ master ] | |
tags: | |
- v* | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.7", "3.8", "3.9", "3.10"] | |
include: | |
- os: ubuntu-latest | |
pippath: ~/.cache/pip | |
- os: macos-latest | |
pippath: ~/Library/Caches/pip | |
- os: windows-latest | |
pippath: ~\AppData\Local\pip\Cache | |
# include: | |
# - os: macos-latest | |
# python-version: "3.10" | |
steps: | |
- uses: actions/checkout@v3 | |
# - name: Get MacTeX Version | |
# if: ${{ startsWith(matrix.os, 'macos') }} | |
# run: echo "TEX_VER=$(brew info mactex | grep -E -o '\d+\.\d+')" >> $GITHUB_ENV | |
# - name: MacTeX Cache | |
# if: ${{ startsWith(matrix.os, 'macos') }} | |
# uses: actions/cache@v3.0.8 | |
# env: | |
# cache-name: cache-brew | |
# with: | |
# # A list of files, directories, and wildcard patterns to cache and restore | |
# path: | | |
# ~/Library/Caches/Homebrew | |
# ~/Library/Caches/Homebrew/Casks | |
# # An explicit key for restoring and saving the cache | |
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.TEX_VER }} | |
# # # An ordered list of keys to use for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case. | |
# # restore-keys: # optional | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.pippath }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ matrix.python-version }} | |
- name: Set up Homebrew | |
if: ${{ startsWith(matrix.os, 'macos') }} | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Setup TeX Live | |
uses: teatimeguest/setup-texlive-action@v2 | |
with: | |
cache: true | |
packages: >- | |
scheme-basic | |
collection-xetex | |
collection-fontsrecommended | |
collection-mathscience | |
collection-pictures | |
collection-latexextra | |
# - name: Update TeX Live | |
# run: tlmgr update --self --all --reinstall-forcibly-removed | |
- name: windows denpendencies | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
run: | | |
choco install pandoc --no-progress | |
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 | |
refreshenv | |
- name: ubuntu dependencies | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get install -y xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 curl | |
sudo apt-get install -y pandoc | |
- name: mac dependencies | |
if: ${{ startsWith(matrix.os, 'macos') }} | |
run: | | |
brew update | |
brew install pandoc | |
ln -s -f $(which python3) /usr/local/bin/python | |
ln -s -f $(which pip3) /usr/local/bin/pip | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel | |
pip install pytest matplotlib selenium jupyter pandoc | |
pip install . --upgrade | |
- name: mac nbconvert patch fix # this is a tmp fix, related to https://github.com/jupyter/nbconvert/issues/1773 | |
if: ${{ startsWith(matrix.os, 'macos') }} | |
run: | | |
mkdir -p ~/Library/Jupyter | |
ln -s /opt/homebrew/share/jupyter/nbconvert ~/Library/Jupyter | |
- name: Test with pytest | |
run: | | |
# sed 's/:/\n/g' <<< "$PATH" # show path | |
pytest | |
- name: Upload pdf | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test 1 PDF | |
path: tests/notebooks/*.pdf | |
publish: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: build | |
run: | | |
pip install -U pip wheel build setuptools | |
python3 -m build --wheel | |
- name: Publish package | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |