From 8edc527a1ecc3b39a81b04960655c875db7eecfc Mon Sep 17 00:00:00 2001 From: Filip Salomonsson Date: Tue, 2 Apr 2024 20:20:25 +0200 Subject: [PATCH] Update ci workflow --- .github/workflows/ci.yml | 113 ++++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 56 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d61b77..acc83be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,13 +2,13 @@ name: CI on: push: - branches: [ "main", "ci" ] + branches: ["main", "ci"] pull_request: - branches: [ "main" ] + branches: ["main"] permissions: contents: read env: - POETRY_VERSION: 1.3.2 + POETRY_VERSION: 1.8.2 defaults: run: shell: bash @@ -19,69 +19,70 @@ jobs: strategy: matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - - name: ✨ Check out repository - uses: actions/checkout@v3 + - name: ✨ Check out repository + uses: actions/checkout@v3 - - name: Add Poetry to PATH - run: | - echo ~/.poetry/bin >> $GITHUB_PATH - echo ~/.poetry/Scripts >> $GITHUB_PATH + - name: Add Poetry to PATH + run: | + echo ~/.poetry/bin >> $GITHUB_PATH + echo ~/.poetry/Scripts >> $GITHUB_PATH - - if: ${{ runner.os == 'Windows' }} - name: Use GNU tar - shell: cmd - run: | - echo "Adding GNU tar to PATH" - echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" + - if: ${{ runner.os == 'Windows' }} + name: Use GNU tar + shell: cmd + run: | + echo "Adding GNU tar to PATH" + echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" - - name: ⚙️ Cache Poetry ${{ env.POETRY_VERSION }} - id: cache-poetry - uses: actions/cache@v3 - with: - path: ~/.poetry - key: poetry-${{ env.POETRY_VERSION }}-py${{ matrix.python-version }}-${{ runner.os }} + - name: ⚙️ Cache Poetry ${{ env.POETRY_VERSION }} + id: cache-poetry + uses: actions/cache@v3 + with: + path: ~/.poetry + key: poetry-${{ env.POETRY_VERSION }}-py${{ matrix.python-version }}-${{ runner.os }} - - name: ⚙️ Install Poetry ${{ env.POETRY_VERSION }} - if: ${{ steps.cache-poetry.outputs.cache-hit != 'true' }} - run: | - python3 -mvenv ~/.poetry - pip install poetry==${POETRY_VERSION} - poetry config virtualenvs.in-project true --local - poetry --version + - name: ⚙️ Install Poetry ${{ env.POETRY_VERSION }} + if: ${{ steps.cache-poetry.outputs.cache-hit != 'true' }} + run: | + python3 -mvenv ~/.poetry + pip install poetry==${POETRY_VERSION} + poetry config virtualenvs.in-project true --local + poetry --version - - name: ⚙️ Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} + - name: ⚙️ Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - - name: ⚙️ Cache dependencies - id: cache-deps - uses: actions/cache@v3 - with: - path: .venv - key: deps-${{ hashFiles('**/poetry.lock') }}-py${{ matrix.python-version }}-${{ runner.os }} + - name: ⚙️ Cache dependencies + id: cache-deps + uses: actions/cache@v3 + with: + path: .venv + key: deps-${{ hashFiles('**/poetry.lock') }}-py${{ matrix.python-version }}-${{ runner.os }} - - name: 📦 Install dependencies - if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }} - run: poetry install --no-interaction --no-root + - name: 📦 Install dependencies + if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }} + run: poetry install --no-interaction --no-root - - name: 📦 Install project - run: poetry install --no-interaction --only-root + - name: 📦 Install project + run: poetry install --no-interaction --only-root - - name: 🎨 isort - run: poetry run isort --check-only --verbose **/*.py + - name: 🎨 isort + run: poetry run isort --check-only --verbose **/*.py - - name: 🎨 black - run: poetry run black --check . + - name: 🎨 black + run: poetry run black --check . - - name: 🎨 pylint - run: poetry run pylint surblclient tests - # stop the build if there are Python syntax errors or undefined names - # poetry run flake8 . --extend-exclude .venv --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - # poetry run flake8 . --extend-exclude .venv --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: 🎨 pylint + run: + poetry run pylint surblclient tests + # stop the build if there are Python syntax errors or undefined names + # poetry run flake8 . --extend-exclude .venv --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + # poetry run flake8 . --extend-exclude .venv --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: 🚦 Test with pytest - run: poetry run pytest --cov=surblclient + - name: 🚦 Test with pytest + run: poetry run pytest --cov=surblclient