Skip to content
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
eeac015
Allow integration_tests workflow to run against a packaged SDK.
jonsimantov Mar 15, 2021
7f43aee
Because the "boringssl" target doesn't actually run the mobile tests,
jonsimantov Mar 16, 2021
21e6056
Add script for triggering workflows via GitHub API.
jonsimantov Mar 16, 2021
a77519c
Change downloadPreviousRun input name to test_packaged_sdk.
jonsimantov Mar 16, 2021
9fb9828
Fix workflow triggering to pass token and json correctly.
jonsimantov Mar 16, 2021
376a030
Fix auto-detecting of git revision.
jonsimantov Mar 16, 2021
396c771
Add dryrun/verbose mode, and rename commit option to branch.
jonsimantov Mar 16, 2021
832a0ad
Add integration test trigger to the end of c++ packaging.
jonsimantov Mar 16, 2021
eb59281
Pass the "use expanded matrix" option.
jonsimantov Mar 16, 2021
8d0c33d
Fix workflow file.
jonsimantov Mar 16, 2021
d7d62c2
Don't trigger tests if the workflow is set to skip them
jonsimantov Mar 16, 2021
eda4ca2
Wait until after artifact cleanup to trigger integration tests.
jonsimantov Mar 16, 2021
45e600f
Fix dependency typo.
jonsimantov Mar 16, 2021
e9e084d
Eliminate prepare-matrix in the packaging workflow, unneeded.
jonsimantov Mar 16, 2021
8b01deb
Add log if expanded matrix is enabled.
jonsimantov Mar 16, 2021
e61ab07
Restore openssl installer steps back to normal.
jonsimantov Mar 16, 2021
1b6120e
Print a link to find the new workflow run after starting it.
jonsimantov Mar 16, 2021
61804ce
Remove now-unneeded commitIdToPackage option.
jonsimantov Mar 16, 2021
8f556c5
Remove unnecessary quoting.
jonsimantov Mar 16, 2021
e95eddd
Add verbose flag.
jonsimantov Mar 16, 2021
0f31057
Print output when running verbosely.
jonsimantov Mar 16, 2021
88749a9
Use the other github token.
jonsimantov Mar 16, 2021
15f91f1
Add some debug output to the integration test runner.
jonsimantov Mar 16, 2021
fe0c76b
Remove debug bash flag.
jonsimantov Mar 16, 2021
325861d
Use a GitHub App Id to generate a token for triggering workflows.
jonsimantov Mar 16, 2021
ed650cc
Change some workflow step names.
jonsimantov Mar 16, 2021
6cddf78
Use a different action to generate the app token.
jonsimantov Mar 16, 2021
a61c107
Revert "Use a different action to generate the app token."
jonsimantov Mar 16, 2021
ed1e211
Move verbose option to flag (same flag as elsewhere).
jonsimantov Mar 16, 2021
899fd94
Print the workflow URL after it is dispatched.
jonsimantov Mar 16, 2021
9bc4f5c
Add logging for the new run ID after it's triggered.
jonsimantov Mar 16, 2021
6751c3e
Clean up log message slightly.
jonsimantov Mar 16, 2021
de10022
Add more error logging and error handling.
jonsimantov Mar 16, 2021
c9f8b89
Workflow cleanup.
jonsimantov Mar 16, 2021
cabd4a5
Skip a RTDB test that fails on Mobile.
jonsimantov Mar 16, 2021
262bfb4
Add UUID to integration_tests workflow.
jonsimantov Mar 16, 2021
0f7e19c
Remove 11th parameter.
jonsimantov Mar 16, 2021
5e69207
Allow passing in extra information with the run ID. This can be used
jonsimantov Mar 16, 2021
4d1fe0d
Revert "Allow passing in extra information with the run ID. This can …
jonsimantov Mar 16, 2021
68e4b72
Fix URL quoting.
jonsimantov Mar 16, 2021
6c58ab4
Add some more logging / fixed comments to workflow.
jonsimantov Mar 16, 2021
e810cd0
Add an option to sleep a variable amount of time before querying run ID
jonsimantov Mar 16, 2021
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 33 additions & 108 deletions .github/workflows/cpp-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
- cron: "0 9 * * *" # 9am UTC = 1am PST / 2am PDT
workflow_dispatch:
inputs:
commitIdToPackage:
description: 'commit ID to package'
preserveIntermediateArtifacts:
description: 'preserve intermediate artifacts?'
default: 0
Expand Down Expand Up @@ -39,26 +37,9 @@ env:
xcodeVersion: "12"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this env now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still needed, because it controls what xcode version the SDK is built with.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer has been removed below. Is there something else in here that uses it? Some silent GHA observance of the variable?


