From 4a36053c324139edab724ec529e9a7c904266e35 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Sun, 24 Mar 2024 12:55:23 +0100 Subject: [PATCH] Update CI --- .github/workflows/ci.yml | 36 +++++++++++++++---------------- .github/workflows/pypi_upload.yml | 35 ++++++++++++++---------------- .pre-commit-config.yaml | 4 +--- pyproject.toml | 1 + 4 files changed, 35 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98a33dd..ab4b05f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,35 +1,33 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python package +name: Lint & Test on: push: - branches: [ "master" ] + branches: ["master"] pull_request: - branches: [ "master" ] + branches: ["master"] jobs: build: - runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install -e .[dev] - - name: Run linters - run: | - pre-commit run --all-files - - name: Test with pytest - run: | - pytest + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: python -m pip install -e .[dev] + - name: Run ruff + run: ruff check --verbose + - name: Run linters + run: pre-commit run --all-files + - name: Test with pytest + run: pytest diff --git a/.github/workflows/pypi_upload.yml b/.github/workflows/pypi_upload.yml index bf7c5ab..179c91c 100644 --- a/.github/workflows/pypi_upload.yml +++ b/.github/workflows/pypi_upload.yml @@ -1,5 +1,5 @@ # Based on flake8-bugbear -name: pypi_upload +name: Upload to PyPI on: release: @@ -9,26 +9,23 @@ jobs: upload: name: PyPI Upload runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.11 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.11 - - name: Install latest pip, twine & build - run: | - python -m pip install --upgrade pip twine build + - name: Install latest pip, twine & build + run: python -m pip install --upgrade pip twine build - - name: Build Python package - run: | - python -m build - twine check dist/* + - name: Build Python package + run: | + python -m build + twine check dist/* - - name: Upload to PyPI - env: - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - twine upload --verbose -u '__token__' dist/* + - name: Upload to PyPI + env: + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: twine upload --verbose -u '__token__' dist/* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5344993..4905f5a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,9 +5,7 @@ repos: hooks: # Run the linter. - id: ruff - args: [ --fix ] - # Run the formatter. - - id: ruff-format + args: [--fix, --verbose] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 218adf3..d1cd329 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,7 @@ line_length = 120 lines_after_imports = 2 [tool.ruff.lint] +select = ["ALL"] ignore = [ "D", "ANN002",