diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d01e91d..d3ae34d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,34 +1,21 @@ -name: Lint with flake8 +name: Lint with ruff on: [push, pull_request] jobs: lint: runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] steps: - - uses: actions/checkout@v1 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- + python-version: "3.12" + - run: python my_script.py - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 - pip install -r requirements.txt - - name: Lint with flake8 - run: | - flake8 --count --statistics - - name: Check errors with pylint - run: pylint aiotfm --disable=all --enable=E \ No newline at end of file + pip install -r .[dev] + - name: Lint with ruff + run: ruff check + - name: Format with ruff + run: ruff format --check diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index ecdef27..26118e9 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -1,53 +1,49 @@ name: Upload Python Package on: - workflow_dispatch: - push: - branches: - - master - paths: - - 'aiotfm/__version__.py' + workflow_dispatch: + push: + branches: + - master + paths: + - "aiotfm/__version__.py" jobs: lint: runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] steps: - - uses: actions/checkout@v1 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: "3.12" + - run: python my_script.py - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pylint - pip install -r requirements.txt - # cancel the build if a syntax error or an undefined name is found. - - name: Check errors with flake8 - run: flake8 aiotfm --count --select F6,F7,F82,E9 - - name: Check errors with pylint - run: pylint aiotfm --disable=all --enable=E + pip install -r .[dev] + # Cancel the build if ruff detects something wrong + - name: Lint with ruff + run: ruff check + - name: Format with ruff + run: ruff format --check deploy: needs: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: '3.7' + python-version: "3.12" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine - pip install -r requirements.txt + pip install setuptools wheel twine build + pip install . - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel + python -m build twine upload dist/*