jobs:
prepare_matrix:
runs-on: ubuntu-latest
env:
USE_EXPANDED_MATRIX: 0
outputs:
use_expanded_matrix: ${{ steps.export-result.outputs.use_expanded_matrix }}
steps:
- name: Use expanded matrix
if: github.event_name == 'schedule' || github.event.inputs.use_expanded_matrix == '1'
run: |
echo "USE_EXPANDED_MATRIX=1" >> $GITHUB_ENV
- id: export-result
run: |
echo "USE_EXPANDED_MATRIX: ${USE_EXPANDED_MATRIX}"
echo "::set-output name=use_expanded_matrix::${USE_EXPANDED_MATRIX}"

log_inputs:
name: log-inputs
runs-on: ubuntu-latest
needs: prepare_matrix
steps:
- name: log run inputs
run: |
Expand All @@ -67,13 +48,6 @@ jobs:
elif [[ -n "${{ github.event.inputs.downloadPreviousRun }}" ]]; then
echo "::warning ::Downloading SDK package from previous run at https://github.com/firebase/firebase-cpp-sdk/actions/runs/${{ github.event.inputs.downloadPreviousRun }}"
fi
if [[ -n "${{ github.event.inputs.commitIdToPackage }}" ]]; then
if [[ -n "${{ github.event.inputs.downloadPublicVersion }}" || -n "${{ github.event.inputs.downloadPreviousRun }}" ]]; then
echo "::warning ::Using commit ID '${{ github.event.inputs.commitIdToPackage }}' for building tests."
else
echo "::warning ::Using commit ID '${{ github.event.inputs.commitIdToPackage }}' for building and packaging SDK and tests."
fi
fi

- name: log if skipping integration tests
if: |
Expand All @@ -92,10 +66,13 @@ jobs:
github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == ''
run: echo "::warning ::Verbose build enabled."

- name: log if expanded matrix enabled
if: github.event_name == 'schedule' || github.event.inputs.use_expanded_matrix == '1'
run: echo "::warning ::Expanded test matrix enabled."

build_tools:
name: build-tools-${{ matrix.tools_platform }}
runs-on: ${{ matrix.os }}
needs: prepare_matrix
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
strategy:
matrix:
Expand Down Expand Up @@ -168,7 +145,6 @@ jobs:
build_and_package_ios:
name: build-and-package-ios
runs-on: macos-latest
needs: prepare_matrix
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
steps:
- name: setup Xcode version (macos)
Expand All @@ -179,7 +155,6 @@ jobs:
uses: actions/checkout@v2.3.1
with:
path: sdk-src
ref: ${{ github.event.inputs.commitIdToPackage }}

- name: install prerequisites
run: sdk-src/build_scripts/ios/install_prereqs.sh
Expand Down Expand Up @@ -215,7 +190,6 @@ jobs:
build_and_package_android:
name: build-and-package-android-${{matrix.stl}}
runs-on: ubuntu-latest
needs: prepare_matrix
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
strategy:
fail-fast: false
Expand All @@ -226,7 +200,6 @@ jobs:
uses: actions/checkout@v2.3.1
with:
path: sdk-src
ref: ${{ github.event.inputs.commitIdToPackage }}

- name: install prerequisites
run: sdk-src/build_scripts/android/install_prereqs.sh
Expand Down Expand Up @@ -262,7 +235,6 @@ jobs:
build_desktop:
name: build-${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}
runs-on: ${{ matrix.os }}
needs: prepare_matrix
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -316,7 +288,6 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
ref: ${{ github.event.inputs.commitIdToPackage }}

- name: Set env variables for subsequent steps (all)
shell: bash
Expand Down Expand Up @@ -445,7 +416,6 @@ jobs:
uses: actions/checkout@v2.3.1
with:
path: sdk-src
ref: ${{ github.event.inputs.commitIdToPackage }}

- name: download artifact
uses: actions/download-artifact@v2.0.8
Expand Down Expand Up @@ -594,7 +564,6 @@ jobs:
uses: actions/checkout@v2.3.1
with:
path: sdk-src
ref: ${{ github.event.inputs.commitIdToPackage }}

- name: download artifact
uses: actions/download-artifact@v2.0.8
Expand Down Expand Up @@ -668,88 +637,44 @@ jobs:
failOnError: false
useGlob: true

