-
Notifications
You must be signed in to change notification settings - Fork 3
231 lines (198 loc) · 6.86 KB
/
Copy pathtest.yml
File metadata and controls
231 lines (198 loc) · 6.86 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Serverpod Admin CI
on:
workflow_dispatch:
release:
types:
- published
push:
branches:
- main
- dev
tags:
- 'v*'
pull_request:
branches:
- main
- dev
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
contents: write
jobs:
dart_analyze_server:
name: dart analyze (server)
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
strategy:
matrix:
flutter-version: ['3.32.0', '3.38.4']
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
cache: true
- name: Install dependencies
working-directory: serverpod_admin_server
run: dart pub get
- name: Analyze server source
working-directory: serverpod_admin_server
run: dart analyze
dart_analyze_dashboard:
name: dart analyze (dashboard)
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
strategy:
matrix:
flutter-version: ['3.32.0', '3.38.4']
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
cache: true
- name: Install dependencies
working-directory: serverpod_admin_dashboard
run: flutter pub get
- name: Analyze dashboard source
working-directory: serverpod_admin_dashboard
run: |
# Run analyze and filter out expected warnings for monorepo
OUTPUT=$(flutter analyze 2>&1) || true
# Filter out expected warnings:
# 1. Path dependency warning (expected in monorepo)
# 2. DropdownButtonFormField value deprecation (initialValue not available in tested Flutter versions)
FILTERED=$(echo "$OUTPUT" | grep -v "Publishable packages can't have 'path' dependencies" | grep -v "Use initialValue instead")
echo "$FILTERED"
# Count real issues (excluding expected warnings)
REAL_ISSUES=$(echo "$FILTERED" | grep -cE "(error|warning|info) •" || echo "0")
if [ "$REAL_ISSUES" -gt "0" ]; then
echo "Found $REAL_ISSUES analysis issue(s)"
exit 1
fi
echo "Analysis passed (expected warnings ignored)"
server_integration_tests:
name: Server integration tests
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
strategy:
matrix:
flutter-version: ['3.32.0', '3.38.4']
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: serverpod_admin_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
cache: true
- name: Install dependencies
working-directory: serverpod_admin_server
run: dart pub get
- name: Update test configuration for CI
working-directory: serverpod_admin_server
run: |
# Update test.yaml to use standard ports for GitHub Actions
sed -i 's/port: 9090/port: 5432/' config/test.yaml
sed -i 's/port: 9091/port: 6379/' config/test.yaml
# Keep Redis disabled for CI since GitHub Actions Redis doesn't require password
# but Serverpod tries to authenticate when enabled
# sed -i 's/enabled: false/enabled: true/' config/test.yaml
# Update passwords.yaml with CI password (postgres for database, no redis password)
cat > config/passwords.yaml << EOF
test:
database: 'postgres'
EOF
- name: Run server tests
working-directory: serverpod_admin_server
run: dart test --reporter=failures-only
dashboard_unit_tests:
name: Dashboard unit tests
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
strategy:
matrix:
flutter-version: ['3.32.0', '3.38.4']
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
cache: true
- name: Install dependencies
working-directory: serverpod_admin_dashboard
run: flutter pub get
- name: Run dashboard tests
working-directory: serverpod_admin_dashboard
run: flutter test --reporter=failures-only
build_admin_app:
name: Build prebuilt admin app
runs-on: ubuntu-latest
strategy:
matrix:
flutter-version: ['3.38.4']
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
cache: true
- name: Install dependencies
working-directory: serverpod_admin_app
run: flutter pub get
- name: Analyze admin app
working-directory: serverpod_admin_app
run: flutter analyze
- name: Build Flutter web app
working-directory: serverpod_admin_app
run: flutter build web --base-href /admin/
- name: Package web build
working-directory: serverpod_admin_app/build/web
run: zip -r ../../../serverpod_admin_dashboard_web.zip .
- name: Upload admin app artifact
uses: actions/upload-artifact@v4
with:
name: serverpod_admin_dashboard_web
path: serverpod_admin_dashboard_web.zip
- name: Attach admin app to GitHub release
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME="${GITHUB_REF_NAME}"
if [ "${{ github.event_name }}" = "release" ]; then
TAG_NAME="${{ github.event.release.tag_name }}"
fi
gh release view "$TAG_NAME" >/dev/null 2>&1 || \
gh release create "$TAG_NAME" \
--title "$TAG_NAME" \
--notes "Serverpod Admin release $TAG_NAME"
gh release upload "$TAG_NAME" \
serverpod_admin_dashboard_web.zip \
--clobber