Skip to content

tests: fix bug in last commit #327

tests: fix bug in last commit

tests: fix bug in last commit #327

Workflow file for this run

# lsqfitgp/workflows/tests.yml
#
# Copyright (c) 2022, 2023, Giacomo Petrillo
#
# This file is part of lsqfitgp.
#
# lsqfitgp is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# lsqfitgp is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with lsqfitgp. If not, see <http://www.gnu.org/licenses/>.
name: tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
tests:
if: github.repository == 'Gattocrucco/lsqfitgp'
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental != '' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.11"]
include:
- os: ubuntu-20.04
python-version: "3.8"
- os: macos-11
python-version: "3.8"
- os: windows-latest
python-version: "3.11"
experimental: true
# do not run outdated tests on windows because only recent jax
# versions support windows
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install package and dependencies
if: matrix.python-version == '3.11'
run: |
python -m pip install --upgrade pip
python -m pip install '.[tests]'
- name: Install package and outdated dependencies
if: matrix.python-version == '3.8'
run: |
python -m pip install --upgrade pip
python -m pip install '.[tests-old]'
- name: Run unit tests
run: make COVERAGE_SUFFIX=-${{ matrix.os }}-py${{ matrix.python-version }} tests
- name: Save coverage information
uses: actions/upload-artifact@v3
with:
name: coverage
path: .coverage.tests-${{ matrix.os }}-py${{ matrix.python-version }}
docs:
runs-on: macos-latest
# run on macos because of a linux bug which breaks docs/components4.png
needs: tests
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install package and dependencies
run: |
python -m pip install --upgrade pip
python -m pip install '.[docs]'
- name: Run examples
run: make COVERAGE_SUFFIX=-macos-latest-py3.11 examples
- name: Run documentation code
run: make COVERAGE_SUFFIX=-macos-latest-py3.11 docscode
- name: Generate documentation
run: make docs
- name: Copy documentation to github pages
if: github.event_name == 'push'
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
branch: gh-pages
folder: docs/_build/html
target-folder: docs
- name: Get version number
run: echo lsqfitgp_version=`python -c 'import re, lsqfitgp; print(re.fullmatch(r"(\d+(\.\d+)*)(.dev\d+)?", lsqfitgp.__version__).group(1))'` >> $GITHUB_ENV
- name: Copy documentation to github pages (versioned directory)
if: github.event_name == 'push'
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
branch: gh-pages
folder: docs/_build/html
target-folder: docs-${{ env.lsqfitgp_version }}
- name: Save coverage from examples
uses: actions/upload-artifact@v3
with:
name: coverage
path: .coverage.examples-macos-latest-py3.11
- name: Save coverage from tutorials
uses: actions/upload-artifact@v3
with:
name: coverage
path: .coverage.docs-macos-latest-py3.11
postcov:
runs-on: ubuntu-latest
needs: [tests, docs]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install coverage
run: |
python -m pip install --upgrade pip
python -m pip install coverage
- name: Get coverage files
uses: actions/download-artifact@v3
with:
name: coverage
- name: List files
run: |
pwd
ls -a
ls src/lsqfitgp
- name: Print coverage debug
run: |
coverage debug config
coverage debug sys
coverage debug data
- name: Generate coverage report
run: make covreport
- name: Remove gitignore file
run: rm htmlcov/.gitignore
- name: Copy report to github pages
if: github.event_name == 'push'
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
branch: gh-pages
folder: htmlcov
target-folder: htmlcov