-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (135 loc) · 4.61 KB
/
CI.yml
File metadata and controls
145 lines (135 loc) · 4.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: CI
on: [push]
permissions:
contents: write
pull-requests: write
jobs:
build-frontend:
name: Build Frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v7
with:
name: workspace
path: .
test-frontend:
name: Test Frontend
needs: build-frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: workspace
path: .
- uses: actions/setup-node@v6
with:
node-version: 24
- run: npm ci
- run: npm run test
test-backend:
name: Test Backend
needs: build-frontend
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', 'pypy-3.10', 'pypy-3.11']
postgres-version: ['14', '15', '16', '17', '18']
services:
database:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
selenium:
image: selenium/standalone-chrome:latest
ports:
- 4444:4444
options: >-
--health-cmd="curl -s http://localhost:4444/wd/hub/status | grep \"\"ready\"\""
--health-interval=10s
--health-timeout=5s
--health-retries=5
env:
DJANGO_DATABASE_HOST: localhost
DJANGO_DATABASE_USER: postgres
DJANGO_DATABASE_PASSWORD: postgres
DJANGO_DATABASE_NAME: postgres
SELENIUM_REMOTE_URL: http://localhost:4444/wd/hub
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: workspace
path: .
- name: Set up Python (uv)
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
cache-dependency-glob: 'uv.lock'
- name: Create virtual environment and install dependencies
run: |
uv sync --group test --group build
- name: Run backend tests
run: uv run pytest -v -x -rs
merge:
name: Auto-merge Dependabot
runs-on: ubuntu-latest
needs: [test-frontend, test-backend]
if: github.actor == 'dependabot[bot]'
steps:
- uses: actions/checkout@v6
- name: Enable auto-merge
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Publish Release
if: startsWith(github.ref, 'refs/tags/')
needs: [test-frontend, test-backend]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/django-hstore-widget
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
- name: Install Hatch
run: pip install hatch
- uses: actions/download-artifact@v8
with:
name: workspace
path: .
- name: Build package
run: |
hatch build
- name: Upload release assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: py-dist/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: py-dist/