Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into TransactionOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
dconeybe committed Jul 6, 2022
2 parents c0c1a80 + e1a21a8 commit 75497f2
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 133 deletions.
42 changes: 32 additions & 10 deletions .github/workflows/build_starter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ on:
default: ''
required: false
platforms:
description: 'CSV of Android,iOS,Windows,macOS,Linux'
default: 'Android,iOS,Windows,macOS,Linux'
description: 'Test Platforms of Android,iOS,Windows,macOS,Linux,Playmode'
default: 'Android,iOS,Windows,macOS,Linux,Playmode'
required: true
apis:
description: 'CSV of apis to build and test'
Expand All @@ -50,9 +50,9 @@ on:
default: true
type: boolean
required: true
skipIntegrationTests:
description: 'If we want to skip integration test'
default: '0'
runIntegrationTests:
description: 'run integration tests? (0 will not run integrations)'
default: '1'
required: true

env:
Expand All @@ -68,7 +68,7 @@ jobs:
apis: ${{ steps.set_outputs.outputs.apis }}
release_version: ${{ steps.set_outputs.outputs.release_version }}
should_trigger_package: ${{ steps.set_outputs.outputs.should_trigger_package }}
skipIntegrationTests: ${{ steps.set_outputs.outputs.skipIntegrationTests }}
runIntegrationTests: ${{ steps.set_outputs.outputs.runIntegrationTests }}
firebase_cpp_sdk_version: ${{ steps.set_outputs.outputs.firebase_cpp_sdk_version }}
unity_branch: ${{ steps.set_outputs.outputs.unity_branch }}
additional_cmake_flags: ${{ steps.set_outputs.outputs.additional_cmake_flags }}
Expand All @@ -94,7 +94,7 @@ jobs:
echo "::set-output name=apis::${{ github.event.inputs.apis }}"
echo "::set-output name=unity_version::${{ github.event.inputs.unity_version }}"
echo "::set-output name=should_trigger_package::${{ github.event.inputs.should_trigger_package }}"
echo "::set-output name=skipIntegrationTests::${{ github.event.inputs.skipIntegrationTests }}"
echo "::set-output name=runIntegrationTests::${{ github.event.inputs.runIntegrationTests }}"
echo "::set-output name=unity_branch::${{ github.event.inputs.unity_branch }}"
echo "::set-output name=additional_cmake_flags::${{ github.event.inputs.unity_branch }}"
else
Expand All @@ -104,11 +104,33 @@ jobs:
echo "::set-output name=apis::'analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'"
echo "::set-output name=unity_version::2019"
echo "::set-output name=should_trigger_package::true"
echo "::set-output name=skipIntegrationTests::0"
echo "::set-output name=firebase_cpp_sdk_version::"
echo "::set-output name=unity_branch::"
echo "::set-output name=additional_cmake_flags::"
if [[ "${{ github.event_name }}" == "schedule" ]]; then
echo "::set-output name=runIntegrationTests::nightly-packaging"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "tests-requested: quick" ]]; then
echo "::set-output name=runIntegrationTests::${{ github.event.pull_request.number }}:label-quick-packaging"
elif [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "tests-requested: full" ]]; then
echo "::set-output name=runIntegrationTests::${{ github.event.pull_request.number }}:label-full-packaging"
elif [[ "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged == true}}" == "true" ]]; then
echo "::set-output name=runIntegrationTests::${{ github.event.pull_request.number }}:pr-close-packaging"
else
echo "::set-output name=invalid_trigger::1"
fi
else
echo "::set-output name=invalid_trigger::1"
fi
fi
- name: Cancel workflow
if: ${{ steps.set_outputs.outputs.invalid_trigger }}
uses: andymckay/cancel-action@0.2
- name: Wait for workflow cancellation
if: ${{ steps.set_outputs.outputs.invalid_trigger }}
run: |
sleep 300
exit 1 # fail out if the cancellation above somehow failed.
- name: Print output
run: |
Expand All @@ -118,7 +140,7 @@ jobs:
echo outputs.apis : ${{ steps.set_outputs.outputs.apis }}
echo outputs.unity_version : ${{ steps.set_outputs.outputs.unity_version }}
echo outputs.should_trigger_package : ${{ steps.set_outputs.outputs.should_trigger_package }}
echo outputs.skipIntegrationTests : ${{ steps.set_outputs.outputs.skipIntegrationTests }}
echo outputs.runIntegrationTests : ${{ steps.set_outputs.outputs.runIntegrationTests }}
echo outputs.firebase_cpp_sdk_version : ${{ steps.set_outputs.outputs.firebase_cpp_sdk_version }}
echo outputs.unity_branch : ${{ steps.set_outputs.outputs.unity_branch }}
echo outputs.additional_cmake_flags : ${{ steps.set_outputs.outputs.additional_cmake_flags }}
Expand Down Expand Up @@ -222,7 +244,7 @@ jobs:
if: (needs.check_and_prepare.outputs.should_trigger_package == 'true') && !cancelled() && !failure()
with:
release_label: ${{ needs.check_and_prepare.outputs.release_label }}
skipIntegrationTests: ${{ needs.check_and_prepare.outputs.skipIntegrationTests }}
runIntegrationTests: ${{ needs.check_and_prepare.outputs.runIntegrationTests }}
build_run_id: ${{ github.run_id }}
working_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
platforms: ${{ needs.check_and_prepare.outputs.platform }}
Expand Down
106 changes: 44 additions & 62 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Integration tests

on:
schedule:
- cron: "0 9 * * *" # 9am UTC = 1am PST / 2am PDT

pull_request:
types: [ labeled, closed ]

