Skip to content

Merge pull request #33 from glevv/dependabot/github_actions/github/co… #125

Merge pull request #33 from glevv/dependabot/github_actions/github/co…

Merge pull request #33 from glevv/dependabot/github_actions/github/co… #125

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
PYTHONUNBUFFERED: "1"
PYTHONHASHSEED: "1"
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: True
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
defaults:
run:
shell: bash
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit
- name: Check out repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@93ada01c735cc8a383ce0ce2ae205a21c415379b # v1.3.4
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
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: Activate env
run: |
source $VENV
- name: Run ruff
run: |
poetry run ruff check --output-format=github .
poetry run ruff format . --diff
- name: Run mypy
run: |
poetry run mypy .
- name: Run tests
run: |
poetry run pytest --cov=obscure_stats --cov-report term --cov-report xml:coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5
if: matrix.python-version == '3.11'
with:
flags: smart-tests
verbose: true
file: ./coverage.xml
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}