tests:
needs: [merge_packages, download_sdk_package]
trigger_integration_tests:
# Trigger the integration_tests workflow.
needs: [merge_packages, download_sdk_package, cleanup_packaging_artifacts]
if: (github.event.inputs.skipIntegrationTests == 0 || github.event.inputs.skipIntegrationTests == '') && !cancelled()
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
target_platform: [Desktop, Android, iOS]
exclude:
- os: ubuntu-latest
target_platform: iOS
- os: windows-latest
target_platform: iOS
fail-fast: false
env:
apis: admob,analytics,auth,database,dynamic_links,firestore,functions,installations,instance_id,messaging,remote_config,storage
android_device: flame
android_api: 29
ios_device: iphone8
ios_version: 11.4
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2.3.1
with:
ref: ${{ github.event.inputs.commitIdToPackage }}
- name: Setup Xcode version (macos)
if: runner.os == 'macOS'
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
- name: Download Firebase C++ SDK
uses: actions/download-artifact@v2.0.8
with:
name: firebase_cpp_sdk.zip
- name: Unzip Firebase C++ SDK
shell: bash
run: |
ls
if [ "$RUNNER_OS" == "Windows" ]; then
7z x firebase_cpp_sdk.zip
else
unzip -q firebase_cpp_sdk.zip
fi

- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Add msbuild to PATH (windows)
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1.0.2
- name: Prepare for integration tests
run: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
- name: Build integration tests
- name: Use expanded matrix
if: github.event_name == 'schedule' || github.event.inputs.use_expanded_matrix == '1'
run: |
python scripts/gha/build_testapps.py --t ${{ env.apis }} --p ${{ matrix.target_platform }} --packaged_sdk firebase_cpp_sdk --output_directory "${{ github.workspace }}" --noadd_timestamp

- name: Run desktop integration tests
if: matrix.target_platform == 'Desktop' && !cancelled()
run: |
python scripts/gha/desktop_tester.py --testapp_dir testapps
# Workaround for https://github.com/GoogleCloudPlatform/github-actions/issues/100
# Must be run after the Python setup action
- name: Set CLOUDSDK_PYTHON (Windows)
shell: bash
if: runner.os == 'Windows' && !cancelled()
run: echo "CLOUDSDK_PYTHON=${{env.pythonLocation}}\python.exe" >> $GITHUB_ENV
- name: Install Cloud SDK
if: ${{ !cancelled() }}
uses: google-github-actions/setup-gcloud@master
- name: Upload Desktop Artifacts to GCS
if: ${{ !cancelled() }}
run: |
python scripts/gha/gcs_uploader.py --testapp_dir testapps --key_file scripts/gha-encrypted/gcs_key_file.json
- name: Run mobile integration tests
if: matrix.target_platform != 'Desktop' && !cancelled()
run: |
python scripts/gha/test_lab.py --android_model ${{ env.android_device }} --android_api ${{ env.android_api }} --ios_model ${{ env.ios_device }} --ios_version ${{ env.ios_version }} --testapp_dir testapps --code_platform cpp --key_file scripts/gha-encrypted/gcs_key_file.json
- name: Summarize build and test results
if: ${{ !cancelled() }}
echo "USE_EXPANDED_MATRIX=1" >> $GITHUB_ENV
- name: Generate token for GitHub API
# This step is necessary because the existing GITHUB_TOKEN cannot be used inside one workflow to trigger another.
#
# Instead, generate a new token here, using our GitHub App's private key and App ID (saved as Secrets).
#
# This method is preferred over the "personal access token" solution, as the GitHub App's scope is limited to just
# the firebase-cpp-sdk repository.
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.WORKFLOW_TRIGGER_APP_ID }}
private_key: ${{ secrets.WORKFLOW_TRIGGER_APP_PRIVATE_KEY }}
- name: Use GitHub API to start workflow
shell: bash
run: |
cat testapps/summary.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
if [[ -z ${USE_EXPANDED_MATRIX} ]]; then
USE_EXPANDED_MATRIX=0
fi
verbose_flag=
if [[ -n "${{ github.event.inputs.verboseBuild }}" && "${{ github.event.inputs.verboseBuild }}" -ne 0 ]]; then
verbose_flag=-v
fi
set -e
python scripts/gha/trigger_workflow.py -t ${{ steps.generate-token.outputs.token }} -w integration_tests.yml -p test_packaged_sdk ${{ github.run_id }} -p use_expanded_matrix ${USE_EXPANDED_MATRIX} -A ${verbose_flag}
46 changes: 37 additions & 9 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ on:
use_expanded_matrix:
description: 'Use an expanded matrix? Note: above config will be ignored.'
default: '0'
required: true
required: true
test_packaged_sdk:
description: 'Optional: Packaging run # to build against?'

