gha: black use pyproject #154
Workflow file for this run
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: Tests | ||
on: | ||
push: | ||
branches: | ||
- "master" | ||
paths: | ||
- "**/*.py" | ||
- "poetry.lock" | ||
- "pyproject.toml" | ||
- "config.ini.example" | ||
pull_request_target: | ||
paths: | ||
- ".github/workflows/test.yml" | ||
- "**/*.py" | ||
- "poetry.lock" | ||
- "pyproject.toml" | ||
- "config.ini.example" | ||
jobs: | ||
lint: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Python 3 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
- name: Lint | ||
uses: psf/black@stable | ||
with: | ||
use_pyproject: true | ||
test: | ||
needs: lint | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12"] | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Install Python 3 | ||
- uses: actions/checkout@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
- name: Run Pytest | ||
env: | ||
COINMARKETCAP_API_KEY: ${{ secrets.COINMARKETCAP_API_KEY }} | ||
run: | | ||
source .venv/bin/activate | ||
pytest -vv --cov=./ --cov-report=xml tests/ | ||
- name: Upload Coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
- name: Run Bandit | ||
run: | | ||
source .venv/bin/activate | ||
bandit ./waybar_crypto.py |