-
Notifications
You must be signed in to change notification settings - Fork 114
375 lines (345 loc) · 15.3 KB
/
desktop.yml
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
name: Desktop Builds
on:
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
inputs:
expanded_matrix:
description: 'Use an expanded matrix?'
default: '0'
required: true
env:
CCACHE_DIR: ${{ github.workspace }}/ccache_dir
GITHUB_TOKEN: ${{ github.token }}
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
prepare_matrix:
runs-on: ubuntu-20.04
outputs:
matrix_os: ${{ steps.export-result.outputs.matrix_os }}
matrix_build_type: ${{ steps.export-result.outputs.matrix_build_type }}
matrix_architecture: ${{ steps.export-result.outputs.matrix_architecture }}
matrix_msvc_runtime: ${{ steps.export-result.outputs.msvc_runtime }}
matrix_xcode_version: ${{ steps.export-result.outputs.xcode_version }}
matrix_python_version: ${{ steps.export-result.outputs.python_version }}
steps:
- uses: actions/checkout@v3
with:
submodules: false
- name: Use expanded matrix
if: github.event.inputs.expanded_matrix == '1'
run: |
echo "EXPANDED_MATRIX_PARAM=-e=1" >> $GITHUB_ENV
- id: export-result
run: |
echo "matrix_os=$( python scripts/gha/print_matrix_configuration.py -w desktop -k os ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
echo "matrix_build_type=$( python scripts/gha/print_matrix_configuration.py -w desktop -k build_type ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
echo "matrix_architecture=$( python scripts/gha/print_matrix_configuration.py -w desktop -k architecture ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
echo "msvc_runtime=$( python scripts/gha/print_matrix_configuration.py -w desktop -k msvc_runtime ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
echo "xcode_version=$( python scripts/gha/print_matrix_configuration.py -w desktop -k xcode_version ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
echo "python_version=$( python scripts/gha/print_matrix_configuration.py -w desktop -k python_version ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
build:
name: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.msvc_runtime}}
runs-on: ${{ matrix.os }}
needs: prepare_matrix
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.prepare_matrix.outputs.matrix_os) }}
build_type: ${{ fromJson(needs.prepare_matrix.outputs.matrix_build_type) }}
architecture: ${{ fromJson(needs.prepare_matrix.outputs.matrix_architecture) }}
msvc_runtime: ${{ fromJson(needs.prepare_matrix.outputs.matrix_msvc_runtime) }}
xcode_version: ${{ fromJson(needs.prepare_matrix.outputs.matrix_xcode_version) }}
python_version: ${{ fromJson(needs.prepare_matrix.outputs.matrix_python_version) }}
include:
# More Windows combinations are in the expanded matrix.
- os: windows-latest
build_type: "Release"
architecture: "x64"
msvc_runtime: "static"
- os: windows-latest
build_type: "Debug"
architecture: "x86"
msvc_runtime: "dynamic"
exclude:
# msvc_runtime excludes
- os: ubuntu-20.04
msvc_runtime: "dynamic"
- os: macos-13
msvc_runtime: "dynamic"
# architecture excluees
- os: macos-13
architecture: "x86"
# Xcode excludes -- allow only one on osx and linux
- os: ubuntu-20.04
xcode_version: "11.7"
- os: windows-latest
xcode_version: "11.7"
- os: ubuntu-20.04
xcode_version: "12.5.1"
- os: windows-latest
xcode_version: "12.5.1"
# arm64 is only for macos
- os: ubuntu-20.04
architecture: "arm64"
- os: windows-latest
architecture: "arm64"
# arm64 can't be built on Xcode 11
- xcode_version: "11.7"
architecture: "arm64"
steps:
- name: Store git credentials for all git commands
# Forces all git commands to use authenticated https, to prevent throttling.
shell: bash
run: |
git config --global credential.helper 'store --file /tmp/git-credentials'
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
- name: Enable Git Long-paths Support
if: runner.os == 'Windows'
run: git config --system core.longpaths true
- name: Setup Xcode version (macos)
if: runner.os == 'macOS'
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer
- uses: actions/checkout@v3
with:
submodules: true
- name: Set env vars (ubuntu)
if: startsWith(matrix.os, 'ubuntu')
shell: bash
run: echo "VCPKG_SUFFIX=linux" >> $GITHUB_ENV
- name: Set env vars (macos)
if: startsWith(matrix.os, 'macos')
shell: bash
run: echo "VCPKG_SUFFIX=osx" >> $GITHUB_ENV
- name: Set env vars (windows)
if: startsWith(matrix.os, 'windows')
shell: bash
run: |
if [[ ${{matrix.msvc_runtime}} == "static" ]];
then echo "VCPKG_SUFFIX=windows-static" >> $GITHUB_ENV;
elif [[ ${{matrix.msvc_runtime}} == "dynamic" ]];
then echo "VCPKG_SUFFIX=windows-static-md" >> $GITHUB_ENV;
else
echo "Warning, could not resolve vcpkg suffix.";
fi
- name: Set env variables for subsequent steps (all)
shell: bash
run: |
echo "BUILD_TYPE: ${{ matrix.build_type }}"
echo "VCPKG_SUFFIX: ${{env.VCPKG_SUFFIX}}"
echo "VCPKG_RESPONSE_FILE=external/vcpkg_custom_data/response_files/${{ matrix.architecture }}-${{ env.VCPKG_SUFFIX }}.txt" >> $GITHUB_ENV
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.msvc_runtime }}" >> $GITHUB_ENV
if [[ '${{ matrix.sdk_platform }}' == 'darwin' ]]; then
# If Mac, also hash vcpkg cache on Xcode version.
echo "VCPKG_EXTRA_HASH=-xcode${{matrix.xcode_version}}" >> $GITHUB_ENV
fi
- name: Cache vcpkg C++ dependencies
id: cache_vcpkg
uses: actions/cache@v3
with:
path: external/vcpkg/installed
key: dev-vcpkg-${{ matrix.architecture }}-${{ env.VCPKG_SUFFIX }}-${{ matrix.msvc_runtime }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}${{ env.VCPKG_EXTRA_HASH }}
- name: Cache ccache files
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
id: cache_ccache
uses: actions/cache@v3
with:
path: ccache_dir
key: dev-test-ccache-${{ env.MATRIX_UNIQUE_NAME }}${{ env.VCPKG_EXTRA_HASH }}
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
architecture: 'x64'
- name: Install Desktop SDK prerequisites
uses: nick-invision/retry@v2
with:
timeout_minutes: 15
max_attempts: 3
command: |
python scripts/gha/install_prereqs_desktop.py --gha_build --arch '${{ matrix.architecture }}'
- name: Build SDK
shell: bash
run: |
python scripts/gha/build_desktop.py --build_tests --arch "${{ matrix.architecture }}" --config "${{ matrix.build_type }}" --msvc_runtime_library "${{ matrix.msvc_runtime }}" --gha_build
- name: Stats for ccache (mac and linux)
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
run: ccache -s
- name: Print built libraries
shell: bash
run: |
find build -name "*.lib"
find build -name "*.dll"
find build -name "*.dylib"
find build -name "*.a"
find build -name "*.so"
- name: Inspect firebase libraries for cpu arch and msvc runtime.
shell: bash
run: |
python scripts/gha/inspect_built_libraries.py build/
continue-on-error: true
- name: Prep crash support (linux)
# Ensures directory structure is in place to capture core files on Linux.
if: startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
echo '/tmp/cores/core.%E' | sudo tee /proc/sys/kernel/core_pattern
sudo mkdir -p /tmp/cores/
sudo rm -rf /tmp/cores/*
- name: Prep crash support (mac)
# Ensures no lingering crashes from the previous run.
if: startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos')
run: |
rm -rf ~/Library/Logs/DiagnosticReports/*
- name: Run unit tests (windows & macos)
# TODO: Enable tests for x86 once they are all working
if: (startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos')) && matrix.architecture != 'x86' && matrix.architecture != 'arm64'
env:
LANG: en_US
run: |
cd build
ctest --repeat until-pass:3 --output-on-failure
- name: Run unit tests (linux)
# Linux exists as its own standalone execution step in order to invoke
# platform-specific `ulimit` to enable crash collection. The ulimit
# command must be invoked in same shell instance of that runs the
# tests.
if: startsWith(matrix.os, 'ubuntu')
env:
LANG: en_US
run: |
ulimit -c unlimited
cd build
sudo ctest --repeat until-pass:3 --output-on-failure
- name: Prep bins for achive (linux)
# Copies all of the binary files into one directory for ease in
# archiving. Directory contents are then marked readable for the
# archive step.
if: failure() && startsWith(matrix.build_type, 'Debug') && ( startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') )
shell: bash
run: |
sudo rm -rf /tmp/bins/* || :
sudo mkdir -p /tmp/bins/
sudo rm -rf ./build/app/tests/firebase_test
sudo cp -f ./build/*/tests/firebase* /tmp/bins
sudo chmod -R +rwx /tmp/bins/* || :
- name: Prep crash data for archive (linux)
# Marks the contents of the core dump directory to be readable for the
# archiving step on linux.
shell: bash
if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'ubuntu')
run: |
sudo chmod -R +rwx /tmp/cores/* || :
- name: Prep crash data for archive (macos)
# Freshly made diagnostic reports are marked as readable for
# the archive step. Note: for some reason /tmp/cores doesn't survive
# long enough for archiving on mac, so prep the DiagnosticReports
# directory instead.
shell: bash
if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos')
run: |
sudo chmod -R +rwx ~/Library/Logs/DiagnosticReports/* || :
- name: Archive crashes and binaries (linux)
uses: actions/upload-artifact@v2
if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'ubuntu')
with:
name: crashes-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}
path: |
/tmp/cores/*
/tmp/bins/*
- name: Archive crashes (mac)
uses: actions/upload-artifact@v2
if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos')
with:
name: crashes-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}-${{ matrix.xcode_version }}
path: |
~/Library/Logs/DiagnosticReports/*
/tmp/bins/*
local_integration_tests:
### This job run firestore integration test on Linux Dekstop as required by firestore team.
### It's possible to add more apps here once integration tests are less flaky.
name: local-integration-tests-linux-openssl
needs: prepare_matrix
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
ref: ${{needs.check_and_prepare.outputs.github_ref}}
submodules: true
- name: Cache vcpkg C++ dependencies
id: cache_vcpkg
uses: actions/cache@v3
with:
path: external/vcpkg/installed
key: dev-vcpkg-${{ env.VCPKG_TRIPLET }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}
- name: Cache ccache files
uses: actions/cache@v3
with:
path: ccache_dir
key: local-integration-tests-linux-openssl-ccache
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ fromJson(needs.prepare_matrix.outputs.matrix_python_version)[0] }}
- name: Prepare for integration tests
uses: nick-invision/retry@v2
with:
shell: bash
timeout_minutes: 15
max_attempts: 3
command: scripts/gha/install_test_workflow_prereqs.sh -p Desktop -a 'x64' -s 'openssl'
- name: Build integration tests
shell: bash
env:
CCACHE_DIR: ${{ github.workspace }}/ccache_dir
run: |
apis=$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k apis -m=1 )
python scripts/gha/build_testapps.py --p Desktop \
--t ${apis} \
--output_directory "${{ github.workspace }}" \
--artifact_name "desktop-ubuntu-20.04-openssl" \
--noadd_timestamp \
--short_output_paths \
--cmake_flag=-DFIREBASE_QUICK_TEST=ON
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-desktop-ubuntu-20.04-openssl.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
- name: Set up Node (18)
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Setup Firestore Emulator
uses: nick-invision/retry@v2
with:
shell: bash
timeout_minutes: 5
max_attempts: 3
command: npm install -g firebase-tools
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Run Desktop integration tests
run: |
cp scripts/gha/integration_testing/google-services.json testapps-desktop-ubuntu-20.04-openssl/firestore/google-services.json
firebase emulators:exec --only firestore --project demo-example 'python scripts/gha/desktop_tester.py --testapp_dir testapps-desktop-ubuntu-20.04-openssl --logfile_name "desktop-ubuntu-20.04-openssl"'
env:
USE_FIRESTORE_EMULATOR: true
- name: Summarize test results
if: ${{ !cancelled() }}
shell: bash
run: |
cat testapps-desktop-ubuntu-20.04-openssl/test-results-desktop-ubuntu-20.04-openssl.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi