Skip to content

Commit de36382

Browse files
authored
Improve GH Workflows (#94)
1 parent dbabf11 commit de36382

File tree

6 files changed

+139
-49
lines changed

6 files changed

+139
-49
lines changed

.github/workflows/codeql.yml

+18-13
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,34 @@ jobs:
2323
steps:
2424
- name: Checkout Repository
2525
uses: actions/checkout@v4
26+
2627
- name: Set up Python 3.12
2728
id: setup-python
28-
uses: actions/setup-python@v4
29+
uses: actions/setup-python@v5
2930
with:
3031
python-version: '3.12'
31-
- name: Set up Poetry
32-
uses: Gr1N/setup-poetry@v8
33-
- name: Cache Poetry
34-
id: cache-poetry
35-
uses: actions/cache@v3
32+
33+
- name: Cache Dependencies
34+
id: cache-pip
35+
uses: actions/cache@v4
3636
with:
37-
path: ~/.cache/pypoetry/virtualenvs
38-
key: ${{ runner.os }}-codeql-python-${{ hashFiles('**/poetry.lock') }}
39-
- name: Install Poetry Dependencies
40-
if: steps.cache-poetry.outputs.cache-hit != 'true'
37+
path: ~/.cache/pip
38+
key: ${{ runner.os }}-codeql-pip-${{ hashFiles('**/requirements.txt') }}
39+
restore-keys: |
40+
${{ runner.os }}-codeql-pip-
41+
42+
- name: Install Dependencies
43+
if: steps.cache-pip.outputs.cache-hit != 'true'
4144
run: |
42-
poetry install
45+
pip install -r requirements.txt
46+
4347
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@v2
48+
uses: github/codeql-action/init@v3
4549
with:
4650
languages: python
4751
setup-python-dependencies: false
52+
4853
- name: Perform CodeQL Analysis
49-
uses: github/codeql-action/analyze@v2
54+
uses: github/codeql-action/analyze@v3
5055
with:
5156
upload: true

.github/workflows/dependabot-auto-merge.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121
- name: Dependabot metadata
2222
id: metadata
23-
uses: dependabot/fetch-metadata@v1
23+
uses: dependabot/fetch-metadata@v2
2424
with:
2525
github-token: "${{ secrets.GITHUB_TOKEN }}"
2626
- name: Enable auto-merge for Dependabot PRs

.github/workflows/lint.yml

+8-22
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,16 @@ jobs:
2222
uses: actions/checkout@v4
2323

2424
- name: Set up Python ${{ matrix.version }}
25-
id: setup-python
26-
uses: actions/setup-python@v4
25+
uses: actions/setup-python@v5
2726
with:
2827
python-version: ${{ matrix.version }}
29-
30-
- name: Set up Poetry
31-
uses: Gr1N/setup-poetry@v8
32-
33-
- name: Cache Poetry
34-
id: cache-poetry
35-
uses: actions/cache@v3
36-
with:
37-
path: ~/.cache/pypoetry/virtualenvs
38-
key: ${{ runner.os }}-poetry-cache-${{ matrix.version }}-${{ hashFiles('**/poetry.lock') }}
39-
40-
- name: Install Poetry Dependencies
41-
if: steps.cache-poetry.outputs.cache-hit != 'true'
42-
run: |
43-
poetry install --with dev
44-
45-
- name: Run Pyright
28+
29+
- name: Install Tox
4630
run: |
47-
poetry run pyright bot
31+
pip install "tox>=4.13.0,<5"
4832
49-
- name: Run Ruff
33+
- name: Lint Codebase
5034
run: |
51-
poetry run ruff bot
35+
RAW_PYTHON_VERSION=${{ matrix.version }}
36+
PYTHON_VERSION=$(echo $RAW_PYTHON_VERSION | sed 's/\.//')
37+
tox -e py$PYTHON_VERSION

poetry.lock

+95-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ typing-extensions = "^4.10.0"
3131
pre-commit = "^3"
3232
pyright = "^1.1"
3333
ruff = "^0.3"
34+
tox = "^4"
3435

3536
[tool.poetry.group.docs.dependencies]
3637
sphinx = "^7.2.6"
@@ -58,7 +59,7 @@ reportUnnecessaryTypeIgnoreComment = "warning"
5859
[tool.bandit]
5960
skips = ["B311", "B101"]
6061

61-
[tool.ruff]
62+
[tool.ruff.lint]
6263
ignore = ["E501", "N999", "E402", "S311"]
6364
select = ["E", "F", "N", "ASYNC", "S", "ERA"]
6465

tox.ini

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[tox]
2+
requires =
3+
tox>=4
4+
env_list = py{39,310,311,312}
5+
no_package = true
6+
7+
[testenv]
8+
description = run linting workflows
9+
deps =
10+
pyright>=1.1.355,<2
11+
ruff>=0.3.4,<1
12+
-r requirements.txt
13+
commands =
14+
pyright bot
15+
ruff check bot

0 commit comments

Comments
 (0)