Skip to content

Merge pull request #75 from Herculens/dev-cluster #203

Merge pull request #75 from Herculens/dev-cluster

Merge pull request #75 from Herculens/dev-cluster #203

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Tests
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(needs.set-matrix.outputs.python-versions) }}
needs: set-matrix
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-cov coveralls
# install nifty.re
# (we do this first because it causes too older versions of jax to be installed)
cd ..
mkdir git_packages
cd git_packages
git clone https://gitlab.mpcdf.mpg.de/ift/nifty.git
cd nifty
git checkout tags/9.1.0
pip install --user --editable '.[re]'
cd ../../herculens
# install herculens' requirements
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi # will re-install a newer version of jax
if [ -f test_requirements.txt ]; then pip install -r test_requirements.txt; fi
# install herculens
pip install --editable .
# - name: Lint with flake8
# run: |
# # 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 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest --cov-report lcov --cov=herculens --ignore=test/MassModel/Profiles/dpie_test.py test
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
set-matrix:
runs-on: ubuntu-latest
outputs:
python-versions: ${{ steps.set.outputs.matrix }}
steps:
- id: set
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo '::set-output name=matrix::["3.12"]'
else
echo '::set-output name=matrix::["3.11", "3.12"]'
fi