2121 steps :
2222 - name : Checkout code
2323 uses : actions/checkout@v4
24- with :
25- # ensures there are no unexpected directories needed
26- sparse-checkout : |
27- app
28- health_data_store
2924 - name : Cache generated health data store
3025 id : cache-generated
3126 uses : actions/cache@v4
@@ -52,26 +47,33 @@ jobs:
5247 - name : Update app dependencies
5348 run : flutter pub get
5449 working-directory : app
55- # Golden tests don't need mocks if they ever do this would be a good oportunity to
56- # introduce test mock testign
50+ # TODO: cache using non-generated dart files in the test dir as key
51+ - name : Generate app mock code
52+ run : flutter pub run build_runner build
53+ working-directory : app
5754 - name : Update goldens
5855 id : gold-upd
5956 run : flutter test --update-goldens --fail-fast --name="\[gold\].*" --dart-define="channel=${{ matrix.channel }}"
6057 working-directory : app
61- - name : PR golden changes
58+ - name : Push golden changes
6259 # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#example-of-failure-with-conditions
6360 if : ${{ steps.gold-upd.conclusion == 'success' }}
6461 run : |
65- git config user.name "GitHub Action (update goldens)"
66- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
67- git add app/test/**/*.png
68- git commit -m "Update goldens"
69- git push
62+ if [[ $(git status -s | grep png) ]]; then
63+ git config user.name "GitHub Action (update goldens)"
64+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
65+ git add app/test/
66+ git commit -m "Update goldens"
67+ git push
68+ else
69+ echo "no changes to commit"
70+ fi
7071 env :
7172 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}%
7273 test :
7374 if : contains(github.event.pull_request.labels.*.name, 'auto-test')
7475 runs-on : ubuntu-latest
76+ needs : update-goldens # this is guaranteed to fail if goldens need to be updated
7577 steps :
7678 - name : Checkout code
7779 uses : actions/checkout@v4
@@ -106,7 +108,8 @@ jobs:
106108 - name : Update app dependencies
107109 run : flutter pub get
108110 working-directory : app
109- - name : Generate app mock code # no efficient caching possible
111+ # TODO: cache using non-generated dart files in the test dir as key
112+ - name : Generate app mock code
110113 run : flutter pub run build_runner build
111114 working-directory : app
112115 - name : Run tests
@@ -149,15 +152,15 @@ jobs:
149152 channel : ${{ matrix.channel }}
150153 cache : true
151154 - name : Disable analytics
152- run :
153- flutter config --no-analytics --suppress-analytics
155+ run : flutter config --no-analytics --suppress-analytics
154156 - name : Update app dependencies
155157 run : flutter pub get
156158 working-directory : app
159+ - name : Build
160+ run : flutter build apk --debug --flavor=github
157161 - name : Upload artifacts
158162 uses : actions/upload-artifact@v4
159163 with :
160164 name : build-results
161165 path : app/build/app/outputs/flutter-apk
162- - name : Build
163- run : flutter build apk --debug --flavor=github
166+
0 commit comments