Skip to content

Bump actions/download-artifact from 2.0.8 to 4.1.7 in /.github/workflows in the github_actions group across 1 directory #1

Bump actions/download-artifact from 2.0.8 to 4.1.7 in /.github/workflows in the github_actions group across 1 directory

Bump actions/download-artifact from 2.0.8 to 4.1.7 in /.github/workflows in the github_actions group across 1 directory #1

name: Integration tests
on:
schedule:
- cron: "0 9 * * *" # 9am UTC = 1am PST / 2am PDT
pull_request:
types: [ labeled, closed ]
workflow_dispatch:
inputs:
platforms:
description: 'CSV of Desktop, Android, iOS and/or tvOS'
default: 'Desktop,Android,iOS,tvOS'
required: true
apis:
description: 'CSV of apis to build and test'
default: 'admob,analytics,auth,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
required: true
operating_systems:
description: 'CSV of VMs to run on'
default: 'ubuntu-latest,windows-latest,macos-latest'
required: true
desktop_ssl_variants:
description: 'CSV of desktop SSL variants to use'
default: 'openssl,boringssl'
required: true
mobile_test_on:
description: 'Run mobile tests on real and/or virtual devices? (separated by commas)'
default: 'real,virtual'
required: true
use_expanded_matrix:
description: 'Use an expanded matrix? Note: above config will be ignored.'
default: '0'
required: true
test_packaged_sdk:
description: 'Optional: Packaging run # to build against?'
test_pull_request:
description: 'Optional: Pull request # to build and test? (With optional commit hash, separated by a colon. Specify the FULL hash.)'
env:
triggerLabelPrefix: "tests-requested: "
triggerLabelFull: "tests-requested: full"
triggerLabelQuick: "tests-requested: quick"
statusLabelInProgress: "tests: in-progress"
statusLabelFailed: "tests: failed"
statusLabelSucceeded: "tests: succeeded"
statusCommentIdentifier: "integration-test-status-comment"
pythonVersion: '3.7'
artifactRetentionDays: 2
jobs:
check_trigger:
### This job runs when the workflow was triggered by 1) PR getting labeled
### 2) PR merged & closed 3) or manumlly triggered with Pull request #.
### If triggered by label, then checks whether the label is a test-request
### trigger (cancelling the workflow if not).
### It sets outputs to control the build_* matrix (full or quick) and to tell
### subsequent steps to update the labels as well.
runs-on: ubuntu-latest
if: |
github.event_name == 'pull_request' || github.event.inputs.test_pull_request != ''
outputs:
should_update_pr: ${{ steps.set_outputs.outputs.should_update_pr }}
requested_tests: ${{ steps.set_outputs.outputs.requested_tests }}
pr_number: ${{ steps.get_pr_number.outputs.pr_number }}
steps:
### If the label isn't 1)the test-request triggers, 2) closed on merge trigger, cancel the workflow.
- name: Cancel workflow
if: (github.event.action == 'labeled' && !startsWith(github.event.label.name, env.triggerLabelPrefix)) || (github.event.action == 'closed' && github.event.pull_request.merged != true)
uses: andymckay/[email protected]
- name: Wait for above cancellation
if: (github.event.action == 'labeled' && !startsWith(github.event.label.name, env.triggerLabelPrefix)) || (github.event.action == 'closed' && github.event.pull_request.merged != true)
run: |
sleep 300
exit 1 # fail out if the cancellation above somehow failed.
- id: get_pr_number
run: |
# In this step, github_ref is only used for the status message below.
# It will be recalculated in prepare_matrix.
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "::set-output name=pr_number::${{ github.event.pull_request.number }}"
echo "::set-output name=github_ref::$GITHUB_SHA"
elif [[ "${{github.event.inputs.test_pull_request}}" == *:* ]]; then
# If specified as pr:commit_hash, split them.
echo "::set-output name=pr_number::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f1)"
echo "::set-output name=github_ref::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f2)"
else
# Just a PR number.
echo "::set-output name=pr_number::${{ github.event.inputs.test_pull_request }}"
echo "::set-output name=github_ref::refs/pull/${{github.event.inputs.test_pull_request}}/merge"
fi
- name: Cancel previous runs on the same PR
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Remove triggering label
uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ github.token }}
number: "${{ steps.get_pr_number.outputs.pr_number }}"
labels: "${{ github.event.label.name }}"
### Fail the workflow if the user does not have admin access to run the tests.
- name: Check if user has permission to trigger tests
uses: lannonbr/[email protected]
with:
permission: "admin"
env:
GITHUB_TOKEN: ${{ github.token }}
- id: set_outputs
run: |
echo "::set-output name=should_update_pr::1"
if [[ "${{ github.event.label.name }}" == "${{ env.triggerLabelFull }}" ]]; then
echo "::set-output name=requested_tests::full"
elif [[ "${{ github.event.label.name }}" == "${{ env.triggerLabelQuick }}" ]]; then
echo "::set-output name=requested_tests::auto"
else
# For manual PR testing, use auto mode.
echo "::set-output name=requested_tests::auto"
fi
### Add the in-progress label and remove any previous success/fail labels.
- uses: actions/checkout@v2
with:
ref: ${{steps.get_pr_number.outputs.github_ref}}
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
run: pip install -r scripts/gha/requirements.txt
- name: Update PR label and comment
run: |
python scripts/gha/it_workflow.py --stage start \
--token ${{github.token}} \
--issue_number ${{steps.get_pr_number.outputs.pr_number}} \
--actor ${{github.actor}} \
--commit ${{steps.get_pr_number.outputs.github_ref}} \
--run_id ${{github.run_id}}
# To feed input into the job matrix, we first need to convert to a JSON
# list. Then we can use fromJson to define the field in the matrix for the tests job.
prepare_matrix:
runs-on: ubuntu-latest
needs: check_trigger
if: ${{ !cancelled() && !failure() }} # Run even if check_trigger was skipped.
outputs:
matrix_platform: ${{ steps.export-result.outputs.matrix_platform }}
matrix_os: ${{ steps.export-result.outputs.matrix_os }}
matrix_ssl: ${{ steps.export-result.outputs.matrix_ssl }}
apis: ${{ steps.export-result.outputs.apis }}
mobile_test_on: ${{ steps.export-result.outputs.mobile_test_on }}
android_device: ${{ steps.export-result.outputs.android_device }}
ios_device: ${{ steps.export-result.outputs.ios_device }}
tvos_device: ${{ steps.export-result.outputs.tvos_device }}
github_ref: ${{ steps.export-result.outputs.github_ref }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: false
- name: Use expanded matrix
if: github.event.inputs.use_expanded_matrix == '1' || needs.check_trigger.outputs.requested_tests == 'full'
run: |
echo "EXPANDED_MATRIX_PARAM=-e=1" >> $GITHUB_ENV
- name: Set auto-diff option if specified.
if: needs.check_trigger.outputs.requested_tests == 'auto'
run: |
echo "Autodetecting which tests to run."
if [[ -n "${{github.event.inputs.test_pull_request}}" ]]; then
# If running this manually, diff against main.
echo "AUTO_DIFF_PARAM=--auto_diff main" >> $GITHUB_ENV
else
# If running in a PR, diff against the PR's base.
echo "AUTO_DIFF_PARAM=--auto_diff ${{github.event.pull_request.base.sha}}" >> $GITHUB_ENV
fi
- id: export-result
# e.g. 'ubuntu-latest,macos-latest' -> '["ubuntu-latest","macos-latest"]'
run: |
echo "::set-output name=apis::$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k apis -o "${{github.event.inputs.apis}}" ${AUTO_DIFF_PARAM})"
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}}" ${AUTO_DIFF_PARAM})"
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}}" ${AUTO_DIFF_PARAM})"
# 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: https://github.com/${{github.repository}}/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. It won't actually matter 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
mobile_test_on=$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k mobile_test_on -o "${{github.event.inputs.mobile_test_on}}")
echo "::set-output name=mobile_test_on::${mobile_test_on}"
echo "::set-output name=android_device::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k android_device -t ${mobile_test_on} )"
echo "::set-output name=ios_device::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k ios_device -t ${mobile_test_on} )"
echo "::set-output name=tvos_device::$( python scripts/gha/print_matrix_configuration.py -w integration_tests ${EXPANDED_MATRIX_PARAM} -k tvos_device -t ${mobile_test_on} )"
if [[ -z "${{github.event.inputs.test_pull_request}}" ]]; then
echo "::warning ::Running on https://github.com/${{github.repository}}/commits/$GITHUB_SHA"
echo "::set-output name=github_ref::$GITHUB_SHA"
elif [[ "${{github.event.inputs.test_pull_request}}" == *:* ]]; then
# If specified as pr:commit_hash, split them to get the exact hash.
echo "::warning ::Running on https://github.com/${{github.repository}}/pull/$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f1) on commit https://github.com/${{github.repository}}/commit/$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f2)"
echo "::set-output name=github_ref::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f2)"
else
# Just the PR specified, use refs/pull/<number>/merge as the ref.
echo "::warning ::Running on https://github.com/${{github.repository}}/pull/${{github.event.inputs.test_pull_request}}"
echo "::set-output name=github_ref::refs/pull/${{github.event.inputs.test_pull_request}}/merge"
fi
build_desktop:
name: build-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
needs: [check_trigger, prepare_matrix]
runs-on: ${{ matrix.os }}
# Skip this if there is an empty matrix (which can happen if "auto" was set above).
# But check cancelled() && !failure() so it runs even if check_trigger was skipped.
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'Desktop') && needs.prepare_matrix.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.prepare_matrix.outputs.matrix_os) }}
ssl_variant: ${{ fromJson(needs.prepare_matrix.outputs.matrix_ssl) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
submodules: true
- name: Set env vars (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: echo "VCPKG_TRIPLET=x64-linux" >> $GITHUB_ENV
- name: Set env vars (macOS)
if: startsWith(matrix.os, 'macos')
run: echo "VCPKG_TRIPLET=x64-osx" >> $GITHUB_ENV
- name: Set env vars (Windows)
shell: bash
if: startsWith(matrix.os, 'windows')
run: echo "VCPKG_TRIPLET=x64-windows-static" >> $GITHUB_ENV
- name: Set env vars (all)
shell: bash
run: echo "VCPKG_RESPONSE_FILE=external/vcpkg_${{ env.VCPKG_TRIPLET }}_response_file.txt" >> $GITHUB_ENV
- name: Add msbuild to PATH (Windows)
if: startsWith(matrix.os, 'windows')
uses: microsoft/[email protected]
- name: Cache vcpkg C++ dependencies
id: cache_vcpkg
uses: actions/cache@v2
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: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Update homebrew (avoid bintray errors)
if: startsWith(matrix.os, 'macos')
run: |
# Temporarily here until Github runners have updated their version of
# homebrew. This prevents errors arising from the shut down of
# binutils, used by older version of homebrew for hosting packages.
brew update
- name: Install SDK Desktop prerequisites
run: |
python scripts/gha/install_prereqs_desktop.py
- name: Prepare for integration tests
run: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
- name: Install OpenSSL (Windows)
if: matrix.ssl_variant == 'openssl' &&
startsWith(matrix.os, 'windows')
run: |
choco install openssl -r
- name: Install OpenSSL (macOS)
if: matrix.ssl_variant == 'openssl' &&
startsWith(matrix.os, 'macos')
run: |
brew install openssl
# brew won't overwrite MacOS system default OpenSSL, so force it here.
echo "OPENSSL_ROOT_DIR=/usr/local/opt/[email protected]" >> $GITHUB_ENV
- name: Install OpenSSL (Linux)
if: matrix.ssl_variant == 'openssl' &&
startsWith(matrix.os, 'ubuntu')
run: |
sudo apt install openssl
- name: Fetch prebuilt packaged SDK 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: |
declare -a additional_flags
if [[ -n "${{ github.event.inputs.test_packaged_sdk }}" ]]; then
# Building integration tests against a packaged SDK.
mkdir downloaded_sdk
unzip -q firebase_cpp_sdk.zip -d downloaded_sdk/
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 --p Desktop \
--t ${{ needs.prepare_matrix.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--artifact_name "desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}" \
--noadd_timestamp \
--short_output_paths \
${additional_flags[*]}
- name: Upload Desktop integration tests artifact
uses: actions/[email protected]
if: ${{ !cancelled() }}
with:
name: testapps-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
path: testapps-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
retention-days: ${{ env.artifactRetentionDays }}
- name: Upload Desktop build results artifact
uses: actions/[email protected]
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Cleanup Local Copies of Uploaded Artifacts
shell: bash
run: |
rm -rf testapps-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
- name: Set CLOUDSDK_PYTHON (Windows)
shell: bash
if: startsWith(matrix.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
shell: bash
if: ${{ !cancelled() }}
run: |
python scripts/gha/gcs_uploader.py --testapp_dir ta --key_file scripts/gha-encrypted/gcs_key_file.json
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/[email protected]
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
shell: bash
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
pushd ${{env.GCS_UPLOAD_DIR}}
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
build_android:
name: build-android-${{ matrix.os }}
needs: [check_trigger, prepare_matrix]
runs-on: ${{ matrix.os }}
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'Android') && needs.prepare_matrix.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.prepare_matrix.outputs.matrix_os) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
submodules: true
- name: Add msbuild to PATH (Windows)
if: startsWith(matrix.os, 'windows')
uses: microsoft/[email protected]
- name: Cache NDK
id: cache_ndk
uses: actions/cache@v2
with:
path: /tmp/android-ndk-r16b
key: android-ndk-${{ matrix.os }}-r16b
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Update homebrew (avoid bintray errors)
if: startsWith(matrix.os, 'macos')
run: |
# Temporarily here until Github runners have updated their version of
# homebrew. This prevents errors arising from the shut down of
# binutils, used by older version of homebrew for hosting packages.
brew update
- name: Install SDK Android prerequisites
shell: bash
run: |
build_scripts/android/install_prereqs.sh
- name: Prepare for integration tests
run: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
- name: Fetch prebuilt packaged SDK 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: |
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)
fi
python scripts/gha/build_testapps.py --p Android \
--t ${{ needs.prepare_matrix.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--artifact_name "android-${{ matrix.os }}" \
--noadd_timestamp \
--short_output_paths \
${additional_flags[*]}
- name: Upload Android integration tests artifact
uses: actions/[email protected]
if: ${{ !cancelled() }}
with:
name: testapps-android-${{ matrix.os }}
path: testapps-android-${{ matrix.os }}
retention-days: ${{ env.artifactRetentionDays }}
- name: Upload Android build results artifact
uses: actions/[email protected]
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-android-${{ matrix.os }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/[email protected]
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-android-${{ matrix.os }}.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
build_ios:
name: build-ios-macos-latest
needs: [check_trigger, prepare_matrix]
runs-on: macos-latest
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'iOS') && contains(needs.prepare_matrix.outputs.matrix_os, 'macos-latest') && needs.prepare_matrix.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
submodules: true
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Update homebrew (avoid bintray errors)
run: |
# Temporarily here until Github runners have updated their version of
# homebrew. This prevents errors arising from the shut down of
# binutils, used by older version of homebrew for hosting packages.
brew update
- name: Install SDK iOS prerequisites
run: build_scripts/ios/install_prereqs.sh
- name: Prepare for integration tests
run: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
- name: Fetch prebuilt packaged SDK 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: |
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)
fi
python scripts/gha/build_testapps.py --p iOS \
--t ${{ needs.prepare_matrix.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--ios_sdk ${{ needs.prepare_matrix.outputs.mobile_test_on }} \
--artifact_name "ios-macos-latest" \
--noadd_timestamp \
--short_output_paths \
${additional_flags[*]}
- name: Upload iOS integration tests artifact
uses: actions/[email protected]
if: ${{ !cancelled() }}
with:
name: testapps-ios-macos-latest
path: testapps-ios-macos-latest
retention-days: ${{ env.artifactRetentionDays }}
- name: Upload iOS build results artifact
uses: actions/[email protected]
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-ios-macos-latest*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/[email protected]
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-ios-macos-latest.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
build_tvos:
name: build-tvos-macos-latest
needs: [check_trigger, prepare_matrix]
runs-on: macos-latest
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'tvOS') && contains(needs.prepare_matrix.outputs.matrix_os, 'macos-latest') && needs.prepare_matrix.outputs.apis != '' && !cancelled() && !failure()
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
submodules: true
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Update homebrew (avoid bintray errors)
run: |
# Temporarily here until Github runners have updated their version of
# homebrew. This prevents errors arising from the shut down of
# binutils, used by older version of homebrew for hosting packages.
brew update
- name: Install SDK tvOS prerequisites
run: build_scripts/tvos/install_prereqs.sh
- name: Prepare for integration tests
run: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
- name: Fetch prebuilt packaged SDK 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: |
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)
fi
python scripts/gha/build_testapps.py --p tvOS \
--t ${{ needs.prepare_matrix.outputs.apis }} \
--output_directory "${{ github.workspace }}" \
--artifact_name "tvos-macos-latest" \
--noadd_timestamp \
--short_output_paths \
${additional_flags[*]}
- name: Upload tvOS integration tests artifact
uses: actions/[email protected]
if: ${{ !cancelled() }}
with:
name: testapps-tvos-macos-latest
path: testapps-tvos-macos-latest
retention-days: ${{ env.artifactRetentionDays }}
- name: Upload tvOS build results artifact
uses: actions/[email protected]
if: ${{ !cancelled() }}
with:
name: log-artifact
path: build-results-tvos-macos-latest*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/[email protected]
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-tvos-macos-latest.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
test_desktop:
name: test-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
needs: [check_trigger, prepare_matrix, build_desktop]
runs-on: ${{ matrix.os }}
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'Desktop') && needs.prepare_matrix.outputs.apis != '' && !cancelled()
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.prepare_matrix.outputs.matrix_os) }}
ssl_variant: ${{ fromJson(needs.prepare_matrix.outputs.matrix_ssl) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
- name: Download Desktop integration tests artifact
uses: actions/[email protected]
with:
path: testapps
name: testapps-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Setup integration test deps
run: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}" --artifact testapps
- name: Run Desktop integration tests
run: python scripts/gha/desktop_tester.py --testapp_dir testapps --logfile_name "desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}"
- name: Upload Desktop test results artifact
if: ${{ !cancelled() }}
uses: actions/[email protected]
with:
name: log-artifact
path: testapps/test-results-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/[email protected]
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize test results
if: ${{ !cancelled() }}
shell: bash
run: |
cat testapps/test-results-desktop-${{ matrix.os }}-${{ matrix.ssl_variant }}.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
test_android:
name: test-android-${{ matrix.build_os }}-${{ matrix.android_device }}
needs: [check_trigger, prepare_matrix, build_android]
runs-on: macos-latest
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'Android') && needs.prepare_matrix.outputs.apis != '' && !cancelled()
strategy:
fail-fast: false
matrix:
build_os: ${{ fromJson(needs.prepare_matrix.outputs.matrix_os) }}
android_device: ${{ fromJson(needs.prepare_matrix.outputs.android_device) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
- name: Download Android integration tests artifact
uses: actions/[email protected]
with:
path: testapps
name: testapps-android-${{ matrix.build_os }}
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
run: pip install -r scripts/gha/requirements.txt
- id: get-device-type
run: |
echo "::set-output name=device_type::$( python scripts/gha/print_matrix_configuration.py -d -k ${{ matrix.android_device }} )"
- name: Run Android integration tests on Emulator locally
if: steps.get-device-type.outputs.device_type == 'virtual'
run: |
python scripts/gha/test_simulator.py --testapp_dir testapps \
--android_device "${{ matrix.android_device }}" \
--logfile_name "android-${{ matrix.build_os }}-${{ matrix.android_device }}" \
--ci
- name: Install Cloud SDK
if: steps.get-device-type.outputs.device_type == 'real'
uses: google-github-actions/setup-gcloud@master
- name: Run Android integration tests on Real Device via FTL
if: steps.get-device-type.outputs.device_type == 'real'
run: |
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
python scripts/gha/test_lab.py --testapp_dir testapps \
--android_device "${{ matrix.android_device }}" \
--logfile_name "android-${{ matrix.build_os }}-${{ matrix.android_device }}" \
--code_platform cpp \
--key_file scripts/gha-encrypted/gcs_key_file.json
- name: Upload Android test results artifact
if: ${{ !cancelled() }}
uses: actions/[email protected]
with:
name: log-artifact
path: testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/[email protected]
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize test results
if: ${{ !cancelled() }}
shell: bash
run: |
cat "testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}.log"
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
test_ios:
name: test-ios-macos-latest-${{ matrix.ios_device }}
needs: [check_trigger, prepare_matrix, build_ios]
runs-on: macos-latest
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'iOS') && needs.prepare_matrix.outputs.apis != '' && !cancelled()
strategy:
fail-fast: false
matrix:
ios_device: ${{ fromJson(needs.prepare_matrix.outputs.ios_device) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
- name: Download iOS integration tests artifact
uses: actions/[email protected]
with:
path: testapps
name: testapps-ios-macos-latest
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
run: pip install -r scripts/gha/requirements.txt
- id: get-device-type
run: |
echo "::set-output name=device_type::$( python scripts/gha/print_matrix_configuration.py -d -k ${{ matrix.ios_device }} )"
- name: Run iOS integration tests on Simulator locally
if: steps.get-device-type.outputs.device_type == 'virtual'
run: |
python scripts/gha/test_simulator.py --testapp_dir testapps \
--ios_device "${{ matrix.ios_device }}" \
--logfile_name "ios-macos-latest-${{ matrix.ios_device }}" \
--ci
- name: Install Cloud SDK
if: steps.get-device-type.outputs.device_type == 'real'
uses: google-github-actions/setup-gcloud@master
- name: Run iOS integration tests on Real Device via FTL
if: steps.get-device-type.outputs.device_type == 'real'
run: |
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
python scripts/gha/test_lab.py --testapp_dir testapps \
--ios_device "${{ matrix.ios_device }}" \
--logfile_name "ios-macos-latest-${{ matrix.ios_device }}" \
--code_platform cpp \
--key_file scripts/gha-encrypted/gcs_key_file.json
- name: Upload iOS test results artifact
if: ${{ !cancelled() }}
uses: actions/[email protected]
with:
name: log-artifact
path: testapps/test-results-ios-macos-latest-${{ matrix.ios_device }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/[email protected]
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize test results
if: ${{ !cancelled() }}
shell: bash
run: |
cat "testapps/test-results-ios-macos-latest-${{ matrix.ios_device }}.log"
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
test_tvos:
name: test-tvos-macos-latest-${{ matrix.tvos_device }}
needs: [check_trigger, prepare_matrix, build_tvos]
runs-on: macos-latest
if: contains(needs.prepare_matrix.outputs.matrix_platform, 'tvOS') && needs.prepare_matrix.outputs.apis != '' && !cancelled()
strategy:
fail-fast: false
matrix:
tvos_device: ${{ fromJson(needs.prepare_matrix.outputs.tvos_device) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
- name: Download tvOS integration tests artifact
uses: actions/[email protected]
with:
path: testapps
name: testapps-tvos-macos-latest
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
run: pip install -r scripts/gha/requirements.txt
- name: Run tvOS integration tests on Simulator locally
run: |
python scripts/gha/test_simulator.py --testapp_dir testapps \
--tvos_device "${{ matrix.tvos_device }}" \
--logfile_name "tvos-macos-latest-${{ matrix.tvos_device }}" \
--ci
- name: Upload tvOS test results artifact
if: ${{ !cancelled() }}
uses: actions/[email protected]
with:
name: log-artifact
path: testapps/test-results-tvos-macos-latest-${{ matrix.tvos_device }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Download log artifacts
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
uses: actions/[email protected]
with:
path: test_results
name: log-artifact
- name: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr && failure() && !cancelled() }}
run: |
python scripts/gha/it_workflow.py --stage progress \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize test results
if: ${{ !cancelled() }}
shell: bash
run: |
cat "testapps/test-results-tvos-macos-latest-${{ matrix.tvos_device }}.log"
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
summarize_results:
name: "summarize-results"
needs: [check_trigger, prepare_matrix, test_desktop, test_android, test_ios, test_tvos]
runs-on: ubuntu-latest
if: ${{ !cancelled() }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{needs.prepare_matrix.outputs.github_ref}}
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
run: pip install -r scripts/gha/requirements.txt
- name: Download log artifacts
uses: actions/[email protected]
with:
path: test_results
name: log-artifact
# Use a different token to remove the "in-progress" label,
# to allow the removal to trigger the "Check Labels" workflow.
- name: Generate token for GitHub API
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: Update PR label and comment
if: ${{ needs.check_trigger.outputs.should_update_pr }}
run: |
python scripts/gha/it_workflow.py --stage end \
--token ${{github.token}} \
--issue_number ${{needs.check_trigger.outputs.pr_number}}\
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}} \
--new_token ${{steps.generate-token.outputs.token}}
- name: Update Daily Report
if: ${{ github.event_name == 'schedule' }}
run: |
python scripts/gha/it_workflow.py --stage report \
--token ${{github.token}} \
--actor ${{github.actor}} \
--commit ${{needs.prepare_matrix.outputs.github_ref}} \
--run_id ${{github.run_id}}
- name: Summarize results into GitHub log
run: python scripts/gha/summarize_test_results.py --dir test_results --github_log