workflow_dispatch:
inputs:
Expand Down Expand Up @@ -75,66 +70,53 @@ jobs:
### trigger value: manual_trigger, scheduled_trigger, label_trigger, postsubmit_trigger
- id: set_outputs
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ "${{ github.event.inputs.test_pull_request }}" != "nightly-packaging" ]]; then
# Triggered manually
echo "::set-output name=trigger::manual_trigger"
if [[ "${{ github.event.inputs.use_expanded_matrix }}" == "1" ]]; then
echo "::set-output name=requested_tests::expanded"
fi
if [[ -z "${{github.event.inputs.test_pull_request}}" ]]; then
# test_pull_request not specified
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=github_ref::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f2)"
echo "::set-output name=pr_number::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f1)"
else
# Just the PR specified, use refs/pull/<number>/merge as the ref.
echo "::set-output name=github_ref::refs/pull/${{github.event.inputs.test_pull_request}}/merge"
echo "::set-output name=pr_number::${{ github.event.inputs.test_pull_request }}"
fi
elif [[ "${{ github.event.inputs.test_pull_request }}" == "nightly-packaging" ]]; then
# Triggered by scheduled packaging SDK workflow.
echo "::set-output name=trigger::scheduled_trigger"
echo "::set-output name=github_ref::$GITHUB_SHA"
echo "::set-output name=requested_tests::expanded"
fi
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
if [[ "${{ github.event.inputs.test_pull_request }}" == *"label-quick-packaging" ]]; then
# Triggered by build_starter SDK workflow.
echo "::set-output name=trigger::label_trigger"
echo "::set-output name=requested_tests::auto"
echo "::set-output name=github_ref::${{github.sha}}"
echo "::set-output name=pr_number::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f1)"
elif [[ "${{ github.event.inputs.test_pull_request }}" == *"label-full-packaging" ]]; then
# Triggered by build_starter SDK workflow.
echo "::set-output name=trigger::label_trigger"
echo "::set-output name=requested_tests::expanded"
echo "::set-output name=github_ref::${{github.sha}}"
echo "::set-output name=pr_number::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f1)"
elif [[ "${{ github.event.inputs.test_pull_request }}" == *"pr-close-packaging" ]]; then
# Triggered by build_starter SDK workflow.
echo "::set-output name=trigger::postsubmit_trigger"
echo "::set-output name=requested_tests::auto"
echo "::set-output name=github_ref::${{github.sha}}"
echo "::set-output name=pr_number::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f1)"
elif [[ "${{ github.event.inputs.test_pull_request }}" == "nightly-packaging" ]]; then
# Triggered by build_starter SDK workflow.
echo "::set-output name=trigger::scheduled_trigger"
echo "::set-output name=github_ref::$GITHUB_SHA"
echo "::set-output name=requested_tests::expanded"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "::set-output name=github_ref::$GITHUB_SHA"
if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "${{ env.triggerLabelPrefix }}"* ]]; then
echo "::set-output name=trigger::label_trigger"
echo "::set-output name=pr_number::${{ github.event.pull_request.number }}"
if [[ "${{ github.event.label.name }}" == "${{ env.triggerLabelQuick }}" ]]; then
echo "::set-output name=requested_tests::auto"
else
echo "::set-output name=requested_tests::expanded"
fi
elif [[ "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged == true}}" == "true" ]]; then
echo "::set-output name=trigger::postsubmit_trigger"
echo "::set-output name=pr_number::${{ github.event.pull_request.number }}"
echo "::set-output name=requested_tests::auto"
echo "::set-output name=github_ref::${{github.sha}}"
elif [[ "${{ github.event.inputs.test_pull_request }}" == "1" ]]; then
# Triggered by build_starter SDK workflow.
echo "::set-output name=trigger::manual_trigger"
echo "::set-output name=requested_tests::auto"
echo "::set-output name=github_ref::${{github.sha}}"
else
# Triggered manually
echo "::set-output name=trigger::manual_trigger"
if [[ "${{ github.event.inputs.use_expanded_matrix }}" == "1" ]]; then
echo "::set-output name=requested_tests::expanded"
fi
if [[ -z "${{github.event.inputs.test_pull_request}}" ]]; then
# test_pull_request not specified
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=github_ref::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f2)"
echo "::set-output name=pr_number::$(echo ${{ github.event.inputs.test_pull_request }} | cut -d: -f1)"
else
# Just the PR specified, use refs/pull/<number>/merge as the ref.
echo "::set-output name=github_ref::refs/pull/${{github.event.inputs.test_pull_request}}/merge"
echo "::set-output name=pr_number::${{ github.event.inputs.test_pull_request }}"
fi
fi
### If it's not a defined trigger, cancel workflow
### e.g. Triggered by non-"test-request" label; triggered by not merged PR close event.
- name: Cancel workflow
if: ${{ !steps.set_outputs.outputs.trigger }}
uses: andymckay/cancel-action@0.2
- name: Wait for workflow cancellation
if: ${{ !steps.set_outputs.outputs.trigger }}
run: |
sleep 300
exit 1 # fail out if the cancellation above somehow failed.
- name: Cancel previous runs on the same PR
if: steps.set_outputs.outputs.trigger == 'label_trigger'
uses: styfle/cancel-workflow-action@0.8.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
ref: ${{steps.set_outputs.outputs.github_ref}}
Expand Down Expand Up @@ -262,7 +244,7 @@ jobs:
workflow: 'build_starter.yml'
run_id: ${{ github.event.inputs.packaged_sdk_run_id }}
- name: Build integration tests
timeout-minutes: 180
timeout-minutes: 240
shell: bash
run: |
unzip -q firebase_unity_sdk.zip -d ~/Downloads/
Expand Down
Loading

0 comments on commit 75497f2

Please sign in to comment.