Skip to content

Lint and test after every push or pull request #18

Lint and test after every push or pull request

Lint and test after every push or pull request #18

# vim: set tabstop=2 softtabstop=2 shiftwidth=2 expandtab:
name: Lint and test after every push or pull request
on:
push:
pull_request:
workflow_call:
workflow_dispatch:
schedule:
- cron: '0 0 * * SUN' # run at midnight every Sunday
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Linting code
runs-on: ubuntu-latest
container: python:3
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Install black and flake8
run: python -m pip install black flake8
- name: Lint using black
run: python -m black --check .
- name: Lint using flake8
run: python -m flake8 .
test:
name: Run tests (${{ matrix.os }}, ${{ matrix.env }})
needs: lint
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
env:
- ci/python_311.yaml
- ci/python_310.yaml
- ci/python_39.yaml
jdk_from:
- conda-forge
- system
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Install JVM (system-wide)
if: ${{ matrix.jdk_from == 'system' }}
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 21
- name: Setup Conda
uses: conda-incubator/[email protected]
with:
activate-environment: r5py
channel-priority: strict
channels: conda-forge
environment-file: ${{ matrix.env }}
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
- name: Install JVM (from conda-forge)
if: ${{ matrix.jdk_from == 'conda-forge' }}
run: conda install 'openjdk>=21'
- name: Install test dependencies
run: |
mamba install -c conda-forge pytest pytest-asyncio pytest-cov pytest-lazy-fixture pip
pip install .[tests]
- name: Check environment
run: |
conda info
conda list
pip list --verbose
- name: Test r5py
run: python -m pytest
- name: Update codecov.io
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}