Lint, test and format discord_bot #199
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: Lint, test and format discord_bot | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- "discord_bot/**" | |
workflow_run: | |
workflows: ["Dependabot PR Check"] | |
types: | |
- completed | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
poetry-version: ["1.7"] | |
defaults: | |
run: | |
working-directory: discord_bot | |
steps: | |
- name: 📥 Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: "discord_bot" | |
sparse-checkout-cone-mode: false | |
- name: 🐍 Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: 📜 Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: ${{ matrix.poetry-version }} | |
- name: 🚀 Cache the venv based on the .lock | |
uses: actions/cache@v3 | |
with: | |
path: discord_bot/.venv | |
key: venv-${{ hashFiles('discord_bot/poetry.lock') }} | |
- name: 🔨 Install dev dependencies | |
run: poetry install --with dev | |
- name: 🧑🔧 Lint with ruff | |
run: poetry run ruff check . | |
- name: 🧹 Format with black | |
run: poetry run black --check . | |
- name: 🧪 Run tests | |
run: poetry run pytest |