From 406ee7c275fa1abd99f34abf25e8f2880e3ea8d7 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 17 Apr 2024 20:25:18 +0200 Subject: [PATCH] switch to psf/black action for linting --- .github/workflows/test.yml | 107 +++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 57 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 02a44e3..c18f067 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,63 +1,56 @@ name: Tests on: - push: - branches: - - "master" - - "main" - pull_request: + push: + branches: + - "master" + - "main" + pull_request: jobs: - lint: - runs-on: 'ubuntu-latest' - steps: - - uses: actions/checkout@v4 - - name: Install Python 3 - uses: actions/setup-python@v5 - - name: Lint - uses: ricardochaves/python-lint@v1.4.0 - with: - use-pylint: false - use-pycodestyle: false - use-flake8: false - use-black: true - use-mypy: false - use-isort: false + lint: + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v4 + - name: Install Python 3 + uses: actions/setup-python@v5 + - name: Lint + uses: psf/black@stable - test: - needs: lint - strategy: - fail-fast: true - matrix: - python-version: [ "3.8", "3.9", "3.10", "3.11" ] - runs-on: 'ubuntu-latest' - steps: - - uses: actions/checkout@v4 - - name: Install Python 3 - 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 --cov=./ --cov-report=xml tests/ - - name: Run Bandit - run: | - source .venv/bin/activate - bandit ./waybar_crypto.py + test: + needs: lint + strategy: + fail-fast: true + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v4 + - name: Install Python 3 + 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 --cov=./ --cov-report=xml tests/ + - name: Run Bandit + run: | + source .venv/bin/activate + bandit ./waybar_crypto.py