Skip to content

Update Gradle versions to 7 #7045

Update Gradle versions to 7

Update Gradle versions to 7 #7045

Workflow file for this run

name: Desktop Builds
on:
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
inputs:
expanded_matrix:
description: 'Use an expanded matrix?'
default: '0'
required: true
env:
CCACHE_DIR: ${{ github.workspace }}/ccache_dir
GITHUB_TOKEN: ${{ github.token }}
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
prepare_matrix:
runs-on: ubuntu-20.04
outputs:
matrix_os: ${{ steps.export-result.outputs.matrix_os }}
matrix_build_type: ${{ steps.export-result.outputs.matrix_build_type }}
matrix_architecture: ${{ steps.export-result.outputs.matrix_architecture }}
matrix_msvc_runtime: ${{ steps.export-result.outputs.msvc_runtime }}
matrix_xcode_version: ${{ steps.export-result.outputs.xcode_version }}
matrix_python_version: ${{ steps.export-result.outputs.python_version }}
steps:
- uses: actions/checkout@v3
with:
submodules: false
- name: Use expanded matrix
if: github.event.inputs.expanded_matrix == '1'
run: |
echo "EXPANDED_MATRIX_PARAM=-e=1" >> $GITHUB_ENV
- id: export-result
run: |
echo "matrix_os=$( python scripts/gha/print_matrix_configuration.py -w desktop -k os ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
echo "matrix_build_type=$( python scripts/gha/print_matrix_configuration.py -w desktop -k build_type ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
echo "matrix_architecture=$( python scripts/gha/print_matrix_configuration.py -w desktop -k architecture ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
echo "msvc_runtime=$( python scripts/gha/print_matrix_configuration.py -w desktop -k msvc_runtime ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
echo "xcode_version=$( python scripts/gha/print_matrix_configuration.py -w desktop -k xcode_version ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
echo "python_version=$( python scripts/gha/print_matrix_configuration.py -w desktop -k python_version ${EXPANDED_MATRIX_PARAM})" >> $GITHUB_OUTPUT
build:
name: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.msvc_runtime}}
runs-on: ${{ matrix.os }}
needs: prepare_matrix
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.prepare_matrix.outputs.matrix_os) }}
build_type: ${{ fromJson(needs.prepare_matrix.outputs.matrix_build_type) }}
architecture: ${{ fromJson(needs.prepare_matrix.outputs.matrix_architecture) }}
msvc_runtime: ${{ fromJson(needs.prepare_matrix.outputs.matrix_msvc_runtime) }}
xcode_version: ${{ fromJson(needs.prepare_matrix.outputs.matrix_xcode_version) }}
python_version: ${{ fromJson(needs.prepare_matrix.outputs.matrix_python_version) }}
include:
# More Windows combinations are in the expanded matrix.
- os: windows-latest
build_type: "Release"
architecture: "x64"
msvc_runtime: "static"
- os: windows-latest
build_type: "Debug"
architecture: "x86"
msvc_runtime: "dynamic"
exclude:
# msvc_runtime excludes
- os: ubuntu-20.04
msvc_runtime: "dynamic"
- os: macos-13
msvc_runtime: "dynamic"
# architecture excluees
- os: macos-13
architecture: "x86"
# Xcode excludes -- allow only one on osx and linux
- os: ubuntu-20.04
xcode_version: "11.7"
- os: windows-latest
xcode_version: "11.7"
- os: ubuntu-20.04
xcode_version: "12.5.1"
- os: windows-latest
xcode_version: "12.5.1"
# arm64 is only for macos
- os: ubuntu-20.04
architecture: "arm64"
- os: windows-latest
architecture: "arm64"
# arm64 can't be built on Xcode 11
- xcode_version: "11.7"
architecture: "arm64"
steps:
- name: Store git credentials for all git commands
# Forces all git commands to use authenticated https, to prevent throttling.
shell: bash
run: |
git config --global credential.helper 'store --file /tmp/git-credentials'
echo 'https://${{ github.token }}@github.com' > /tmp/git-credentials
- name: Enable Git Long-paths Support
if: runner.os == 'Windows'
run: git config --system core.longpaths true
- name: Setup Xcode version (macos)
if: runner.os == 'macOS'
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer
- uses: actions/checkout@v3
with:
submodules: true
- name: Set env vars (ubuntu)
if: startsWith(matrix.os, 'ubuntu')
shell: bash
run: echo "VCPKG_SUFFIX=linux" >> $GITHUB_ENV
- name: Set env vars (macos)
if: startsWith(matrix.os, 'macos')
shell: bash
run: echo "VCPKG_SUFFIX=osx" >> $GITHUB_ENV
- name: Set env vars (windows)
if: startsWith(matrix.os, 'windows')
shell: bash
run: |
if [[ ${{matrix.msvc_runtime}} == "static" ]];
then echo "VCPKG_SUFFIX=windows-static" >> $GITHUB_ENV;
elif [[ ${{matrix.msvc_runtime}} == "dynamic" ]];
then echo "VCPKG_SUFFIX=windows-static-md" >> $GITHUB_ENV;
else
echo "Warning, could not resolve vcpkg suffix.";
fi
- name: Set env variables for subsequent steps (all)
shell: bash
run: |
echo "BUILD_TYPE: ${{ matrix.build_type }}"
echo "VCPKG_SUFFIX: ${{env.VCPKG_SUFFIX}}"
echo "VCPKG_RESPONSE_FILE=external/vcpkg_custom_data/response_files/${{ matrix.architecture }}-${{ env.VCPKG_SUFFIX }}.txt" >> $GITHUB_ENV
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.msvc_runtime }}" >> $GITHUB_ENV
if [[ '${{ matrix.sdk_platform }}' == 'darwin' ]]; then
# If Mac, also hash vcpkg cache on Xcode version.
echo "VCPKG_EXTRA_HASH=-xcode${{matrix.xcode_version}}" >> $GITHUB_ENV
fi
- name: Cache vcpkg C++ dependencies
id: cache_vcpkg
uses: actions/cache@v3
with:
path: external/vcpkg/installed
key: dev-vcpkg-${{ matrix.architecture }}-${{ env.VCPKG_SUFFIX }}-${{ matrix.msvc_runtime }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}${{ env.VCPKG_EXTRA_HASH }}
- name: Cache ccache files
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
id: cache_ccache
uses: actions/cache@v3
with:
path: ccache_dir
key: dev-test-ccache-${{ env.MATRIX_UNIQUE_NAME }}${{ env.VCPKG_EXTRA_HASH }}
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
architecture: 'x64'
- name: Install Desktop SDK prerequisites
uses: nick-invision/retry@v2
with:
timeout_minutes: 15
max_attempts: 3
command: |
python scripts/gha/install_prereqs_desktop.py --gha_build --arch '${{ matrix.architecture }}'
- name: Build SDK
shell: bash
run: |
python scripts/gha/build_desktop.py --build_tests --arch "${{ matrix.architecture }}" --config "${{ matrix.build_type }}" --msvc_runtime_library "${{ matrix.msvc_runtime }}" --gha_build
- name: Stats for ccache (mac and linux)
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
run: ccache -s
- name: Print built libraries
shell: bash
run: |
find build -name "*.lib"
find build -name "*.dll"
find build -name "*.dylib"
find build -name "*.a"
find build -name "*.so"
- name: Inspect firebase libraries for cpu arch and msvc runtime.
shell: bash
run: |
python scripts/gha/inspect_built_libraries.py build/
continue-on-error: true
- name: Prep crash support (linux)
# Ensures directory structure is in place to capture core files on Linux.
if: startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
echo '/tmp/cores/core.%E' | sudo tee /proc/sys/kernel/core_pattern
sudo mkdir -p /tmp/cores/
sudo rm -rf /tmp/cores/*
- name: Prep crash support (mac)
# Ensures no lingering crashes from the previous run.
if: startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos')
run: |
rm -rf ~/Library/Logs/DiagnosticReports/*
- name: Run unit tests (windows & macos)
# TODO: Enable tests for x86 once they are all working
if: (startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos')) && matrix.architecture != 'x86' && matrix.architecture != 'arm64'
env:
LANG: en_US
run: |
cd build
ctest --repeat until-pass:3 --output-on-failure
- name: Run unit tests (linux)
# Linux exists as its own standalone execution step in order to invoke
# platform-specific `ulimit` to enable crash collection. The ulimit
# command must be invoked in same shell instance of that runs the
# tests.
if: startsWith(matrix.os, 'ubuntu')
env:
LANG: en_US
run: |
ulimit -c unlimited
cd build
sudo ctest --repeat until-pass:3 --output-on-failure
- name: Prep bins for achive (linux)
# Copies all of the binary files into one directory for ease in
# archiving. Directory contents are then marked readable for the
# archive step.
if: failure() && startsWith(matrix.build_type, 'Debug') && ( startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') )
shell: bash
run: |
sudo rm -rf /tmp/bins/* || :
sudo mkdir -p /tmp/bins/
sudo rm -rf ./build/app/tests/firebase_test
sudo cp -f ./build/*/tests/firebase* /tmp/bins
sudo chmod -R +rwx /tmp/bins/* || :
- name: Prep crash data for archive (linux)
# Marks the contents of the core dump directory to be readable for the
# archiving step on linux.
shell: bash
if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'ubuntu')
run: |
sudo chmod -R +rwx /tmp/cores/* || :
- name: Prep crash data for archive (macos)
# Freshly made diagnostic reports are marked as readable for
# the archive step. Note: for some reason /tmp/cores doesn't survive
# long enough for archiving on mac, so prep the DiagnosticReports
# directory instead.
shell: bash
if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos')
run: |
sudo chmod -R +rwx ~/Library/Logs/DiagnosticReports/* || :
- name: Archive crashes and binaries (linux)
uses: actions/upload-artifact@v3
if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'ubuntu')
with:
name: crashes-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}
path: |
/tmp/cores/*
/tmp/bins/*
- name: Archive crashes (mac)
uses: actions/upload-artifact@v3
if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos')
with:
name: crashes-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}-${{ matrix.xcode_version }}
path: |
~/Library/Logs/DiagnosticReports/*
/tmp/bins/*
local_integration_tests:
### This job run firestore integration test on Linux Dekstop as required by firestore team.
### It's possible to add more apps here once integration tests are less flaky.
name: local-integration-tests-linux-openssl
needs: prepare_matrix
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
ref: ${{needs.check_and_prepare.outputs.github_ref}}
submodules: true
- name: Cache vcpkg C++ dependencies
id: cache_vcpkg
uses: actions/cache@v3
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: Cache ccache files
uses: actions/cache@v3
with:
path: ccache_dir
key: local-integration-tests-linux-openssl-ccache
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ fromJson(needs.prepare_matrix.outputs.matrix_python_version)[0] }}
- name: Prepare for integration tests
uses: nick-invision/retry@v2
with:
shell: bash
timeout_minutes: 15
max_attempts: 3
command: scripts/gha/install_test_workflow_prereqs.sh -p Desktop -a 'x64' -s 'openssl'
- name: Build integration tests
shell: bash
env:
CCACHE_DIR: ${{ github.workspace }}/ccache_dir
run: |
apis=$( python scripts/gha/print_matrix_configuration.py -c -w integration_tests -k apis -m=1 )
python scripts/gha/build_testapps.py --p Desktop \
--t ${apis} \
--output_directory "${{ github.workspace }}" \
--artifact_name "desktop-ubuntu-20.04-openssl" \
--noadd_timestamp \
--short_output_paths \
--cmake_flag=-DFIREBASE_QUICK_TEST=ON
- name: Summarize build results
if: ${{ !cancelled() }}
shell: bash
run: |
cat build-results-desktop-ubuntu-20.04-openssl.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi
- name: Set up Node (18)
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Setup Firestore Emulator
uses: nick-invision/retry@v2
with:
shell: bash
timeout_minutes: 5
max_attempts: 3
command: npm install -g firebase-tools
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Run Desktop integration tests
run: |
cp scripts/gha/integration_testing/google-services.json testapps-desktop-ubuntu-20.04-openssl/firestore/google-services.json
firebase emulators:exec --only firestore --project demo-example 'python scripts/gha/desktop_tester.py --testapp_dir testapps-desktop-ubuntu-20.04-openssl --logfile_name "desktop-ubuntu-20.04-openssl"'
env:
USE_FIRESTORE_EMULATOR: true
- name: Summarize test results
if: ${{ !cancelled() }}
shell: bash
run: |
cat testapps-desktop-ubuntu-20.04-openssl/test-results-desktop-ubuntu-20.04-openssl.log
if [[ "${{ job.status }}" != "success" ]]; then
exit 1
fi