Skip to content

Commit 8bbaf8b

Browse files
authored
Merge pull request #743 from firebase/feature/admob_2021_merge_from_main
Merge updates from main branch into admob_2021 feature branch
2 parents d852f3c + 2e4d2c8 commit 8bbaf8b

File tree

159 files changed

+4032
-1054
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+4032
-1054
lines changed

.github/workflows/android.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212

1313
env:
1414
CCACHE_DIR: ${{ github.workspace }}/ccache_dir
15+
GITHUB_TOKEN: ${{ github.token }}
1516

1617
jobs:
1718
prepare_matrix:
@@ -45,6 +46,13 @@ jobs:
4546
architecture: ${{ fromJson(needs.prepare_matrix.outputs.matrix_architecture) }}
4647
python_version: ${{ fromJson(needs.prepare_matrix.outputs.matrix_python_version) }}
4748
steps:
49+
- name: Store git credentials for all git commands
50+
# Forces all git commands to use authenticated https, to prevent throttling.
51+
shell: bash
52+
run: |
53+
git config --global credential.helper 'store --file /tmp/git-credentials'
54+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
55+
4856
- name: Check expanded matrix config
4957
if: github.event.inputs.expanded_matrix == '1'
5058
run: |

.github/workflows/cpp-packaging.yml

Lines changed: 82 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ env:
3232
demumbleVer: "1.1.0"
3333
# Use SHA256 for hashing files.
3434
hashCommand: "sha256sum"
35-
# Xcode version 12 is the version we build the SDK with.
35+
# Xcode version 12.2 is the version we build the SDK with.
3636
# Our MacOS runners will use the version in /Applications/Xcode_${xcodeVersion}.app
37-
xcodeVersion: "12"
37+
xcodeVersion: "12.2"
38+
# LLVM version with ARM MachO support has no version number yet.
39+
llvmVer: "5f187f0afaad33013ba03454c4749d99b1362534"
40+
GITHUB_TOKEN: ${{ github.token }}
3841

3942
jobs:
4043
log_inputs:
@@ -91,7 +94,7 @@ jobs:
9194
if: runner.os == 'macOS'
9295
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
9396

