CI #60
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: CI | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "src/**" | |
- "tests/**" | |
- "pyproject.toml" | |
- "poetry.toml" | |
- "poetry.lock" | |
- "!**.md" | |
- "!.github/workflows/docs.yml" | |
pull_request: | |
paths-ignore: | |
- "**.md" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
strategy: | |
fail-fast: false # run all configs, avoid breaking when one fails | |
matrix: | |
os: ["ubuntu-latest", "macos-latest"] | |
python-version: ["3.7", "3.8", "3.9"] | |
r-version: ["release"] | |
runs-on: ${{ matrix.os }} | |
# 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 | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Install Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.r-version }} | |
- name: Install spatstat subpackages and extensions | |
run: | |
Rscript -e 'install.packages(c("spatstat.explore", "spatstat.geom"))' | |
# https://github.com/spatstat/spatstat | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
# with: | |
# virtualenvs-create: true | |
# virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install package with main (non-optional) and dev dependencies | |
# see [tool.poetry.dependencies] and [tool.poetry.dev-dependencies] | |
# in pyproject.toml | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-root | |
- name: Install package | |
run: poetry install | |
- name: Test with pytest | |
# Configuration of pytest [tool.pytest.ini_options] in pyproject.toml | |
# https://docs.pytest.org/en/latest/reference/customize.html#pyproject-toml | |
run: poetry run pytest --cov-report=xml | |
- name: Upload coverage to Codecov | |
# https://docs.codecov.com/docs | |
# https://github.com/codecov/codecov-action | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
# generated using --cov-report=xml in Test with pytest |