Skip to content

Commit 6abdcc3

Browse files
Merge pull request #195 from richardthe3rd/claude/review-github-actions-EML2l
Review and optimize GitHub Actions workflows
2 parents 6af47b6 + 29063a7 commit 6abdcc3

24 files changed

Lines changed: 4797 additions & 147 deletions
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Setup Flutter App'
2+
description: 'Set up Flutter with dependencies, caching, and optional code generation'
3+
inputs:
4+
google-services-json:
5+
description: 'Firebase google-services.json content'
6+
required: true
7+
generate-mocks:
8+
description: 'Whether to run build_runner for mock generation'
9+
required: false
10+
default: 'false'
11+
flutter-version:
12+
description: 'Flutter version to use'
13+
required: false
14+
default: '3.38.3'
15+
16+
runs:
17+
using: 'composite'
18+
steps:
19+
- name: Setup Flutter
20+
uses: subosito/flutter-action@v2
21+
with:
22+
flutter-version: ${{ inputs.flutter-version }}
23+
channel: 'stable'
24+
cache: true
25+
26+
- name: Cache Flutter pub dependencies
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.pub-cache
30+
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-pub-
33+
34+
- name: Create Firebase google-services.json
35+
shell: bash
36+
run: echo '${{ inputs.google-services-json }}' > android/app/google-services.json
37+
38+
- name: Get dependencies
39+
shell: bash
40+
run: flutter pub get
41+
42+
- name: Generate mocks
43+
if: inputs.generate-mocks == 'true'
44+
shell: bash
45+
run: dart run build_runner build --delete-conflicting-outputs

.github/copilot-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,12 +456,12 @@ The app has three deployment environments:
456456
2. **Staging** (`staging.cambeerfestival.app`)
457457
- Deployed automatically on push to `main`
458458
- Cloudflare Pages, branch `main`
459-
- Workflow: `.github/workflows/build-deploy.yml`
459+
- Workflow: `.github/workflows/ci.yml`
460460

461461
3. **PR Previews**
462462
- Unique URL per pull request
463463
- Preview URL posted as comment on PR
464-
- Workflow: `.github/workflows/build-deploy.yml`
464+
- Workflow: `.github/workflows/ci.yml`
465465

466466
### Deployment Workflow
467467

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Flutter App CI/CD
1+
name: CI
22

33
on:
44
push:
@@ -55,21 +55,11 @@ jobs:
5555
- name: Checkout
5656
uses: actions/checkout@v4
5757

58-
- name: Setup Flutter
59-
uses: subosito/flutter-action@v2
58+
- name: Setup Flutter App
59+
uses: ./.github/actions/setup-flutter-app
6060
with:
61-
flutter-version: '3.38.3'
62-
channel: 'stable'
63-
cache: true
64-
65-
- name: Create Firebase google-services.json
66-
run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > android/app/google-services.json
67-
68-
- name: Get dependencies
69-
run: flutter pub get
70-
71-
- name: Generate mocks
72-
run: dart run build_runner build --delete-conflicting-outputs
61+
google-services-json: ${{ secrets.GOOGLE_SERVICES_JSON }}
62+
generate-mocks: 'true'
7363

7464
- name: Analyze code
7565
run: flutter analyze --no-fatal-infos
@@ -106,24 +96,14 @@ jobs:
10696
- name: Checkout
10797
uses: actions/checkout@v4
10898

109-
- name: Setup Flutter
110-
uses: subosito/flutter-action@v2
99+
- name: Setup Flutter App
100+
uses: ./.github/actions/setup-flutter-app
111101
with:
112-
flutter-version: '3.38.3'
113-
channel: 'stable'
114-
cache: true
115-
116-
- name: Create Firebase google-services.json
117-
run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > android/app/google-services.json
118-
119-
- name: Get dependencies
120-
run: flutter pub get
102+
google-services-json: ${{ secrets.GOOGLE_SERVICES_JSON }}
121103

122104
- name: Get git version info
123105
id: git_version
124-
run: |
125-
chmod +x scripts/get_version_info.sh
126-
scripts/get_version_info.sh github >> $GITHUB_OUTPUT
106+
run: scripts/get_version_info.sh github >> $GITHUB_OUTPUT
127107

128108
- name: Build web
129109
run: |
@@ -151,7 +131,8 @@ jobs:
151131
- name: Setup Node.js
152132
uses: actions/setup-node@v4
153133
with:
154-
node-version: '21'
134+
node-version: '20'
135+
cache: 'npm'
155136

156137
- name: Download web build artifact
157138
uses: actions/download-artifact@v4
@@ -160,7 +141,7 @@ jobs:
160141
path: build/web
161142

162143
- name: Install npm dependencies
163-
run: npm install
144+
run: npm ci
164145

165146
- name: Install Playwright browsers
166147
run: npx playwright install --with-deps chromium
@@ -221,24 +202,14 @@ jobs:
221202
restore-keys: |
222203
${{ runner.os }}-gradle-
223204
224-
- name: Setup Flutter
225-
uses: subosito/flutter-action@v2
205+
- name: Setup Flutter App
206+
uses: ./.github/actions/setup-flutter-app
226207
with:
227-
flutter-version: '3.38.3'
228-
channel: 'stable'
229-
cache: true
230-
231-
- name: Create Firebase google-services.json
232-
run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > android/app/google-services.json
233-
234-
- name: Get dependencies
235-
run: flutter pub get
208+
google-services-json: ${{ secrets.GOOGLE_SERVICES_JSON }}
236209

237210
- name: Get git version info
238211
id: git_version
239-
run: |
240-
chmod +x scripts/get_version_info.sh
241-
scripts/get_version_info.sh github >> $GITHUB_OUTPUT
212+
run: scripts/get_version_info.sh github >> $GITHUB_OUTPUT
242213

243214
- name: Build debug APK
244215
run: |
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Cloudflare Worker
1+
name: Deploy Worker
22

33
on:
44
push:
@@ -83,6 +83,8 @@ jobs:
8383
uses: actions/setup-node@v4
8484
with:
8585
node-version: '20'
86+
cache: 'npm'
87+
cache-dependency-path: cloudflare-worker/package-lock.json
8688

8789
- name: Install worker dependencies
8890
working-directory: cloudflare-worker
@@ -116,6 +118,8 @@ jobs:
116118
uses: actions/setup-node@v4
117119
with:
118120
node-version: '20'
121+
cache: 'npm'
122+
cache-dependency-path: '**/package-lock.json'
119123

120124
- name: Validate festivals.json
121125
if: |

0 commit comments

Comments
 (0)