From 80a9f73249470efa0bb355e0bb2ac656b5ff89af Mon Sep 17 00:00:00 2001 From: anonymous-akorn <66133366+anonymous-akorn@users.noreply.github.com> Date: Fri, 31 Jul 2020 09:44:37 -0700 Subject: [PATCH 1/2] Add integration test workflow Most of this workflow is copied verbatim from the workflow to build the SDK. There are two new parts for the integration tests: - Manual dispatch with input parameters that can be specified when triggering. - Two new steps ('Prepare for integration tests' and 'Build and run integration tests'). --- .github/workflows/integration_tests.yml | 91 +++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/integration_tests.yml diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml new file mode 100644 index 0000000000..7dedcd9196 --- /dev/null +++ b/.github/workflows/integration_tests.yml @@ -0,0 +1,91 @@ +name: Integration tests + +on: + workflow_dispatch: + inputs: + platforms: + description: 'CSV of Desktop, Android and/or iOS' + default: 'Desktop' + required: true + apis: + description: 'CSV of apis to build and test' + default: 'admob,analytics,auth,database,dynamic_links,firestore,functions,instance_id,messaging,remote_config,storage' + required: true + operating_systems: + description: 'JSON list of VMs to run on' + default: '["ubuntu-latest","windows-latest","macos-latest"]' + required: true + +env: + CCACHE_DIR: ${{ github.workspace }}/ccache_dir + +jobs: + build: + name: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(github.event.inputs.operating_systems) }} + build_type: ["Debug"] + architecture: ["x64",] + python_version: [3.7] + include: + - os: windows-latest + architecture: "x64" + vcpkg_triplet: "x64-windows-static" + msbuild_platform: "x64" + - os: ubuntu-latest + architecture: "x64" + vcpkg_triplet: "x64-linux" + - os: macos-latest + architecture: "x64" + vcpkg_triplet: "x64-osx" + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Set env variables for subsequent steps (all) + run: | + echo "::set-env name=VCPKG_RESPONSE_FILE::external/vcpkg_${{ matrix.vcpkg_triplet }}_response_file.txt" + echo "::set-env name=MATRIX_UNIQUE_NAME::${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}" + - name: Cache vcpkg C++ dependencies + id: cache_vcpkg + uses: actions/cache@v2 + with: + path: external/vcpkg/installed + key: dev-vcpkg-${{ matrix.vcpkg_triplet }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }} + + - name: Cache ccache files + if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') + id: cache_ccache + uses: actions/cache@v2 + with: + path: ccache_dir + key: dev-test-ccache-${{ env.MATRIX_UNIQUE_NAME }} + + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python_version }} + architecture: ${{ matrix.architecture }} + + - name: Install SDK prerequisites + run: | + python scripts/gha/install_prereqs_desktop.py + + - name: Prepare for integration tests + run: | + pip install -r testing/integration_testing/requirements.txt + python testing/integration_testing/restore_secrets.py --passphrase ${{ secrets.TEST_SECRET }} + + - name: Build and run integration tests + run: | + python testing/integration_testing/build_testapps.py \ + --testapps ${{ github.event.inputs.apis }} \ + --platforms ${{ github.event.inputs.platforms }} \ + --output_directory ${{ github.workspace }} \ + --execute_desktop_testapp \ + --noadd_timestamp From 3fe91bb76da28872d03ffd1e5020f97ad9ca9fe3 Mon Sep 17 00:00:00 2001 From: anonymous-akorn <66133366+anonymous-akorn@users.noreply.github.com> Date: Fri, 31 Jul 2020 14:47:26 -0700 Subject: [PATCH 2/2] Use simple CSV format for OS input, not JSON Instead of specifying the operating system input as a JSON, this will take a normal CSV string. A separate job, prepare_matrix, will run before the tests to convert the CSV to a JSON list. The conversion is done by using sed to replace a comma with a quoted comma, and then inserting that value into ["$(new_value)"] using command substitution. --- .github/workflows/integration_tests.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 7dedcd9196..7768d8376b 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -12,21 +12,34 @@ on: default: 'admob,analytics,auth,database,dynamic_links,firestore,functions,instance_id,messaging,remote_config,storage' required: true operating_systems: - description: 'JSON list of VMs to run on' - default: '["ubuntu-latest","windows-latest","macos-latest"]' + description: 'CSV of VMs to run on' + default: 'ubuntu-latest,windows-latest,macos-latest' required: true env: CCACHE_DIR: ${{ github.workspace }}/ccache_dir jobs: - build: + # To feed the operating systems 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 + outputs: + matrix_os: ${{ steps.set-matrix-os.outputs.matrix_os }} + steps: + - id: set-matrix-os + # e.g. 'ubuntu-latest,macos-latest' -> '["ubuntu-latest","macos-latest"]' + run: | + OS_JSON=[\"$(echo ${{ github.event.inputs.operating_systems }} | sed 's/,/","/g')\"] + echo "::set-output name=matrix_os::${OS_JSON}" + tests: name: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }} + needs: prepare_matrix runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: ${{ fromJson(github.event.inputs.operating_systems) }} + os: ${{ fromJson(needs.prepare_matrix.outputs.matrix_os) }} build_type: ["Debug"] architecture: ["x64",] python_version: [3.7]