- Notifications
You must be signed in to change notification settings - Fork 126
Allow integration_tests workflow to run against a packaged SDK. #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 35 commits
eeac015 7f43aee 21e6056 a77519c 9fb9828 376a030 396c771 832a0ad eb59281 8d0c33d d7d62c2 eda4ca2 45e600f e9e084d 8b01deb e61ab07 1b6120e 61804ce 8f556c5 e95eddd 0f31057 88749a9 15f91f1 fe0c76b 325861d ed650cc 6cddf78 a61c107 ed1e211 899fd94 9bc4f5c 6751c3e de10022 c9f8b89 cabd4a5 262bfb4 0f7e19c 5e69207 4d1fe0d 68e4b72 6c58ab4 e810cd0 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -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 | ||
| | @@ -39,26 +37,9 @@ env: | |
| xcodeVersion: "12" | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can remove this env now. Contributor Author There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code | ||
| | ||
| 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}" | ||
| | ||
DellaBitta marked this conversation as resolved. Show resolved Hide resolved | ||
| log_inputs: | ||
| name: log-inputs | ||
| runs-on: ubuntu-latest | ||
| needs: prepare_matrix | ||
| steps: | ||
| - name: log run inputs | ||
| run: | | ||
| | @@ -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: | | ||
| | @@ -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' | ||
DellaBitta marked this conversation as resolved. Show resolved Hide resolved | ||
| 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: | ||
| | @@ -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) | ||
| | @@ -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 | ||
| | @@ -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 | ||
| | @@ -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 | ||
| | @@ -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 | ||
| | @@ -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 | ||
| | @@ -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 | ||
| | @@ -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 | ||
| | @@ -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. | ||
DellaBitta marked this conversation as resolved. Show resolved Hide resolved | ||
| 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} | ||
Uh oh!
There was an error while loading. Please reload this page.