Skip to content

Commit 392d1ee

Browse files
committed
Add CI/CD pipeline
1 parent cbfcb76 commit 392d1ee

1 file changed

Lines changed: 60 additions & 104 deletions

File tree

.github/workflows/ci.yml

Lines changed: 60 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,70 @@
1-
name: CI Pipeline (Package)
1+
name: Flutter CI/CD
22

33
on:
44
push:
5-
branches: [main, develop]
5+
branches: [ main, master ]
66
pull_request:
7-
branches: [main, develop]
8-
9-
env:
10-
FLUTTER_VERSION: '3.32.0'
7+
branches: [ main, master ]
118

129
jobs:
13-
# ============================================================
14-
# ANALYZE - Code-Qualität prüfen
15-
# ============================================================
16-
analyze:
17-
name: 🔍 Analyze
18-
runs-on: ubuntu-latest
19-
steps:
20-
- name: 📥 Checkout
21-
uses: actions/checkout@v4
22-
23-
- name: 🎯 Setup Flutter
24-
uses: subosito/flutter-action@v2
25-
with:
26-
flutter-version: ${{ env.FLUTTER_VERSION }}
27-
cache: true
28-
29-
- name: 📦 Get dependencies
30-
run: flutter pub get
31-
32-
- name: 🔍 Analyze code
33-
run: flutter analyze --no-fatal-infos
34-
35-
- name: 📋 Check formatting
36-
run: dart format --output=none --set-exit-if-changed .
37-
38-
# ============================================================
39-
# TEST - Unit Tests ausführen
40-
# ============================================================
41-
test:
42-
name: 🧪 Test
43-
runs-on: ubuntu-latest
44-
needs: analyze
45-
steps:
46-
- name: 📥 Checkout
47-
uses: actions/checkout@v4
48-
49-
- name: 🎯 Setup Flutter
50-
uses: subosito/flutter-action@v2
51-
with:
52-
flutter-version: ${{ env.FLUTTER_VERSION }}
53-
cache: true
54-
55-
- name: 📦 Get dependencies
56-
run: flutter pub get
57-
58-
- name: 🧪 Run tests
59-
run: flutter test --coverage
60-
61-
- name: 📊 Upload coverage
62-
uses: codecov/codecov-action@v3
63-
with:
64-
files: coverage/lcov.info
65-
fail_ci_if_error: false
66-
67-
# ============================================================
68-
# DRY RUN - Prüfen ob Package publishable ist
69-
# ============================================================
70-
publish-dry-run:
71-
name: 📦 Publish Dry Run
10+
build:
7211
runs-on: ubuntu-latest
73-
needs: [analyze, test]
12+
7413
steps:
75-
- name: 📥 Checkout
76-
uses: actions/checkout@v4
77-
78-
- name: 🎯 Setup Flutter
79-
uses: subosito/flutter-action@v2
80-
with:
81-
flutter-version: ${{ env.FLUTTER_VERSION }}
82-
cache: true
83-
84-
- name: 📦 Get dependencies
85-
run: flutter pub get
86-
87-
- name: 🔍 Publish dry run
88-
run: dart pub publish --dry-run
89-
90-
# ============================================================
91-
# COMPATIBILITY - Testen ob Apps das Package nutzen können
92-
# ============================================================
93-
compatibility:
94-
name: 🔗 Compatibility Check
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Flutter
17+
uses: subosito/flutter-action@v2
18+
with:
19+
flutter-version: "3.24.0"
20+
channel: stable
21+
cache: true
22+
23+
- name: Get dependencies
24+
run: flutter pub get
25+
26+
- name: Analyze code
27+
run: flutter analyze --no-fatal-infos
28+
continue-on-error: true
29+
30+
- name: Run tests
31+
run: flutter test
32+
continue-on-error: true
33+
34+
- name: Build APK
35+
run: flutter build apk --release
36+
37+
- name: Upload APK
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: release-apk
41+
path: build/app/outputs/flutter-apk/app-release.apk
42+
43+
deploy:
44+
needs: build
9545
runs-on: ubuntu-latest
96-
needs: [analyze, test]
97-
strategy:
98-
matrix:
99-
flutter-version: ['3.32.0', '3.29.0']
46+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
47+
10048
steps:
101-
- name: 📥 Checkout
102-
uses: actions/checkout@v4
103-
104-
- name: 🎯 Setup Flutter ${{ matrix.flutter-version }}
105-
uses: subosito/flutter-action@v2
106-
with:
107-
flutter-version: ${{ matrix.flutter-version }}
108-
cache: true
109-
110-
- name: 📦 Get dependencies
111-
run: flutter pub get
112-
113-
- name: 🔍 Analyze
114-
run: flutter analyze --no-fatal-infos
49+
- uses: actions/checkout@v4
50+
51+
- name: Setup Flutter
52+
uses: subosito/flutter-action@v2
53+
with:
54+
flutter-version: "3.24.0"
55+
channel: stable
56+
cache: true
57+
58+
- name: Get dependencies
59+
run: flutter pub get
60+
61+
- name: Build APK
62+
run: flutter build apk --release
63+
64+
- name: Upload to Firebase App Distribution
65+
uses: wzieba/Firebase-Distribution-Github-Action@v1
66+
with:
67+
appId: ${{ secrets.FIREBASE_APP_ID }}
68+
serviceCredentialsFileContent: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
69+
groups: testers
70+
file: build/app/outputs/flutter-apk/app-release.apk

0 commit comments

Comments
 (0)