94-
- name: fetch and build binutils
97+
- name: Fetch and build binutils
9598
run: |
9699
set +e
97100
# Retry up to 10 times because Curl has a tendency to timeout on
@@ -105,13 +108,46 @@ jobs:
105108
106109
tar -xf binutils.tar.xz
107110
mv ./binutils-${{ matrix.binutils_version }} ./binutils-src
111+
mkdir /tmp/binutils-output
108112
cd binutils-src
109-
./configure --enable-targets=all --prefix=/tmp/binutils
110-
make
113+
./configure --enable-targets=all --prefix=/tmp/binutils-output
114+
make -j2
111115
make install
112116
cd -
113117
mkdir -p packaging-tools
114-
cp -af /tmp/binutils/bin/* packaging-tools
118+
cp -af /tmp/binutils-output/bin/* packaging-tools
119+
120+
- name: Cache LLVM (Mac only)
121+
if: matrix.tools_platform == 'darwin'
122+
id: cache_llvm
123+
uses: actions/cache@v2
124+
with:
125+
path: llvm-src/llvm/build/bin
126+
key: llvm-bin-${{matrix.tools_platform}}-${{env.xcodeVersion}}-${{env.llvmVer}}
127+
128+
- name: Fetch LLVM source (Mac only)
129+
# Only fetch LLVM if we don't already have binaries from the cache.
130+
if: ${{ matrix.tools_platform == 'darwin' && !steps.cache_llvm.outputs.cache-hit }}
131+
uses: actions/[email protected]
132+
with:
133+
repository: llvm/llvm-project
134+
path: llvm-src
135+
ref: ${{ env.llvmVer }}
136+
137+
- name: Build LLVM (Mac only)
138+
# Only build LLVM if we don't already have binaries from the cache.
139+
if: ${{ matrix.tools_platform == 'darwin' && !steps.cache_llvm.outputs.cache-hit }}
140+
run: |
141+
mkdir llvm-src/llvm/build
142+
cd llvm-src/llvm/build
143+
cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release ..
144+
cmake --build . -j 3 --target llvm-objcopy --target llvm-nm --target llvm-ar
145+
146+
- name: Package LLVM output (Mac only)
147+
if: matrix.tools_platform == 'darwin'
148+
run: |
149+
mkdir -p packaging-tools
150+
cp -af llvm-src/llvm/build/bin/* packaging-tools
115151
116152
- name: fetch demumble
117153
uses: actions/[email protected]
@@ -127,7 +163,7 @@ jobs:
127163
cmake --build .
128164
python demumble_test.py
129165
cd -
130-
mkdir -p packaging-tools-
166+
mkdir -p packaging-tools
131167
cp -af demumble-src/demumble packaging-tools
132168
133169
- name: archive tools
@@ -147,6 +183,13 @@ jobs:
147183
runs-on: macos-latest
148184
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
149185
steps:
186+
- name: Store git credentials for all git commands
187+
# Forces all git commands to use authenticated https, to prevent throttling.
188+
shell: bash
189+
run: |
190+
git config --global credential.helper 'store --file /tmp/git-credentials'
191+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
192+
150193
- name: setup Xcode version (macos)
151194
if: runner.os == 'macOS'
152195
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
@@ -207,6 +250,13 @@ jobs:
207250
with:
208251
path: sdk-src
209252

253+
- name: Store git credentials for all git commands
254+
# Forces all git commands to use authenticated https, to prevent throttling.
255+
shell: bash
256+
run: |
257+
git config --global credential.helper 'store --file /tmp/git-credentials'
258+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
259+
210260
- name: Cache NDK
211261
id: cache_ndk
212262
uses: actions/cache@v2
@@ -254,7 +304,7 @@ jobs:
254304
matrix:
255305
os: [windows-latest, ubuntu-latest, macos-latest]
256306
build_type: ["Release", "Debug"]
257-
architecture: ["x64", "x86"]
307+
architecture: ["x64", "x86", "arm64"]
258308
msvc_runtime: ["static", "dynamic"]
259309
linux_abi: ["legacy", "c++11"]
260310
python_version: [3.7]
@@ -292,8 +342,19 @@ jobs:
292342
msvc_runtime: "dynamic"
293343
- os: ubuntu-latest
294344
build_type: "Debug"
345+
- os: ubuntu-latest
346+
architecture: "arm64"
347+
- os: windows-latest
348+
architecture: "arm64"
295349

296350
steps:
351+
- name: Store git credentials for all git commands
352+
# Forces all git commands to use authenticated https, to prevent throttling.
353+
shell: bash
354+
run: |
355+
git config --global credential.helper 'store --file /tmp/git-credentials'
356+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
357+
297358
- name: setup Xcode version (macos)
298359
if: runner.os == 'macOS'
299360
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
@@ -308,6 +369,10 @@ jobs:
308369
echo "VCPKG_RESPONSE_FILE=external/vcpkg_${{ matrix.vcpkg_triplet }}_response_file.txt" >> $GITHUB_ENV
309370
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}" >> $GITHUB_ENV
310371
echo "SDK_NAME=${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}" >> $GITHUB_ENV
372+
if [[ '${{ matrix.sdk_platform }}' == 'darwin' ]]; then
373+
# If Mac, also hash vcpkg cache on Xcode version.
374+
echo "VCPKG_EXTRA_HASH=-xcode${{env.xcodeVersion}}" >> $GITHUB_ENV
375+
fi
311376
312377
- name: Add msbuild to PATH (windows)
313378
if: startsWith(matrix.os, 'windows')
@@ -318,7 +383,7 @@ jobs:
318383
uses: actions/cache@v2
319384
with:
320385
path: external/vcpkg/installed
321-
key: dev-vcpkg-${{ matrix.architecture }}-${{ matrix.vcpkg_triplet_suffix }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}
386+
key: dev-vcpkg-${{ matrix.architecture }}-${{ matrix.vcpkg_triplet_suffix }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}${{env.VCPKG_EXTRA_HASH}}
322387

323388
- name: Cache ccache files
324389
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
@@ -503,15 +568,15 @@ jobs:
503568
variant=$(sdk-src/build_scripts/desktop/get_variant.sh "${pkg}")
504569
additional_flags=(${verbose_flag})
505570
# Several build targets require explicitly-set binutils format to be passed
506-
# to package.sh (and thus, to merge_libraries).
507-
if [[ "${{ matrix.sdk_platform }}" == "darwin" && "${variant}" == "arm64" ]]; then
508-
# MacOS ARM
509-
additional_flags+=(-f mach-o-arm64)
571+
# to package.sh (and thus, to merge_libraries), or use LLVM binutils.
572+
if [[ "${{ matrix.sdk_platform }}" == "darwin" ]]; then
573+
# MacOS: use LLVM binutils for both X64 and ARM64
574+
additional_flags+=(-L)
510575
elif [[ "${{ matrix.sdk_platform }}" == "windows" && "${variant}" == *"/x64/"* ]]; then
511-
# Windows x64
576+
# Windows x64: force input and output target format
512577
additional_flags+=(-f pe-x86-64,pe-bigobj-x86-64)
513578
elif [[ "${{ matrix.sdk_platform }}" == "windows" && "${variant}" == *"/x86/"* ]]; then
514-
# Windows x86
579+
# Windows x86: force input and output target format
515580
additional_flags+=(-f pe-i386,pe-bigobj-i386)
516581
fi
517582
sdk-src/build_scripts/desktop/package.sh -b ${pkg} -o firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}-package -p ${{ matrix.sdk_platform }} -t bin -d ${variant} -P python3 -j ${additional_flags[*]}
@@ -721,8 +786,8 @@ jobs:
721786
USE_EXPANDED_MATRIX=0
722787
fi
723788
if [[ "${{ github.event_name }}" == "schedule" ]]; then
724-
# reuse flag --test_pull_request=sdk to generate report
725-
generate_report=(-p test_pull_request sdk)
789+
# reuse flag --test_pull_request=nightly-packaging to generate report
790+
generate_report=(-p test_pull_request nightly-packaging)
726791
fi
727792
verbose_flag=
728793
if [[ -n "${{ github.event.inputs.verboseBuild }}" && "${{ github.event.inputs.verboseBuild }}" -ne 0 ]]; then

.github/workflows/desktop.yml

Lines changed: 104 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212

1313
env:
1414
CCACHE_DIR: ${{ github.workspace }}/ccache_dir
15+
GITHUB_TOKEN: ${{ github.token }}
1516

1617
jobs:
1718
prepare_matrix:
@@ -76,7 +77,22 @@ jobs:
7677
xcode_version: "12.4"
7778
- os: windows-latest
7879
xcode_version: "12.4"
80+
# arm64 is only for macos
81+
- os: ubuntu-latest
82+
architecture: "arm64"
83+
- os: windows-latest
84+
architecture: "arm64"
85+
# arm64 can't be built on Xcode 11
86+
- xcode_version: "11.7"
87+
architecture: "arm64"
7988
steps:
89+
- name: Store git credentials for all git commands
90+
# Forces all git commands to use authenticated https, to prevent throttling.
91+
shell: bash
92+
run: |
93+
git config --global credential.helper 'store --file /tmp/git-credentials'
94+
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
95+
8096
- name: Setup Xcode version (macos)
8197
if: runner.os == 'macOS'
8298
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer
@@ -114,21 +130,25 @@ jobs:
114130
echo "VCPKG_SUFFIX: ${{env.VCPKG_SUFFIX}}"
115131
echo "VCPKG_RESPONSE_FILE=external/vcpkg_custom_data/response_files/${{ matrix.architecture }}-${{ env.VCPKG_SUFFIX }}.txt" >> $GITHUB_ENV
116132
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.msvc_runtime }}" >> $GITHUB_ENV
133+
if [[ '${{ matrix.sdk_platform }}' == 'darwin' ]]; then
134+
# If Mac, also hash vcpkg cache on Xcode version.
135+
echo "VCPKG_EXTRA_HASH=-xcode${{matrix.xcode_version}}" >> $GITHUB_ENV
136+
fi
117137
118138
- name: Cache vcpkg C++ dependencies
119139
id: cache_vcpkg
120140
uses: actions/cache@v2
121141
with:
122142
path: external/vcpkg/installed
123-
key: dev-vcpkg-${{ matrix.architecture }}-${{ env.VCPKG_SUFFIX }}-${{ matrix.msvc_runtime }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}
143+
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 }}
124144

125145
- name: Cache ccache files
126146
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
127147
id: cache_ccache
128148
uses: actions/cache@v2
129149
with:
130150
path: ccache_dir
131-
key: dev-test-ccache-${{ env.MATRIX_UNIQUE_NAME }}
151+
key: dev-test-ccache-${{ env.MATRIX_UNIQUE_NAME }}${{ env.VCPKG_EXTRA_HASH }}
132152

133153
- name: Setup python
134154
uses: actions/setup-python@v2
@@ -193,7 +213,7 @@ jobs:
193213
194214
- name: Run unit tests (windows & macos)
195215
# TODO: Enable tests for x86 once they are all working
196-
if: (startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos')) && matrix.architecture != 'x86'
216+
if: (startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos')) && matrix.architecture != 'x86' && matrix.architecture != 'arm64'
197217
env:
198218
LANG: en_US
199219
run: |
@@ -262,3 +282,84 @@ jobs:
262282
path: |
263283
~/Library/Logs/DiagnosticReports/*
264284
/tmp/bins/*
285+
286+
local_integration_tests:
287+
### This job run firestore integration test on Linux Dekstop as required by firestore team.
288+
### It's possible to add more apps here once integration tests are less flaky.
289+
name: local-integration-tests-linux-openssl
290+
needs: prepare_matrix
291+
runs-on: ubuntu-latest
292+
strategy:
293+
fail-fast: false
294+
steps:
295+
- uses: actions/checkout@v2
296+
with:
297+
ref: ${{needs.check_and_prepare.outputs.github_ref}}
298+
submodules: true
299+
- name: Set env vars
300+
run: |
301+
echo "VCPKG_TRIPLET=x64-linux" >> $GITHUB_ENV
302+
echo "VCPKG_RESPONSE_FILE=external/vcpkg_${{ env.VCPKG_TRIPLET }}_response_file.txt" >> $GITHUB_ENV
303+
- name: Cache vcpkg C++ dependencies
304+
id: cache_vcpkg
305+
uses: actions/cache@v2
306+
with:
307+
path: external/vcpkg/installed
308+
key: dev-vcpkg-${{ env.VCPKG_TRIPLET }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}
309+
- name: Cache ccache files
310+
uses: actions/cache@v2
311+
with:
312+
path: ccache_dir
313+
key: local-integration-tests-linux-openssl-ccache
314+
- name: Setup python
315+
uses: actions/setup-python@v2
316+
with:
317+
python-version: ${{ fromJson(needs.prepare_matrix.outputs.matrix_python_version)[0] }}
318+
- name: Prepare for integration tests
319+
run: |
320+
pip install -r scripts/gha/requirements.txt
321+
- name: Install OpenSSL
322+
run: |
323+
sudo apt install openssl
324+
- name: Build integration tests
325+
shell: bash
326+
env:
327+
CCACHE_DIR: ${{ github.workspace }}/ccache_dir
328+
run: |
329+
apis=$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k apis -m=1 )
330+
python scripts/gha/build_testapps.py --p Desktop \
331+
--t ${apis} \
332+
--output_directory "${{ github.workspace }}" \
333+
--artifact_name "desktop-ubuntu-latest-openssl" \
334+
--noadd_timestamp \
335+
--short_output_paths \
336+
--cmake_flag=-DFIREBASE_QUICK_TEST=ON
337+
- name: Summarize build results
338+
if: ${{ !cancelled() }}
339+
shell: bash
340+
run: |
341+
cat build-results-desktop-ubuntu-latest-openssl.log
342+
if [[ "${{ job.status }}" != "success" ]]; then
343+
exit 1
344+
fi
345+
- name: Set up Node (12)
346+
uses: actions/setup-node@v2
347+
with:
348+
node-version: 12.x
349+
- name: Setup Firestore Emulator
350+
run: |
351+
npm install -g firebase-tools
352+
- name: Run Desktop integration tests
353+
run: |
354+
cp scripts/gha/integration_testing/google-services.json testapps-desktop-ubuntu-latest-openssl/firestore/google-services.json
355+
firebase emulators:exec --only firestore --project demo-example 'python scripts/gha/desktop_tester.py --testapp_dir testapps-desktop-ubuntu-latest-openssl --logfile_name "desktop-ubuntu-latest-openssl"'
356+
env:
357+
USE_FIRESTORE_EMULATOR: true
358+
- name: Summarize test results
359+
if: ${{ !cancelled() }}
360+
shell: bash
361+
run: |
362+
cat testapps-desktop-ubuntu-latest-openssl/test-results-desktop-ubuntu-latest-openssl.log
363+
if [[ "${{ job.status }}" != "success" ]]; then
364+
exit 1
365+
fi

0 commit comments

Comments
 (0)