Skip to content

Commit c36b2aa

Browse files
committed
Switch CI to UV GitHub actions
1 parent ab43308 commit c36b2aa

File tree

18 files changed

+190
-249
lines changed

18 files changed

+190
-249
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
version: 2
22
updates:
3-
- package-ecosystem: pip
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
- package-ecosystem: npm
8-
directory: "/"
9-
schedule:
10-
interval: weekly
11-
- package-ecosystem: github-actions
12-
directory: "/"
13-
schedule:
14-
interval: daily
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
- package-ecosystem: npm
8+
directory: "/"
9+
schedule:
10+
interval: weekly
11+
- package-ecosystem: github-actions
12+
directory: "/"
13+
schedule:
14+
interval: daily

.github/workflows/ci.yml

Lines changed: 27 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
name: CI
2-
32
on:
43
push:
54
branches:
65
- main
76
pull_request:
8-
97
jobs:
10-
118
dist:
129
runs-on: ubuntu-latest
1310
steps:
1411
- uses: actions/checkout@v6
15-
- uses: actions/setup-python@v6
12+
- uses: astral-sh/setup-uv@v7
13+
- run: uvx --from build pyproject-build --sdist --wheel
14+
- run: uvx twine check dist/*
15+
- uses: actions/upload-artifact@v6
1616
with:
17-
python-version: "3.x"
18-
- run: python -m pip install --upgrade pip build wheel twine
19-
- run: python -m build --sdist --wheel
20-
- run: python -m twine check dist/*
21-
17+
path: dist/*
2218
js-lint:
2319
runs-on: ubuntu-latest
2420
steps:
@@ -29,8 +25,6 @@ jobs:
2925
- name: Install Node dependencies
3026
run: npm ci
3127
- run: npm run lint:js
32-
33-
3428
js-test:
3529
runs-on: ubuntu-latest
3630
needs:
@@ -48,30 +42,8 @@ jobs:
4842
token: ${{ secrets.CODECOV_TOKEN }}
4943
flags: javascript
5044
file: lcov.txt
51-
52-
py-lint:
53-
runs-on: ubuntu-latest
54-
strategy:
55-
matrix:
56-
lint-command:
57-
- bandit -r . -x ./tests
58-
- black --check --diff .
59-
- flake8 .
60-
- isort --check-only --diff .
61-
- pydocstyle .
62-
steps:
63-
- uses: actions/checkout@v6
64-
- uses: actions/setup-python@v6
65-
with:
66-
python-version: "3.x"
67-
cache: 'pip'
68-
cache-dependency-path: 'linter-requirements.txt'
69-
- run: python -m pip install -r linter-requirements.txt
70-
- run: ${{ matrix.lint-command }}
71-
7245
pytest:
7346
needs:
74-
- py-lint
7547
- dist
7648
runs-on: ubuntu-latest
7749
strategy:
@@ -85,33 +57,26 @@ jobs:
8557
- "5.0"
8658
- "5.1"
8759
steps:
88-
- uses: actions/checkout@v6
89-
- name: Set up Python ${{ matrix.python-version }}
90-
uses: actions/setup-python@v6
91-
with:
92-
python-version: ${{ matrix.python-version }}
93-
94-
- name: Install Chrome
95-
run: |
96-
sudo apt update
97-
sudo apt install -y google-chrome-stable
98-
- name: Install Selenium
99-
run: |
100-
mkdir bin
101-
curl -qO "https://chromedriver.storage.googleapis.com/$(curl -q https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip"
102-
unzip chromedriver_linux64.zip -d bin
103-
104-
- run: python -m pip install .[test]
105-
- run: python -m pip install django~=${{ matrix.django-version }}.0
106-
- run: python -m pytest -m "not selenium"
107-
env:
108-
PATH: $PATH:$(pwd)/bin
109-
- uses: codecov/codecov-action@v5
110-
with:
111-
token: ${{ secrets.CODECOV_TOKEN }}
112-
flags: python
113-
114-
60+
- uses: actions/checkout@v6
61+
- uses: astral-sh/setup-uv@v7
62+
with:
63+
python-version: ${{ matrix.python-version }}
64+
- name: Install Chrome
65+
run: |
66+
sudo apt update
67+
sudo apt install -y google-chrome-stable
68+
- name: Install Selenium
69+
run: |
70+
mkdir bin
71+
curl -qO "https://chromedriver.storage.googleapis.com/$(curl -q https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip"
72+
unzip chromedriver_linux64.zip -d bin
73+
- run: uv run --with django~=${{ matrix.django-version }}.0 pytest -m "not selenium"
74+
env:
75+
PATH: $PATH:$(pwd)/bin
76+
- uses: codecov/codecov-action@v5
77+
with:
78+
token: ${{ secrets.CODECOV_TOKEN }}
79+
flags: python
11580
selenium:
11681
needs:
11782
- pytest
@@ -129,47 +94,11 @@ jobs:
12994
mkdir bin
13095
curl -O https://chromedriver.storage.googleapis.com/`curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip
13196
unzip chromedriver_linux64.zip -d bin
132-
- uses: actions/setup-python@v6
97+
- uses: astral-sh/setup-uv@v7
13398
with:
13499
python-version: ${{ matrix.python-version }}
135-
- run: python -m pip install -e .[test]
136-
- run: python -m pytest -m selenium
100+
- run: uv run --with django~=${{ matrix.django-version }}.0 pytest -m selenium
137101
- uses: codecov/codecov-action@v5
138102
with:
139103
token: ${{ secrets.CODECOV_TOKEN }}
140104
flags: selenium
141-
142-
143-
analyze:
144-
name: CodeQL Analyze
145-
needs:
146-
- pytest
147-
runs-on: ubuntu-latest
148-
permissions:
149-
actions: read
150-
contents: read
151-
security-events: write
152-
153-
strategy:
154-
fail-fast: false
155-
matrix:
156-
language: [ javascript, python ]
157-
158-
steps:
159-
- name: Checkout
160-
uses: actions/checkout@v6
161-
162-
- name: Initialize CodeQL
163-
uses: github/codeql-action/init@v4
164-
with:
165-
languages: ${{ matrix.language }}
166-
queries: +security-and-quality
167-
168-
- name: Autobuild
169-
uses: github/codeql-action/autobuild@v4
170-
if: ${{ matrix.language == 'javascript' || matrix.language == 'python' }}
171-
172-
- name: Perform CodeQL Analysis
173-
uses: github/codeql-action/analyze@v4
174-
with:
175-
category: "/language:${{ matrix.language }}"

.github/workflows/release.yml

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
name: Release
2-
32
on:
43
release:
54
types: [published]
6-
5+
workflow_dispatch:
76
jobs:
8-
PyPi:
9-
7+
pypi-build:
108
runs-on: ubuntu-latest
119
steps:
12-
- uses: actions/checkout@v6
13-
- uses: actions/setup-python@v6
14-
with:
15-
python-version: "3.x"
16-
- run: python -m pip install --upgrade pip build wheel twine
17-
- uses: actions/setup-node@v6
18-
- name: Install Node dependencies
19-
run: npm ci
20-
- name: Minify JavaScript files
21-
run: npm run minify
22-
- run: python -m build --sdist --wheel
23-
- run: python -m twine upload dist/*
24-
env:
25-
TWINE_USERNAME: __token__
26-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
10+
- uses: actions/checkout@v6
11+
- uses: astral-sh/setup-uv@v7
12+
- run: uvx --from build pyproject-build --sdist --wheel
13+
- uses: actions/upload-artifact@v6
14+
with:
15+
name: release-dists
16+
path: dist/
17+
pypi-publish:
18+
runs-on: ubuntu-latest
19+
needs:
20+
- pypi-build
21+
permissions:
22+
id-token: write
23+
steps:
24+
- uses: actions/download-artifact@v7
25+
with:
26+
name: release-dists
27+
path: dist/
28+
- uses: pypa/gh-action-pypi-publish@release/v1

.pre-commit-config.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: check-merge-conflict
7+
- id: check-ast
8+
- id: check-toml
9+
- id: check-yaml
10+
- id: check-symlinks
11+
- id: debug-statements
12+
- id: end-of-file-fixer
13+
exclude: "mailauth/templates/registration/login_subject.txt"
14+
- id: no-commit-to-branch
15+
args: [--branch, main]
16+
- repo: https://github.com/asottile/pyupgrade
17+
rev: v3.21.2
18+
hooks:
19+
- id: pyupgrade
20+
- repo: https://github.com/adamchainz/django-upgrade
21+
rev: 1.29.1
22+
hooks:
23+
- id: django-upgrade
24+
- repo: https://github.com/hukkin/mdformat
25+
rev: 1.0.0
26+
hooks:
27+
- id: mdformat
28+
additional_dependencies:
29+
- mdformat-ruff
30+
- mdformat-footnote
31+
- mdformat-gfm
32+
- mdformat-gfm-alerts
33+
- repo: https://github.com/astral-sh/ruff-pre-commit
34+
rev: v0.14.9
35+
hooks:
36+
- id: ruff-check
37+
args: [--fix, --exit-non-zero-on-fix]
38+
- id: ruff-format
39+
- repo: https://github.com/google/yamlfmt
40+
rev: v0.20.0
41+
hooks:
42+
- id: yamlfmt
43+
ci:
44+
autoupdate_schedule: weekly
45+
skip:
46+
- no-commit-to-branch

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

MANIFEST.in

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubu
1717

1818
## Features
1919

20-
- lightweight: less 200 lines
21-
- no JavaScript or Python dependencies (no jQuery)
22-
- easy integration
23-
- works just like the built-in
24-
- extendable JavaScript API
20+
- lightweight: less 200 lines
21+
- no JavaScript or Python dependencies (no jQuery)
22+
- easy integration
23+
- works just like the built-in
24+
- extendable JavaScript API
2525

2626
## For the Nerds
2727

@@ -81,15 +81,15 @@ Add the S3File app and middleware in your settings:
8181
# settings.py
8282

8383
INSTALLED_APPS = (
84-
'...',
85-
's3file',
86-
'...',
84+
"...",
85+
"s3file",
86+
"...",
8787
)
8888

8989
MIDDLEWARE = (
90-
'...',
91-
's3file.middleware.S3FileMiddleware',
92-
'...',
90+
"...",
91+
"s3file.middleware.S3FileMiddleware",
92+
"...",
9393
)
9494
```
9595

@@ -150,7 +150,7 @@ to `FileSystemStorage`.
150150

151151
To prevent users from accidentally using the `FileSystemStorage` and the
152152
insecure S3 dummy backend in production, there is also an additional
153-
deployment check that will error if you run Django\'s deployment check
153+
deployment check that will error if you run Django's deployment check
154154
suite:
155155

156156
```shell
@@ -177,14 +177,15 @@ uploading the file to S3 and then copying it byte-by-byte to perform a
177177
move operation just to rename the uploaded object. For large files this
178178
leads to additional loading times for the user.
179179

180-
That\'s why S3File provides an optimized version of this method at
180+
That's why S3File provides an optimized version of this method at
181181
`storages_optimized.S3OptimizedUploadStorage`. It uses the more
182182
efficient `copy` method from S3, given that we know that we only copy
183183
from one S3 location to another.
184184

185185
```python
186186
from s3file.storages_optimized import S3OptimizedUploadStorage
187187

188+
188189
class MyStorage(S3OptimizedUploadStorage): # Subclass and use like any other storage
189-
default_acl = 'private'
190+
default_acl = "private"
190191
```

0 commit comments

Comments
 (0)