Skip to content

Commit

Permalink
Update ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
filipsalo committed Apr 2, 2024
1 parent 4450c7b commit c116489
Showing 1 changed file with 57 additions and 56 deletions.
113 changes: 57 additions & 56 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit c116489

Please sign in to comment.