feat: enhance Throttled decorator with cost parameter (#77) #170
This file contains hidden or 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: Code Quality | |
on: | |
push: | |
branches: [main] | |
pull_request: {} | |
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs | |
# `contents` is for permission to the contents of the repository. | |
# `pull-requests` is for permission to pull request | |
permissions: | |
contents: write | |
checks: write | |
pull-requests: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
python-version: 3.8 | |
poetry-version: 1.8.5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.python-version }} | |
- name: Install Poetry | |
uses: abatilo/actions-poetry@v4 | |
with: | |
poetry-version: ${{ env.poetry-version }} | |
- name: Setup Poetry | |
run: | | |
poetry config virtualenvs.create true --local | |
poetry config virtualenvs.in-project true --local | |
- name: Define a cache for the virtual environment | |
uses: actions/cache@v3 | |
with: | |
path: ./.venv | |
key: venv-${{ env.python-version }}-${{ env.poetry-version }}-${{ hashFiles('poetry.lock')}} | |
- name: Define a cache for the pre-commit virtual environment | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: venv-precommit-${{ env.python-version }}-${{ env.poetry-version }}-${{ hashFiles('poetry.lock')}} | |
- name: Install the project dependencies | |
run: poetry install | |
- name: Pre-commit run | |
run: poetry run pre-commit run --show-diff-on-failure --color=always --all-files | |
shell: bash | |
- name: Run tests | |
run: poetry run pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=throttled tests/ | tee pytest-coverage.txt | |
- name: Pytest coverage comment | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
pytest-coverage-path: ./pytest-coverage.txt | |
junitxml-path: ./pytest.xml | |
github-token: ${{ secrets.PAT }} |