Skip to content

macos 13 (12 is deprecated) #360

macos 13 (12 is deprecated)

macos 13 (12 is deprecated) #360

name: CI
on:
push:
pull_request:
jobs:
python:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-12, macos-14]
exclude:
- os: macos-14
python-version: "3.7"
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Pre-install
run: |
python -m pip install --upgrade pip
pip install --no-deps .
python -c "import bussilab"
bussilab -h
pip uninstall --yes bussilab
- name: Install
run: |
pip install .
- name: Test with pytest
env:
BUSSILAB_TEST_NOTIFY_TOKEN: ${{ secrets.BUSSILAB_TEST_NOTIFY_TOKEN }}
BUSSILAB_TEST_NOTIFY_CHANNEL: ${{ secrets.BUSSILAB_TEST_NOTIFY_CHANNEL }}
run: |
bussilab check --import
pip install pytest pytest-cov
pytest -v
NUMBA_DISABLE_JIT=1 PYTHONPATH=$PWD pytest -v --cov=bussilab
bash <(curl -s https://codecov.io/bash)
- name: Pyflakes
run: |
pip install --upgrade pyflakes
pyflakes bussilab
- name: Pylint
run: |
pip install --upgrade pylint
pylint -E bussilab
# - name: Mypy
# run: |
# pip install --upgrade mypy
# mypy bussilab
- name: Flake8
run: |
pip install --upgrade flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 bussilab bin --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | tee flake8_report.txt
- name: Doc
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }}
run: |
pip install --upgrade pdoc3 jupyter nbconvert
pdoc3 -f --html -o doc/ bussilab
( cd examples && ./render.sh )
mkdir doc/examples
cp examples/*html doc/examples/
( sudo apt-get install tree && cd doc/examples && tree -H '.' -L 1 --noreport --charset utf-8 > index.html )
( sudo apt-get install pandoc texlive-xetex && pdoc3 -f --pdf bussilab > bussilab.md && pandoc --metadata=title:"Py-Bussilab Documentation" --from=markdown+abbreviations+tex_math_single_backslash --pdf-engine=xelatex --toc --toc-depth=4 --output=doc/bussilab.pdf bussilab.md )
- name: Push doc to GitHub Pages
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && github.ref == 'refs/heads/master' }}
env:
BUSSILABBOT_TOKEN: ${{ secrets.BUSSILABBOT_TOKEN }}
run: |
.ci/pushdoc
- name: Upload doc to artifact
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }}
uses: actions/upload-artifact@v3
with:
path: doc
name: doc
- name: Upload doc to artifact
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }}
uses: actions/upload-artifact@v3
with:
path: flake8_report.txt
name: flake8_report
- name: Deploy PyPI
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && startsWith(github.ref, 'refs/tags/') }}
env:
BUSSILABBOT_PYPI: ${{ secrets.BUSSILABBOT_PYPI }}
run: |
pip install twine
python setup.py sdist
python -m twine upload -u __token__ -p "$BUSSILABBOT_PYPI" dist/bussilab-*.tar.gz
python36:
# Mini test, to make sure we do not break python 3.6 compaibility for a while
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.6
uses: actions/setup-python@v4
with:
python-version: 3.6
- name: Install
run: |
pip install .
- name: Test with pytest
env:
BUSSILAB_TEST_NOTIFY_TOKEN: ${{ secrets.BUSSILAB_TEST_NOTIFY_TOKEN }}
BUSSILAB_TEST_NOTIFY_CHANNEL: ${{ secrets.BUSSILAB_TEST_NOTIFY_CHANNEL }}
run: |
bussilab check --import
pip install pytest pytest-cov
pytest -v
NUMBA_DISABLE_JIT=1 PYTHONPATH=$PWD pytest -v --cov=bussilab
bash <(curl -s https://codecov.io/bash)
macports:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a single command using the runners shell
- name: Install MacPorts
run: |
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci
source ./macports-ci install
- name: Setup environment
run: |
# 3.11 and 3.12 failing for some unknown reason on GHA
# this is only failing with MacOS-12, maybe it's worth checking why
# meanwhil they are disabled
echo MACPORTS_PY_VERSIONS="3.9 3.10" >> $GITHUB_ENV
- name: Install python
run: |
for pyver in $MACPORTS_PY_VERSIONS
do
sudo port install python${pyver//./} py${pyver//./}-{pip,setuptools}
done
- name: Install package
run: |
# the re.sub() command is necessary since site.USER_SITE seems to be incorrectly set to
# /Users/runner/Library/Python/3.9/lib/python/site-packages
# instead of the correct
# /Users/runner/Library/Python/3.9/lib/python3.9/site-packages
for pyver in $MACPORTS_PY_VERSIONS
do
# subshell not to pollute paths
(
export PATH="$(python$pyver -c 'import site; print(site.USER_BASE + "/bin")'):$PATH"
export PYTHONPATH="$(python$pyver -c 'import site; import re; print(re.sub("python/","python'$pyver'/",site.USER_SITE))'):$PYTHONPATH"
pip-$pyver install --user --no-deps .
sudo port install $(bussilab required --macports --pyver ${pyver//./})
)
done
- name: Run tests
run: |
for pyver in $MACPORTS_PY_VERSIONS
do
# subshell not to pollute paths
(
export PATH="$(python$pyver -c 'import site; print(site.USER_BASE + "/bin")'):$PATH"
export PYTHONPATH="$(python$pyver -c 'import site; import re; print(re.sub("python/","python'$pyver'/",site.USER_SITE))'):$PYTHONPATH"
bussilab check --import
sudo port install py${pyver//./}-pytest
# ignore BUSSILAB_TEST_NOTIFY_TOKEN since it does not work with macports for some reason
pytest-$pyver -v
)
done
conda:
strategy:
matrix:
os: [ubuntu-latest, macos-13, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install conda
run: |
curl -LO https://raw.githubusercontent.com/GiovanniBussi/conda-ci/master/conda-ci
source ./conda-ci install
source ./conda-ci install-conda-build
- name: Build
run: |
source activate base
python make_conda_recipe.py
export CPU_COUNT=2
conda-build -c conda-forge conda
rm -fr bussilab # make sure this is not imported by mistake in tests
- name: Test 3.7
if: ${{ matrix.os != 'macos-14' }}
run: |
source activate base
conda create -n py37 -c conda-forge -c local python=3.7 py-bussilab pytest
source activate py37
pytest -v
- name: Test 3.8
run: |
source activate base
conda create -n py38 -c conda-forge -c local python=3.8 py-bussilab pytest
source activate py38
pytest -v
- name: Test 3.9
run: |
source activate base
conda create -n py39 -c conda-forge -c local python=3.9 py-bussilab pytest
source activate py39
pytest -v
- name: Test 3.10
run: |
source activate base
conda create -n py310 -c conda-forge -c local python=3.10 py-bussilab pytest
source activate py310
pytest -v
- name: Test 3.11
run: |
source activate base
conda create -n py311 -c conda-forge -c local python=3.11 py-bussilab pytest
source activate py311
pytest -v
- name: Test 3.12
run: |
source activate base
conda create -n py311 -c conda-forge -c local python=3.12 py-bussilab pytest
source activate py311
pytest -v
- name: Deploy conda
if: ${{ matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/') }}
env:
CONDA_UPLOAD_TOKEN: ${{ secrets.CONDA_UPLOAD_TOKEN }}
run: |
source activate base
anaconda -t $CONDA_UPLOAD_TOKEN upload -u bussilab -l main $CONDA_PREFIX/conda-bld/*/py-bussilab*.tar.bz2 --force