Skip to content

Commit bc9e66f

Browse files
committed
Fix CI issues.
1 parent b53e165 commit bc9e66f

File tree

4 files changed

+189
-32
lines changed

4 files changed

+189
-32
lines changed
Lines changed: 110 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,118 @@
1-
name: Django Tink Fields
1+
name: Tests
22

33
on:
4-
- push
5-
- pull_request
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
68

79
jobs:
8-
build:
10+
test:
911
runs-on: ubuntu-latest
1012
strategy:
1113
matrix:
12-
python-version: ["3.7", "3.8", "3.9"]
14+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
15+
django-version: ["5.2", "5.1", "5.0"]
16+
exclude:
17+
- python-version: "3.10"
18+
django-version: "5.0"
19+
- python-version: "3.11"
20+
django-version: "5.0"
21+
- python-version: "3.12"
22+
django-version: "5.0"
23+
- python-version: "3.13"
24+
django-version: "5.0"
25+
- python-version: "3.14"
26+
django-version: "5.0"
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Set up Python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
37+
- name: Cache pip dependencies
38+
uses: actions/cache@v4
39+
with:
40+
path: ~/.cache/pip
41+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
42+
restore-keys: |
43+
${{ runner.os }}-pip-
44+
45+
- name: Install dependencies
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install -r requirements-test.txt
49+
pip install "Django>=${{ matrix.django-version }},<$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))').0"
50+
51+
- name: Run tests
52+
run: |
53+
pytest tink_fields/test/ -v --cov=tink_fields --cov-report=xml --cov-report=term-missing
54+
55+
- name: Upload coverage to Codecov
56+
uses: codecov/codecov-action@v4
57+
with:
58+
file: ./coverage.xml
59+
flags: unittests
60+
name: codecov-umbrella
61+
fail_ci_if_error: false
62+
63+
lint:
64+
runs-on: ubuntu-latest
1365
steps:
14-
- uses: actions/checkout@v1
15-
- name: Set up Python ${{ matrix.python-version }}
16-
uses: actions/setup-python@v2
17-
with:
18-
python-version: ${{ matrix.python-version }}
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
python -m pip install tox tox-gh-actions
23-
- name: Test with tox
24-
run: tox
66+
- name: Checkout code
67+
uses: actions/checkout@v4
68+
69+
- name: Set up Python 3.14
70+
uses: actions/setup-python@v5
71+
with:
72+
python-version: "3.14"
73+
74+
- name: Install dependencies
75+
run: |
76+
python -m pip install --upgrade pip
77+
pip install -r requirements-dev.txt
78+
79+
- name: Run Black
80+
run: black --check tink_fields/
81+
82+
- name: Run isort
83+
run: isort --check-only tink_fields/
84+
85+
- name: Run flake8
86+
run: flake8 tink_fields/
87+
88+
- name: Run mypy
89+
run: mypy tink_fields/
90+
91+
security:
92+
runs-on: ubuntu-latest
93+
steps:
94+
- name: Checkout code
95+
uses: actions/checkout@v4
96+
97+
- name: Set up Python 3.14
98+
uses: actions/setup-python@v5
99+
with:
100+
python-version: "3.14"
101+
102+
- name: Install dependencies
103+
run: |
104+
python -m pip install --upgrade pip
105+
pip install safety bandit
106+
107+
- name: Run safety check
108+
run: safety check
109+
110+
- name: Run bandit security linter
111+
run: bandit -r tink_fields/ -f json -o bandit-report.json || true
112+
113+
- name: Upload bandit report
114+
uses: actions/upload-artifact@v4
115+
if: always()
116+
with:
117+
name: bandit-report
118+
path: bandit-report.json

.github/workflows/release.yml

Lines changed: 76 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,90 @@
1-
2-
name: Upload Python Package
1+
name: Release
32

43
on:
54
release:
6-
types: [created]
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to release (e.g., 0.3.0)'
10+
required: true
11+
type: string
712

813
jobs:
9-
deploy:
10-
14+
build-and-publish:
1115
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
id-token: write
1219

1320
steps:
14-
- uses: actions/checkout@v2
15-
- name: Set up Python
16-
uses: actions/setup-python@v2
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python 3.14
25+
uses: actions/setup-python@v5
1726
with:
18-
python-version: '3.x'
27+
python-version: "3.14"
28+
29+
- name: Cache pip dependencies
30+
uses: actions/cache@v4
31+
with:
32+
path: ~/.cache/pip
33+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
34+
restore-keys: |
35+
${{ runner.os }}-pip-
36+
1937
- name: Install dependencies
2038
run: |
2139
python -m pip install --upgrade pip
22-
pip install setuptools wheel twine
23-
- name: Build and publish
40+
pip install build twine
41+
42+
- name: Build package
43+
run: |
44+
python -m build
45+
46+
- name: Check package
47+
run: |
48+
twine check dist/*
49+
50+
- name: Upload to PyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1
52+
with:
53+
user: __token__
54+
password: ${{ secrets.PYPI_API_TOKEN }}
55+
56+
- name: Create GitHub Release
57+
if: github.event_name == 'release'
58+
uses: actions/create-release@v1
2459
env:
25-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
26-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
with:
62+
tag_name: ${{ github.event.release.tag_name }}
63+
release_name: ${{ github.event.release.name }}
64+
body: ${{ github.event.release.body }}
65+
draft: false
66+
prerelease: false
67+
68+
test-release:
69+
runs-on: ubuntu-latest
70+
needs: build-and-publish
71+
if: github.event_name == 'workflow_dispatch'
72+
73+
steps:
74+
- name: Checkout code
75+
uses: actions/checkout@v4
76+
77+
- name: Set up Python 3.14
78+
uses: actions/setup-python@v5
79+
with:
80+
python-version: "3.14"
81+
82+
- name: Install released package
83+
run: |
84+
python -m pip install --upgrade pip
85+
pip install django-tink-fields==${{ github.event.inputs.version }}
86+
87+
- name: Test installed package
2788
run: |
28-
python setup.py sdist bdist_wheel
29-
twine upload dist/*
89+
python -c "import tink_fields; print('Package installed successfully')"
90+
python -c "from tink_fields import EncryptedCharField; print('Fields imported successfully')"

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ classifiers = [
2222
"Programming Language :: Python :: 3.11",
2323
"Programming Language :: Python :: 3.12",
2424
"Programming Language :: Python :: 3.13",
25+
"Programming Language :: Python :: 3.14",
2526
"Programming Language :: Python :: Implementation :: CPython",
2627
"Programming Language :: Python :: Implementation :: PyPy",
2728
"Framework :: Django",

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
[tox]
22
envlist =
3-
py{310,311,312,313}
3+
py{310,311,312,313,314}
44

55
[gh-actions]
66
python =
77
3.10: py310
88
3.11: py311
99
3.12: py312
1010
3.13: py313
11+
3.14: py314
1112

1213
[testenv]
1314
deps =

0 commit comments

Comments
 (0)