-
Notifications
You must be signed in to change notification settings - Fork 4.1k
144 lines (141 loc) · 5.76 KB
/
macos.yaml
File metadata and controls
144 lines (141 loc) · 5.76 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
name: e2e-macOS
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'website/**'
- '**/example/**'
- '!**/example/integration_test/**'
- '**/flutterfire_ui/**'
- '**.md'
push:
branches:
- main
paths-ignore:
- 'docs/**'
- 'website/**'
- '**/example/**'
- '!**/example/integration_test/**'
- '**/flutterfire_ui/**'
- '**.md'
jobs:
macos:
runs-on: macos-15
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
working_directory:
['tests', 'packages/cloud_firestore/cloud_firestore/example']
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
name: Install Node.js 20
with:
node-version: '20'
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'temurin'
java-version: '21'
- uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639
name: Xcode Compile Cache
with:
key: xcode-cache-${{ runner.os }}
save: "${{ github.ref == 'refs/heads/main' }}"
max-size: 700M
- name: Pods Cache
continue-on-error: true
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
id: pods-cache
with:
# Must match the save path exactly
path: tests/macos/Pods
key: pods-v3-${{ runner.os }}-macos-${{ hashFiles('tests/pubspec.lock') }}
restore-keys: pods-v3-${{ runner.os }}-macos
- name: 'Install Tools'
run: |
sudo npm i -g firebase-tools
echo "FIREBASE_TOOLS_VERSION=$(npm firebase --version)" >> $GITHUB_ENV
- name: Firebase Emulator Cache
id: firebase-emulator-cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
continue-on-error: true
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
# Must match the save path exactly
path: ~/.cache/firebase/emulators
key: firebase-emulators-v3-${{ env.FIREBASE_TOOLS_VERSION }}
restore-keys: firebase-emulators-v3
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
with:
channel: 'stable'
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
- uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa
with:
run-bootstrap: false
melos-version: '5.3.0'
- name: 'Bootstrap package'
run: melos bootstrap --scope tests && melos bootstrap --scope "cloud_firestore*"
- name: 'Build Application'
working-directory: ${{ matrix.working_directory }}
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros
export CCACHE_FILECLONE=true
export CCACHE_DEPEND=true
export CCACHE_INODECACHE=true
ccache -s
flutter build macos --debug --target=./integration_test/e2e_test.dart --device-id=macos --dart-define=CI=true
ccache -s
- name: Start Firebase Emulator
# Chown the npm cache directory to the runner user to avoid permission issues
run: sudo chown -R 501:20 "/Users/runner/.npm" && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
- name: 'E2E Tests'
working-directory: ${{ matrix.working_directory }}
run: |
# flutter test on macOS CI may exit 1 due to "Failed to foreground app"
# even when all tests pass. Check actual test results to determine success.
set +e
OUTPUT=$(flutter test \
integration_test/e2e_test.dart \
-d macos \
--dart-define=CI=true \
--timeout 10x 2>&1)
EXIT_CODE=$?
echo "$OUTPUT"
if [ $EXIT_CODE -ne 0 ]; then
if echo "$OUTPUT" | grep -q "Some tests failed" || echo "$OUTPUT" | grep -q "test failed"; then
exit 1
fi
if echo "$OUTPUT" | grep -q "tests passed"; then
echo "All tests passed but flutter test exited with $EXIT_CODE (likely 'Failed to foreground app'). Treating as success."
exit 0
fi
exit $EXIT_CODE
fi
- name: Save Firestore Emulator Cache
continue-on-error: true
# Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
# The firebase emulators are pure javascript and java, OS-independent
enableCrossOsArchive: true
key: ${{ steps.firebase-emulator-cache.outputs.cache-primary-key }}
# Must match the restore path exactly
path: ~/.cache/firebase/emulators
- name: Save Pods Cache
continue-on-error: true
# Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache.
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
key: ${{ steps.pods-cache.outputs.cache-primary-key }}
# Must match the restore paths exactly
path: tests/macos/Pods