added poetry run #14
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: Unit tests (fast suite) | ||
on: | ||
push: | ||
branches: [main, dev] | ||
pull_request: | ||
branches: [main, dev] | ||
types: [ opened, synchronize, reopened, ready_for_review ] | ||
jobs: | ||
tests: | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash -e {0} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python: [3.9, 3.10, 3.11] | ||
os: [ubuntu-latest, macos-latest] | ||
env: | ||
OS: ${{ matrix.os }} | ||
PYTHON: ${{ matrix.python }} | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@main | ||
- name: Install graphviz headers | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y graphviz graphviz-dev | ||
- name: Install graphviz headers | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
run: | | ||
brew install graphviz | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
- name: Install library | ||
run: poetry install --no-interaction | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Tests and coverage | ||
if: ${{ github.event_name == 'push' }} | ||
run: | | ||
poetry run pytest -v --cov --color=yes --durations=0 | ||
- name: Tests | ||
if: ${{ github.event_name == 'pull_request' }} | ||
run: | | ||
poetry run pytest -v --cov --color=yes --durations=0 | ||
- name: Upload coverage reports to Codecov | ||
if: ${{ github.event_name == 'push' }} | ||
env: | ||
CODECOV_NAME: ${{ matrix.python }}-${{ matrix.os }} | ||
run: | | ||
curl -Os https://uploader.codecov.io/latest/linux/codecov | ||
chmod +x codecov | ||
./codecov --no-color --required -F fast -t ${{ secrets.CODECOV_TOKEN }} |