jobs:
# To feed input into the job matrix, we first need to convert to a JSON
Expand Down Expand Up @@ -65,13 +67,20 @@ jobs:
run: |
echo "::set-output name=matrix_platform::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k platform -o "${{github.event.inputs.platforms}}" )"
echo "::set-output name=matrix_os::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k os -o "${{github.event.inputs.operating_systems}}" )"
echo "::set-output name=matrix_ssl::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k ssl_lib -o "${{github.event.inputs.desktop_ssl_variants}}" )"
# If building against a packaged SDK, only use boringssl.
if [[ -n "${{ github.event.inputs.test_packaged_sdk }}" ]]; then
echo "::warning ::Downloading SDK package from previous run at https://github.com/firebase/firebase-cpp-sdk/actions/runs/${{ github.event.inputs.test_packaged_sdk }}"
# Because the mobile tests require this value to be set to 'openssl', set it to 'openssl' here but don't actually install openssl later.
echo "::set-output name=matrix_ssl::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k ssl_lib -o openssl )"
else
echo "::set-output name=matrix_ssl::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k ssl_lib -o "${{github.event.inputs.desktop_ssl_variants}}" )"
fi
echo "::set-output name=apis::$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k apis -o "${{github.event.inputs.apis}}" )"
echo "::set-output name=android_device::$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k android_device -o "${{github.event.inputs.android_device}}" )"
echo "::set-output name=android_api::$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k android_api -o "${{github.event.inputs.android_api}}" )"
echo "::set-output name=ios_device::$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k ios_device -o "${{github.event.inputs.ios_device}}" )"
echo "::set-output name=ios_version::$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k ios_version -o "${{github.event.inputs.ios_version}}" )"

tests:
name: ${{ matrix.os }}-${{ matrix.target_platform }}-${{ matrix.ssl_variant }}
needs: prepare_matrix
Expand All @@ -96,7 +105,6 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true

- name: Set env vars (ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: echo "VCPKG_TRIPLET=x64-linux" >> $GITHUB_ENV
Expand Down Expand Up @@ -172,15 +180,35 @@ jobs:
run: |
sudo apt install openssl

- name: fetch artifact from previous run
uses: dawidd6/action-download-artifact@v2
if: ${{ github.event.inputs.test_packaged_sdk != '' }}
with:
name: 'firebase_cpp_sdk.zip'
workflow: 'cpp-packaging.yml'
run_id: ${{ github.event.inputs.test_packaged_sdk }}

- name: Build integration tests
shell: bash
run: |
# Default SSL is openssl.
ssl_option=
if [[ "${{ matrix.ssl_variant }}" == "boringssl" ]]; then
ssl_option=--cmake_flag=-DFIREBASE_USE_BORINGSSL=ON
declare -a additional_flags
if [[ -n "${{ github.event.inputs.test_packaged_sdk }}" ]]; then
# Building integration tests against a packaged SDK.
mkdir downloaded_sdk
cd downloaded_sdk
unzip -q ../firebase_cpp_sdk.zip
cd ..
additional_flags+=(--packaged_sdk downloaded_sdk/firebase_cpp_sdk)
else
# Building integration tests against the SDK source.
#
# When building the SDK from source, the default SSL is openssl.
# To build using boringssl, a cmake flag must be added:
if [[ "${{ matrix.ssl_variant }}" == "boringssl" ]]; then
additional_flags+=(--cmake_flag=-DFIREBASE_USE_BORINGSSL=ON)
fi
fi
python scripts/gha/build_testapps.py --t ${{ needs.prepare_matrix.outputs.apis }} --p ${{ matrix.target_platform }} --output_directory "${{ github.workspace }}" --noadd_timestamp ${ssl_option}
python scripts/gha/build_testapps.py --t ${{ needs.prepare_matrix.outputs.apis }} --p ${{ matrix.target_platform }} --output_directory "${{ github.workspace }}" --noadd_timestamp ${additional_flags[*]}

- name: Run desktop integration tests
if: matrix.target_platform == 'Desktop' && !cancelled()
Expand Down
2 changes: 2 additions & 0 deletions database/integration_test/src/integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@ class LoggingValueListener : public firebase::database::ValueListener {
};

TEST_F(FirebaseDatabaseTest, TestAddAndRemoveListenerRace) {
SKIP_TEST_ON_MOBILE;

const char* test_name = test_info_->name();

SignIn();
Expand Down
Loading