Add deprecation warning to monitor
decorator
#120
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: Test | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/test.yml" | |
- "capsula/**" | |
- "examples/**" | |
- "tests/**" | |
- "pyproject.toml" | |
- "capsula.toml" | |
- "tox.ini" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/test.yml" | |
- "capsula/**" | |
- "examples/**" | |
- "tests/**" | |
- "pyproject.toml" | |
- "capsula.toml" | |
- "tox.ini" | |
types: [opened, synchronize, reopened, ready_for_review] | |
env: | |
PYTHON_VERSION: "3.11" | |
POETRY_VERSION: "1.7.0" | |
jobs: | |
ruff: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Extract Ruff version from pyproject.toml | |
id: extract-ruff-version | |
run: | | |
echo "ruff_version=$(python -c "import tomllib;f=open('pyproject.toml', 'rb');print(tomllib.load(f)['tool']['poetry']['group']['dev']['dependencies']['ruff']);f.close()")" >> "$GITHUB_OUTPUT" | |
- uses: chartboost/ruff-action@v1 | |
with: | |
version: ${{ steps.extract-ruff-version.outputs.ruff_version }} | |
mypy: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Set up Poetry | |
uses: abatilo/actions-poetry@v3 | |
with: | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Install dependencies | |
run: poetry install --no-interaction | |
- name: Run mypy | |
run: poetry run --no-interaction mypy . | |
tox: | |
if: github.event.pull_request.draft == false | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox tox-gh-actions | |
- name: Test with tox | |
run: tox | |
env: | |
PLATFORM: ${{ matrix.os }} | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: covdata-${{ matrix.os }}-${{ matrix.python-version }} | |
path: .coverage.* | |
combine-coverage-reports: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: tox | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Download coverage reports from all jobs | |
uses: actions/download-artifact@v4 | |
- name: Flatten directory structure | |
run: | | |
shopt -s dotglob | |
for dir in ./covdata-*; do | |
if [ -d "$dir" ]; then | |
mv "$dir"/* ./ | |
rm -rf "$dir" | |
fi | |
done | |
shopt -u dotglob | |
- name: Combine coverage reports | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install coverage genbadge[coverage] | |
coverage combine | |
coverage report -m | |
coverage xml -o coverage/coverage.xml | |
coverage html -d coverage/html | |
genbadge coverage -i coverage/coverage.xml -o coverage/badge.svg | |
- name: Commit and push | |
if: github.event_name == 'pull_request' | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions | |
message: "Update tox report" | |
push: "origin HEAD:${{ github.head_ref }} --force" |