Skip to content

feat(codebase): added utils folder from TRTools to core #34

feat(codebase): added utils folder from TRTools to core

feat(codebase): added utils folder from TRTools to core #34

Workflow file for this run

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.8", os: "ubuntu-latest", session: "lint" }
- { 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.12", 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: "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: myenv
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@v4
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 myenv -f dev-env.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Try to build package
shell: bash -el {0}
run: |
poetry build --no-ansi
- name: Check distribution size
if: matrix.session == 'size'
run: |
du -csh dist/*
tar -ztvf dist/*.tar.gz
# check that the generated dist/ directory does not exceed 0.3 MB
# if this check fails, it's because you forgot to list large files in the "exclude" section of our pyproject.toml
# https://python-poetry.org/docs/pyproject/#include-and-exclude
[ $(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-fail-under=92.5
- name: Run tests with nox
if: matrix.session == 'tests' || matrix.session == 'lint'
shell: bash -el {0}
run: |
nox --verbose --python=${{ matrix.python }}
large-files:
name: File sizes
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Check for large files
uses: actionsdesk/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }} # Optional
filesizelimit: 500000b
labelName: large-files