feat: add version constraints, poetry, and poetry.lock
file, and use nox-poetry
and py3.12 in CI
#105
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: Tests | |
on: [pull_request, workflow_call] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
name: ${{ matrix.session }} / ${{ matrix.python }} / ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { python: "3.7", os: "ubuntu-latest", session: "tests" } | |
- { python: "3.8", os: "ubuntu-latest", session: "tests" } | |
- { python: "3.9", os: "ubuntu-latest", session: "tests" } | |
- { python: "3.10", os: "ubuntu-latest", session: "tests" } | |
- { python: "3.11", os: "ubuntu-latest", session: "tests" } | |
# - { python: "3.11", os: "windows-latest", session: "tests" } | |
- { python: "3.8", os: "macos-latest", session: "tests" } | |
- { python: "3.8", os: "ubuntu-latest", session: "dist-size" } | |
- { python: "3.8", os: "ubuntu-latest", session: "coverage" } | |
env: | |
NOXSESSION: ${{ matrix.session }} | |
FORCE_COLOR: "1" | |
PRE_COMMIT_COLOR: "always" | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: trtools | |
miniforge-variant: Mambaforge | |
auto-activate-base: false | |
miniforge-version: latest | |
use-mamba: true | |
- name: Get Date | |
id: get-date | |
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache Conda env | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CONDA }}/envs | |
key: | |
conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('dev-env.yml') }}-${{ env.CACHE_NUMBER }} | |
env: | |
# Increase this value to reset cache if dev-env.yml has not changed | |
CACHE_NUMBER: 0 | |
id: cache | |
- name: Install dev environment | |
run: | |
mamba env update -n trtools -f dev-env.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Try to build trtools | |
shell: bash -el {0} | |
run: | | |
poetry build --no-ansi | |
- name: Check distribution size | |
if: matrix.session == 'dist-size' | |
run: | | |
du -csh dist/* | |
# check that the generated dist/ directory does not exceed 0.3 MB | |
[ $(du -b dist | cut -f1) -lt 300000 ] | |
- name: Check code coverage | |
if: matrix.session == 'coverage' | |
shell: bash -el {0} | |
run: | | |
export NOXSESSION=tests | |
# check that code coverage is not lower than specific percent | |
nox --verbose --python=${{ matrix.python }} -- --cov=. --cov-report=term-missing --cov-fail-under=94 | |
- name: Run tests with nox | |
if: matrix.session == 'tests' | |
shell: bash -el {0} | |
run: | | |
nox --verbose --python=${{ matrix.python }} |