-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve GitHub workflows to use Ruff
Ruff should catch cross-version issues, so we don't need to lint on all versions.
- Loading branch information
1 parent
5a5d8a2
commit 77bfa0d
Showing
2 changed files
with
32 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
pip install -r .[dev] | ||
- name: Lint with ruff | ||
run: ruff check | ||
- name: Format with ruff | ||
run: ruff format --check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/* |