move from setup.py
to pyproject.toml
+ CI improvements
#615
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
name: Install test | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
schedule: | |
- cron: '25 16 * * 0' | |
release: | |
types: | |
- published | |
pull_request_review: | |
types: | |
- submitted | |
env: | |
CACHE_NUMBER: 0 # increase to reset cache manually | |
jobs: | |
dynamic-matrix: | |
# from https://michaelheap.com/dynamic-matrix-generation-github-actions/ | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- id: get-matrix | |
run: | | |
echo "get matrix for event ${{ github.event_name }}" | |
echo "::echo::on" | |
python .github/actions/dynamic_matrix.py ${{ github.event_name }} | |
outputs: | |
os_matrix: ${{ steps.get-matrix.outputs.os_matrix }} | |
python_version_matrix: ${{ steps.get-matrix.outputs.python_version_matrix }} | |
build: | |
needs: dynamic-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ${{ fromJson(needs.dynamic-matrix.outputs.os_matrix) }} | |
python-version: ${{ fromJson(needs.dynamic-matrix.outputs.python_version_matrix) }} | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
name: python ${{ matrix.python-version }} on ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
# cache conda from https://dev.to/epassaro/caching-anaconda-environments-in-github-actions-5hde | |
# and https://github.com/conda-incubator/setup-miniconda#caching | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: xsar | |
python-version: ${{ matrix.python-version }} | |
condarc-file: condarc.yml | |
use-mamba: true | |
use-only-tar-bz2: true | |
- name: Set cache date | |
run: | | |
echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ~/conda_pkgs_dir | |
key: conda-cache-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Cache found | |
run: echo Cache found | |
if: steps.cache.outputs.cache-hit == 'true' | |
# update conda. Cache will be used if available | |
# we remove python from environment.yml, because we want the version from matrix.python-version | |
- name: update conda | |
run: | | |
cat environment.yml | egrep -vw 'python' > ~/environment-nopython.yml | |
mamba env update -n xsar -f ~/environment-nopython.yml | |
- name: List Packages | |
run: | | |
python -V | |
conda info | |
conda list | |
- name: Minimal install | |
run: pip install -e . | |
- name: Minimal pytest | |
run: | | |
pip install pytest dill | |
pytest | |
# check if docs has changed | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
if: github.event_name != 'schedule' | |
with: | |
filters: | | |
docs: | |
- 'docs/**' | |
# run only if some file in 'doc' folder was changed | |
- name: Complete notebook install | |
if: github.event_name == 'schedule' || steps.changes.outputs.docs == 'true' | |
run: pip install -r requirements.txt | |
- name: Documetation test | |
if: github.event_name == 'schedule' || steps.changes.outputs.docs == 'true' | |
run: | | |
cd docs | |
make html | |