Skip to content

Merge pull request #85 from tarilabs/tarilabs-20240701-sync #8

Merge pull request #85 from tarilabs/tarilabs-20240701-sync

Merge pull request #85 from tarilabs/tarilabs-20240701-sync #8

Workflow file for this run

name: Python workflows
on:
push:
branches:
- "main"
pull_request:
jobs:
tests:
name: ${{ matrix.session }} ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.10"]
session: [lint, tests, mypy, docs-build]
include:
- python: "3.9"
session: tests
env:
NOXSESSION: ${{ matrix.session }}
FORCE_COLOR: "1"
PRE_COMMIT_COLOR: "always"
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Upgrade pip in virtual environments
shell: python
run: |
import os
import pip
with open(os.environ["GITHUB_ENV"], mode="a") as io:
print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
- name: Install Poetry
# use absolute path as recommended with: https://github.com/pypa/pipx/issues/1331
run: |
pipx install --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt poetry
poetry --version
- name: Install Nox
run: |
pipx install --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt nox nox-poetry
nox --version
- name: Run Nox
working-directory: clients/python
run: |
if [[ ${{ matrix.session }} == "tests" ]]; then
nox --python=${{ matrix.python }} -- --cov-report=xml
elif [[ ${{ matrix.session }} == "mypy" ]]; then
nox --python=${{ matrix.python }} ||\
echo "::error title='mypy failure'::Check the logs for more details"
else
nox --python=${{ matrix.python }}
fi
- name: Upload coverage report
uses: codecov/codecov-action@v4.5.0
if: always() && matrix.session == 'tests'
with:
files: coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload documentation
if: matrix.session == 'docs-build'
uses: actions/upload-artifact@v4
with:
name: docs
path: clients/python/docs/_build