Skip to content

Commit bd430d5

Browse files
authored
Infra: Use Ruff and uv in dev environment (#253)
* Simplified to Ruff - fix applied * Changed pylint to use ruff * Upgraded pre-commit, added gpg-init * Workflow upgrades and warning removals * Fixed devcontainer warnings;
1 parent 71adbc0 commit bd430d5

35 files changed

+747
-1801
lines changed

.devcontainer/Dockerfile

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@ RUN \
88
software-properties-common git default-jre && \
99
apt-get clean &&\
1010
rm -rf /var/lib/apt/lists/*
11+
# Install allure report
1112
RUN \
1213
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.20.1/allure-commandline-2.20.1.zip && \
1314
unzip allure-commandline-2.20.1.zip -d /allure && \
1415
rm allure-commandline-2.20.1.zip
15-
16-
ENV PATH "/allure/allure-2.20.1/bin:${PATH}"
16+
1717
RUN mkdir /config /icloud && chown -R vscode:vscode /config /icloud
18+
USER vscode
19+
# Install uv (pip replacement)
20+
RUN \
21+
curl -LsSf https://astral.sh/uv/install.sh | sh
22+
23+
ENV PATH="/allure/allure-2.20.1/bin:/home/vscode/.cargo/bin:${PATH}"
1824

1925
WORKDIR /workspaces

.devcontainer/devcontainer.json

+39-38
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,47 @@
55
"containerEnv": {
66
"DEVCONTAINER": "1"
77
},
8-
"extensions": [
9-
"ms-python.vscode-pylance",
10-
"visualstudioexptteam.vscodeintellicode",
11-
"redhat.vscode-yaml",
12-
"esbenp.prettier-vscode",
13-
"GitHub.vscode-pull-request-github"
14-
],
15-
"settings": {
16-
"python.pythonPath": "/usr/local/bin/python",
17-
"python.linting.enabled": true,
18-
"python.linting.pylintEnabled": true,
19-
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
20-
"python.linting.flake8Path": "/usr/local/bin/flake8",
21-
"python.linting.pycodestylePath": "/usr/local/bin/pycodestyle",
22-
"python.linting.pydocstylePath": "/usr/local/bin/pydocstyle",
23-
"python.linting.mypyPath": "/usr/local/bin/mypy",
24-
"python.linting.pylintPath": "/usr/local/bin/pylint",
25-
"python.formatting.provider": "black",
26-
"python.testing.pytestArgs": ["--no-cov"],
27-
"editor.formatOnPaste": false,
28-
"editor.formatOnSave": true,
29-
"editor.formatOnType": true,
30-
"files.trimTrailingWhitespace": true,
31-
"terminal.integrated.profiles.linux": {
32-
"zsh": {
33-
"path": "/usr/bin/zsh"
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"ms-python.vscode-pylance",
12+
"visualstudioexptteam.vscodeintellicode",
13+
"redhat.vscode-yaml",
14+
"esbenp.prettier-vscode",
15+
"GitHub.vscode-pull-request-github",
16+
"github.vscode-github-actions",
17+
"charliermarsh.ruff"
18+
],
19+
"settings": {
20+
"[python]": {
21+
"diffEditor.ignoreTrimWhitespace": false,
22+
"editor.formatOnType": true,
23+
"editor.formatOnSave": true,
24+
"editor.wordBasedSuggestions": "off",
25+
"editor.defaultFormatter": "charliermarsh.ruff",
26+
"editor.codeActionsOnSave": {
27+
"source.fixAll": "explicit",
28+
"source.organizeImports": "explicit"
29+
}
30+
},
31+
"python.pythonPath": "./venv/bin/python",
32+
"python.testing.pytestArgs": ["--no-cov"],
33+
"files.trimTrailingWhitespace": true,
34+
"terminal.integrated.defaultProfile.linux": "bash",
35+
"yaml.customTags": [
36+
"!input scalar",
37+
"!secret scalar",
38+
"!include_dir_named scalar",
39+
"!include_dir_list scalar",
40+
"!include_dir_merge_list scalar",
41+
"!include_dir_merge_named scalar"
42+
]
3443
}
35-
},
36-
"terminal.integrated.defaultProfile.linux": "zsh",
37-
"yaml.customTags": [
38-
"!input scalar",
39-
"!secret scalar",
40-
"!include_dir_named scalar",
41-
"!include_dir_list scalar",
42-
"!include_dir_merge_list scalar",
43-
"!include_dir_merge_named scalar"
44-
]
44+
}
4545
},
46-
"postCreateCommand": "pip install --upgrade pip && pip install -r requirements-test.txt",
46+
47+
"postCreateCommand": "uv venv && . .venv/bin/activate && uv pip install -r requirements-test.txt && git config commit.gpgsign true",
4748
"mounts": [
4849
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.gnupg,target=/home/vscode/.gnupg,type=bind,consistency=cached"
4950
]
50-
}
51+
}

.flake8

-2
This file was deleted.

.github/workflows/ci-main-test-coverage-deploy.yml

+28-26
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout source code
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525
- name: Set up Python 3.10
26-
uses: actions/setup-python@v4
26+
uses: actions/setup-python@v5
2727
with:
2828
python-version: "3.10"
2929
- name: Cache pip dependencies
30-
uses: actions/cache@v3
30+
uses: actions/cache@v4
3131
id: cache-dependencies
3232
with:
3333
path: ~/.cache/pip
@@ -43,13 +43,13 @@ jobs:
4343
runs-on: ubuntu-latest
4444
steps:
4545
- name: Checkout source code
46-
uses: actions/checkout@v3
46+
uses: actions/checkout@v4
4747
- name: Set up Python 3.10
48-
uses: actions/setup-python@v4
48+
uses: actions/setup-python@v5
4949
with:
5050
python-version: "3.10"
5151
- name: Restore pip cache dependencies
52-
uses: actions/cache@v3
52+
uses: actions/cache@v4
5353
with:
5454
path: ~/.cache/pip
5555
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }}
@@ -60,16 +60,18 @@ jobs:
6060
pip install -r requirements-test.txt
6161
- name: Test with pytest
6262
run: |
63-
sudo mkdir /config /icloud && sudo chown -R $(id -u) /config /icloud && pytest
63+
sudo mkdir /config /icloud &&
64+
sudo chown -R $(id -u):$(id -g) /config /icloud &&
65+
ENV_CONFIG_FILE_PATH=./tests/data/test_config.yaml pytest
6466
- name: Upload coverage artifacts
65-
uses: actions/upload-artifact@v3
67+
uses: actions/upload-artifact@v4
6668
if: ${{ success() }}
6769
with:
6870
name: coverage-output
6971
path: htmlcov
7072
retention-days: 1
7173
- name: Checkout gh-pages
72-
uses: actions/checkout@v3
74+
uses: actions/checkout@v4
7375
if: always()
7476
continue-on-error: true
7577
with:
@@ -90,19 +92,19 @@ jobs:
9092
run: |
9193
python generate_badges.py
9294
- name: Upload tests artifacts
93-
uses: actions/upload-artifact@v3
95+
uses: actions/upload-artifact@v4
9496
with:
9597
name: test-output.zip
9698
path: test-output.zip
9799
retention-days: 1
98100
- name: Upload coverage artifacts
99-
uses: actions/upload-artifact@v3
101+
uses: actions/upload-artifact@v4
100102
with:
101103
name: coverage-output
102104
path: htmlcov
103105
retention-days: 1
104106
- name: Upload badges artifacts
105-
uses: actions/upload-artifact@v3
107+
uses: actions/upload-artifact@v4
106108
with:
107109
name: badges-output
108110
path: badges
@@ -112,13 +114,13 @@ jobs:
112114
runs-on: ubuntu-latest
113115
steps:
114116
- name: Download test artifacts
115-
uses: actions/download-artifact@v3
117+
uses: actions/download-artifact@v4
116118
with:
117119
name: test-output.zip
118120
# - name: Setup tmate session
119121
# uses: mxschmitt/action-tmate@v3
120122
- name: Checkout gh-pages
121-
uses: actions/checkout@v3
123+
uses: actions/checkout@v4
122124
if: always()
123125
continue-on-error: true
124126
with:
@@ -129,7 +131,7 @@ jobs:
129131
unzip test-output.zip && rm test-output.zip
130132
- name: Publish test report to gh-pages
131133
if: always()
132-
uses: peaceiris/actions-gh-pages@v3
134+
uses: peaceiris/actions-gh-pages@v4
133135
with:
134136
deploy_key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
135137
publish_branch: gh-pages
@@ -140,20 +142,20 @@ jobs:
140142
runs-on: ubuntu-latest
141143
steps:
142144
- name: Download coverage artifacts
143-
uses: actions/download-artifact@v3
145+
uses: actions/download-artifact@v4
144146
with:
145147
name: coverage-output
146148
path: coverage
147149
- name: Checkout gh-pages
148-
uses: actions/checkout@v3
150+
uses: actions/checkout@v4
149151
if: always()
150152
continue-on-error: true
151153
with:
152154
ref: gh-pages
153155
path: gh-pages
154156
- name: Publish test coverage to gh-pages
155157
if: always()
156-
uses: peaceiris/actions-gh-pages@v3
158+
uses: peaceiris/actions-gh-pages@v4
157159
with:
158160
deploy_key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
159161
publish_branch: gh-pages
@@ -164,20 +166,20 @@ jobs:
164166
runs-on: ubuntu-latest
165167
steps:
166168
- name: Download badges artifacts
167-
uses: actions/download-artifact@v3
169+
uses: actions/download-artifact@v4
168170
with:
169171
name: badges-output
170172
path: badges
171173
- name: Checkout gh-pages
172-
uses: actions/checkout@v3
174+
uses: actions/checkout@v4
173175
if: always()
174176
continue-on-error: true
175177
with:
176178
ref: gh-pages
177179
path: gh-pages
178180
- name: Publish badges to gh-pages
179181
if: always()
180-
uses: peaceiris/actions-gh-pages@v3
182+
uses: peaceiris/actions-gh-pages@v4
181183
with:
182184
deploy_key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
183185
publish_branch: gh-pages
@@ -188,24 +190,24 @@ jobs:
188190
runs-on: ubuntu-latest
189191
steps:
190192
- name: Check Out Repo
191-
uses: actions/checkout@v3
193+
uses: actions/checkout@v4
192194
- name: Cache Docker layers
193-
uses: actions/cache@v3
195+
uses: actions/cache@v4
194196
with:
195197
path: /tmp/.buildx-cache
196198
key: ${{ runner.os }}-buildx-${{ github.sha }}
197199
restore-keys: |
198200
${{ runner.os }}-buildx-
199201
- name: Login to Docker Hub
200-
uses: docker/login-action@v2
202+
uses: docker/login-action@v3
201203
with:
202204
username: ${{ secrets.DOCKER_HUB_USERNAME }}
203205
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
204206
- name: Set up Docker QEMU
205-
uses: docker/setup-qemu-action@v2
207+
uses: docker/setup-qemu-action@v3
206208
- name: Set up Docker Buildx
207209
id: buildx
208-
uses: docker/setup-buildx-action@v2
210+
uses: docker/setup-buildx-action@v3
209211
- name: Build and push
210212
id: docker_build
211213
uses: docker/build-push-action@v5

.github/workflows/ci-pr-test.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ jobs:
5858
pip install -r requirements-test.txt
5959
- name: Test with pytest
6060
run: |
61-
sudo mkdir /config /icloud && sudo chown -R $(id -u):$(id -g) /config /icloud && pylint src/ tests/ && ENV_CONFIG_FILE_PATH=./tests/data/test_config.yaml pytest
61+
sudo mkdir /config /icloud &&
62+
sudo chown -R $(id -u):$(id -g) /config /icloud &&
63+
ruff check &&
64+
ENV_CONFIG_FILE_PATH=./tests/data/test_config.yaml pytest
6265
# - name: Setup tmate session
6366
# uses: mxschmitt/action-tmate@v3
6467
- name: Generate Allure Report

.github/workflows/close-stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
stale:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/stale@v4
10+
- uses: actions/stale@v9
1111
with:
1212
stale-issue-message: "This issue is stale because it has been open 1 year with no activity. Remove stale label or comment or this will be closed in 5 days."
1313
days-before-stale: 365

.github/workflows/official-release-to-docker-hub.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
# Steps represent a sequence of tasks that will be executed as part of the job
2323
steps:
2424
- name: Check Out Repo
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2626
- name: Prepare
2727
id: prep
2828
run: |
@@ -32,25 +32,25 @@ jobs:
3232
fi
3333
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:latest"
3434
echo "${TAGS}"
35-
echo ::set-output name=tags::${TAGS}
36-
echo ::set-output name=version::${VERSION}
35+
echo "name=tags::${TAGS}" >> $GITHUB_OUTPUT
36+
echo "name=version::${VERSION}" >> $GITHUB_OUTPUT
3737
- name: Cache Docker layers
38-
uses: actions/cache@v3
38+
uses: actions/cache@v4
3939
with:
4040
path: /tmp/.buildx-cache
4141
key: ${{ runner.os }}-buildx-${{ github.sha }}
4242
restore-keys: |
4343
${{ runner.os }}-buildx-
4444
- name: Login to Docker Hub
45-
uses: docker/login-action@v2
45+
uses: docker/login-action@v3
4646
with:
4747
username: ${{ secrets.DOCKER_HUB_USERNAME }}
4848
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
4949
- name: Set up Docker QEMU
50-
uses: docker/setup-qemu-action@v2
50+
uses: docker/setup-qemu-action@v3
5151
- name: Set up Docker Buildx
5252
id: buildx
53-
uses: docker/setup-buildx-action@v2
53+
uses: docker/setup-buildx-action@v3
5454
- name: Build and push
5555
id: docker_build
5656
uses: docker/build-push-action@v5
@@ -72,6 +72,6 @@ jobs:
7272
name: Move cache
7373
run: |
7474
rm -rf /tmp/.buildx-cache
75-
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
75+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
7676
- name: Image digest
7777
run: echo ${{ steps.docker_build.outputs.digest }}

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,5 @@ allure-report
136136
ignore-config.yaml
137137
session
138138
session_data
139-
icloud/
139+
icloud/
140+
.ruff_cache/

0 commit comments

Comments
 (0)