-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (117 loc) · 4.34 KB
/
flutter-ci.yml
File metadata and controls
143 lines (117 loc) · 4.34 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
name: Flutter CI
on:
push:
branches: [master]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
defaults:
run:
working-directory: flutter
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Install dependencies
run: flutter pub get
- name: Analyze
run: flutter analyze
- name: Test with coverage
run: flutter test --coverage
- name: Upload coverage artifact
uses: actions/upload-artifact@v5
with:
name: flutter-coverage
path: flutter/coverage/lcov.info
build-beta:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
defaults:
run:
working-directory: flutter
permissions:
contents: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Install dependencies
run: flutter pub get
- name: Analyze
run: flutter analyze
- name: Test
id: tests
continue-on-error: true
run: flutter test
- name: Update golden files if tests failed
if: steps.tests.outcome == 'failure'
run: flutter test test/golden/golden_test.dart --update-goldens
- name: Commit updated golden files
if: steps.tests.outcome == 'failure'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add test/golden/goldens/
if git diff --cached --quiet; then
echo "No golden changes to commit"
else
git commit -m "ci: auto-update golden files"
git push
fi
- name: Generate version tag
id: version
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
TIMESTAMP=$(date +%Y%m%d-%H%M)
COMMIT_MSG=$(git log -1 --pretty=%s | head -c 80 | tr '\n' ' ')
echo "tag=beta-${TIMESTAMP}-${SHORT_SHA}" >> $GITHUB_OUTPUT
echo "name=Beta ${TIMESTAMP} (${SHORT_SHA})" >> $GITHUB_OUTPUT
echo "commit_msg=${COMMIT_MSG}" >> $GITHUB_OUTPUT
- name: Decode Keystore
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/upload-keystore.jks
- name: Create key.properties
run: |
echo "storePassword=${{ secrets.STORE_PASSWORD }}" > android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
echo "storeFile=upload-keystore.jks" >> android/key.properties
- name: Build release APK
run: flutter build apk --release --dart-define=STRAVA_CLIENT_ID=193995
- name: Build release AAB
run: flutter build appbundle --release --dart-define=STRAVA_CLIENT_ID=193995
- name: Rename APK
run: |
TAG="${{ steps.version.outputs.tag }}"
mv build/app/outputs/flutter-apk/app-release.apk \
build/app/outputs/flutter-apk/RunFlow-${TAG}.apk
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.name }}
body: |
## RunFlow Beta Build
**Commit:** `${{ github.sha }}`
**Message:** ${{ steps.version.outputs.commit_msg }}
**Branch:** `${{ github.ref_name }}`
**Built:** ${{ github.event.head_commit.timestamp }}
### Installation
Download the APK below and install on your Android device. You may need to enable "Install from unknown sources" in your device settings.
> **Note:** This is a beta release. Expect potential instability.
prerelease: true
files: |
flutter/build/app/outputs/flutter-apk/RunFlow-${{ steps.version.outputs.tag }}.apk
flutter/build/app/outputs/bundle/release/app-release.aab