Skip to content

Commit

Permalink
Improve GH Workflows (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
No767 authored Mar 31, 2024
1 parent dbabf11 commit de36382
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 49 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,34 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Set up Poetry
uses: Gr1N/setup-poetry@v8
- name: Cache Poetry
id: cache-poetry
uses: actions/cache@v3

- name: Cache Dependencies
id: cache-pip
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-codeql-python-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry Dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
path: ~/.cache/pip
key: ${{ runner.os }}-codeql-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-codeql-pip-
- name: Install Dependencies
if: steps.cache-pip.outputs.cache-hit != 'true'
run: |
poetry install
pip install -r requirements.txt
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: python
setup-python-dependencies: false

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
upload: true
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
Expand Down
30 changes: 8 additions & 22 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,16 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.version }}
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}

- name: Set up Poetry
uses: Gr1N/setup-poetry@v8

- name: Cache Poetry
id: cache-poetry
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-cache-${{ matrix.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Poetry Dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install --with dev
- name: Run Pyright

- name: Install Tox
run: |
poetry run pyright bot
pip install "tox>=4.13.0,<5"
- name: Run Ruff
- name: Lint Codebase
run: |
poetry run ruff bot
RAW_PYTHON_VERSION=${{ matrix.version }}
PYTHON_VERSION=$(echo $RAW_PYTHON_VERSION | sed 's/\.//')
tox -e py$PYTHON_VERSION
107 changes: 95 additions & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ typing-extensions = "^4.10.0"
pre-commit = "^3"
pyright = "^1.1"
ruff = "^0.3"
tox = "^4"

[tool.poetry.group.docs.dependencies]
sphinx = "^7.2.6"
Expand Down Expand Up @@ -58,7 +59,7 @@ reportUnnecessaryTypeIgnoreComment = "warning"
[tool.bandit]
skips = ["B311", "B101"]

[tool.ruff]
[tool.ruff.lint]
ignore = ["E501", "N999", "E402", "S311"]
select = ["E", "F", "N", "ASYNC", "S", "ERA"]

Expand Down
15 changes: 15 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tox]
requires =
tox>=4
env_list = py{39,310,311,312}
no_package = true

[testenv]
description = run linting workflows
deps =
pyright>=1.1.355,<2
ruff>=0.3.4,<1
-r requirements.txt
commands =
pyright bot
ruff check bot

0 comments on commit de36382

Please sign in to comment.