FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update mobile dependencies - Fri Jul 31 2026 (#1900) · firebase/firebase-cpp-sdk@7ef76be · GitHub

CPP binary SDK packaging #4008

CPP binary SDK packaging

CPP binary SDK packaging #4008

Workflow file for this run

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
name: CPP binary SDK packaging
on:
push:
branches:
# Run a full packaging step any time a new branch is merged into main.
- main
schedule:
- cron: "0 8 * * *" # 8am UTC = 12am PST / 1am PDT
workflow_dispatch:
inputs:
preserveIntermediateArtifacts:
description: 'preserve intermediate artifacts?'
default: 0
verboseBuild:
description: 'verbose build?'
default: 0
skipIntegrationTests:
description: 'skip integration tests?'
default: 0
downloadPublicVersion:
description: 'public version # to test against'
downloadPreviousRun:
description: 'previous run # to test against'
use_expanded_matrix:
description: 'Use an expanded matrix?'
default: '0'
required: true
env:
# Packaging prerequisites
# Demumble version from March 22, 2022
demumbleVer: "df938e45c2b0e064fb5323d88b692d03b451d271"
# Use SHA256 for hashing files.
hashCommand: "sha256sum"
# Xcode version 26.2 is the version we build the SDK with.
# Our MacOS runners will use the version in /Applications/Xcode_${xcodeVersion}.app
xcodeVersion: "26.2"
# LLVM version with ARM MachO support has no version number yet.
llvmVer: "5f187f0afaad33013ba03454c4749d99b1362534"
GITHUB_TOKEN: ${{ github.token }}
permissions:
contents: read
jobs:
log_inputs:
name: log-inputs
runs-on: ubuntu-22.04
steps:
- name: log run inputs
run: |
if [[ -n "${GITHUB_EVENT_INPUTS_DOWNLOADPUBLICVERSION}" ]]; then
echo "::warning ::Downloading public SDK package from https://dl.google.com/firebase/sdk/cpp/firebase_cpp_sdk_${GITHUB_EVENT_INPUTS_DOWNLOADPUBLICVERSION}.zip"
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
env:
GITHUB_EVENT_INPUTS_DOWNLOADPUBLICVERSION: ${{ github.event.inputs.downloadPublicVersion }}
GITHUB_EVENT_INPUTS_DOWNLOADPREVIOUSRUN: ${{ github.event.inputs.downloadPreviousRun }}
- name: log if skipping integration tests
if: |
github.event.inputs.skipIntegrationTests != 0 && github.event.inputs.skipIntegrationTests != ''
run: echo "::warning ::Skipping integration tests."
- name: log if preserving intermediate artifacts
if: |
github.event.inputs.preserveIntermediateArtifacts != 0 && github.event.inputs.preserveIntermediateArtifacts != '' &&
github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == ''
run: echo "::warning ::Intermediate artifacts will be preserved."
- name: log if verbose build enabled
if: |
github.event.inputs.verboseBuild != 0 && github.event.inputs.verboseBuild != '' &&
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'
run: echo "::warning ::Expanded test matrix enabled."
build_tools:
name: build-tools-${{ matrix.tools_platform }}
runs-on: ${{ matrix.os }}
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
strategy:
matrix:
os: [ubuntu-22.04, macos-15]
include:
- os: ubuntu-22.04
tools_platform: linux
# Binutils 2.35.1 released Sep 19, 2020
binutils_version: "2.35.1"
- os: macos-15
tools_platform: darwin
# Binutils 2.35.1 released Sep 19, 2020
binutils_version: "2.35.1"
steps:
- uses: lukka/get-cmake@591817e96fcad43505fb4eae36172462abb3a42e # ratchet:lukka/get-cmake@latest
with:
cmakeVersion: "~3.31.0"
- name: setup Xcode version (macos)
if: runner.os == 'macOS'
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
- name: Setup python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: 3.9
- name: Fetch and build binutils
run: |
set +e
# Retry up to 10 times with fallback mirrors and fail on HTTP errors.
urls=(
"https://ftpmirror.gnu.org/binutils/binutils-${{ matrix.binutils_version }}.tar.xz"
"https://ftp.gnu.org/gnu/binutils/binutils-${{ matrix.binutils_version }}.tar.xz"
"https://mirrors.kernel.org/gnu/binutils/binutils-${{ matrix.binutils_version }}.tar.xz"
)
download_success=false
for retry in {1..10}; do
for url in "${urls[@]}"; do
rm -f binutils.tar.xz
echo "Attempting to download binutils from ${url} (attempt ${retry})..."
if curl -f -L --connect-timeout 30 --max-time 300 "${url}" --output binutils.tar.xz; then
download_success=true
break 2
fi
done
sleep 30
done
if [[ "${download_success}" != "true" ]]; then
echo "Failed to download binutils after multiple retries."
exit 5
fi
set -e
tar -xf binutils.tar.xz
mv ./binutils-${{ matrix.binutils_version }} ./binutils-src
mkdir /tmp/binutils-output
cd binutils-src
./configure --enable-targets=all --with-system-zlib --prefix=/tmp/binutils-output
make -j2
make install
cd -
mkdir -p packaging-tools
cp -af /tmp/binutils-output/bin/* packaging-tools
- name: Cache LLVM (Mac only)
if: matrix.tools_platform == 'darwin'
id: cache_llvm
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # ratchet:actions/cache@v3
with:
path: llvm-src/llvm/build/bin
key: llvm-bin-${{matrix.tools_platform}}-${{env.xcodeVersion}}-${{env.llvmVer}}
- name: Fetch LLVM source (Mac only)
# Only fetch LLVM if we don't already have binaries from the cache.
if: ${{ matrix.tools_platform == 'darwin' && !steps.cache_llvm.outputs.cache-hit }}
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
persist-credentials: true # zizmor: ignore[artipacked]
repository: llvm/llvm-project
path: llvm-src
ref: ${{ env.llvmVer }}
- name: Build LLVM (Mac only)
# Only build LLVM if we don't already have binaries from the cache.
if: ${{ matrix.tools_platform == 'darwin' && !steps.cache_llvm.outputs.cache-hit }}
run: |
mkdir llvm-src/llvm/build
cd llvm-src/llvm/build
cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release ..
cmake --build . -j 3 --target llvm-objcopy --target llvm-nm --target llvm-ar
- name: Package LLVM output (Mac only)
if: matrix.tools_platform == 'darwin'
run: |
mkdir -p packaging-tools
cp -af llvm-src/llvm/build/bin/* packaging-tools
- name: fetch demumble
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
persist-credentials: true # zizmor: ignore[artipacked]
repository: nico/demumble
path: demumble-src
ref: ${{ env.demumbleVer }}
- name: build demumble
run: |
cd demumble-src
cmake .
cmake --build .
python demumble_test.py
cd -
mkdir -p packaging-tools
cp -af demumble-src/demumble packaging-tools
- name: archive tools
run: |
cd packaging-tools
ls
tar -czhf ../packaging-tools.tgz .
- name: upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: packaging-tools-${{ matrix.tools_platform }}
path: packaging-tools.tgz
build_and_package_ios_tvos:
name: build-and-package-ios-tvos
runs-on: macos-15
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
steps:
- uses: lukka/get-cmake@591817e96fcad43505fb4eae36172462abb3a42e # ratchet:lukka/get-cmake@latest
with:
cmakeVersion: "~3.31.0"
- 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: setup Xcode version (macos)
if: runner.os == 'macOS'
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
- name: fetch SDK
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
persist-credentials: true # zizmor: ignore[artipacked]
path: sdk-src
- name: Setup python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: 3.9
- name: install prerequisites
run: sdk-src/build_scripts/ios/install_prereqs.sh
- name: build sdk
run: |
python sdk-src/scripts/gha/build_ios_tvos.py -b firebase-cpp-sdk-ios-tvos-build -s sdk-src
sdk-src/build_scripts/ios/package.sh firebase-cpp-sdk-ios-tvos-build firebase-cpp-sdk-ios-tvos-package
sdk-src/build_scripts/tvos/package.sh firebase-cpp-sdk-ios-tvos-build firebase-cpp-sdk-ios-tvos-package
cd firebase-cpp-sdk-ios-tvos-package
tar -czhf ../firebase-cpp-sdk-ios-tvos-package.tgz .
- name: Print built libraries
shell: bash
run: |
find firebase-cpp-sdk-*-build -name "*.lib"
find firebase-cpp-sdk-*-build -name "*.dll"
find firebase-cpp-sdk-*-build -name "*.dylib"
find firebase-cpp-sdk-*-build -name "*.a"
find firebase-cpp-sdk-*-build -name "*.so"
find firebase-cpp-sdk-*-build -name "*.framework"
- name: Print package contents
shell: bash
run: |
find firebase-cpp-sdk-*-package -type f
- name: upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: firebase-cpp-sdk-ios-tvos-package
path: firebase-cpp-sdk-ios-tvos-package.tgz
build_and_package_android:
name: build-and-package-android
runs-on: ubuntu-22.04
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
strategy:
fail-fast: false
steps:
- uses: lukka/get-cmake@591817e96fcad43505fb4eae36172462abb3a42e # ratchet:lukka/get-cmake@latest
with:
cmakeVersion: "~3.31.0"
- name: Force Java 11
shell: bash
run: echo "JAVA_HOME=${JAVA_HOME_11_X64}" >> $GITHUB_ENV
- name: fetch SDK
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
persist-credentials: true # zizmor: ignore[artipacked]
path: sdk-src
- 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: Cache NDK
id: cache_ndk
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # ratchet:actions/cache@v3
with:
path: /tmp/android-ndk-r21e
key: android-ndk-${{ runner.os }}-r21e
- name: install prerequisites
run: sdk-src/build_scripts/android/install_prereqs.sh
- name: build sdk
run: |
sdk-src/build_scripts/android/build.sh firebase-cpp-sdk-android-build sdk-src
sdk-src/build_scripts/android/package.sh firebase-cpp-sdk-android-build firebase-cpp-sdk-android-package
cd firebase-cpp-sdk-android-package
tar -czhf ../firebase-cpp-sdk-android-package.tgz .
- name: Print built libraries
shell: bash
run: |
find firebase-cpp-sdk-*-build -name "*.lib"
find firebase-cpp-sdk-*-build -name "*.dll"
find firebase-cpp-sdk-*-build -name "*.dylib"
find firebase-cpp-sdk-*-build -name "*.a"
find firebase-cpp-sdk-*-build -name "*.so"
find firebase-cpp-sdk-*-build -name "*.framework"
- name: Print package contents
shell: bash
run: |
find firebase-cpp-sdk-*-package -type f
- name: upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: firebase-cpp-sdk-android-package
path: firebase-cpp-sdk-android-package.tgz
build_desktop:
name: build-${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}
runs-on: ${{ matrix.os }}
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
strategy:
fail-fast: false
matrix:
os: [windows-2022, ubuntu-22.04, macos-15]
build_type: ["Release", "Debug"]
architecture: ["x64", "x86", "arm64"]
msvc_runtime: ["static", "dynamic"]
linux_abi: ["legacy", "c++11"]
python_version: [3.9]
include:
- os: windows-2022
vcpkg_triplet_suffix: "windows-static"
sdk_platform: "windows"
- os: windows-2022
msvc_runtime: "dynamic"
vcpkg_triplet_suffix: "windows-static-md"
sdk_platform: "windows"
- os: ubuntu-22.04
vcpkg_triplet_suffix: "linux"
additional_build_flags: ""
sdk_platform: "linux"
- os: macos-15
vcpkg_triplet_suffix: "osx"
additional_build_flags: "--target_format libraries"
sdk_platform: "darwin"
exclude:
- os: windows-2022
linux_abi: "c++11"
- os: macos-15
architecture: "x86"
- os: macos-15
msvc_runtime: "dynamic"
- os: macos-15
linux_abi: "c++11"
- os: macos-15
build_type: "Debug"
- os: ubuntu-22.04
msvc_runtime: "dynamic"
- os: ubuntu-22.04
build_type: "Debug"
- os: ubuntu-22.04
architecture: "arm64"
- os: windows-2022
architecture: "arm64"
steps:
- uses: lukka/get-cmake@591817e96fcad43505fb4eae36172462abb3a42e # ratchet:lukka/get-cmake@latest
with:
cmakeVersion: "~3.31.0"
- 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: setup Xcode version (macos)
if: runner.os == 'macOS'
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
persist-credentials: true # zizmor: ignore[artipacked]
submodules: true
- name: Set env variables for subsequent steps (all)
shell: bash
run: |
echo "VCPKG_RESPONSE_FILE=external/vcpkg_${{ matrix.vcpkg_triplet }}_response_file.txt" >> $GITHUB_ENV
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}" >> $GITHUB_ENV
echo "SDK_NAME=${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}" >> $GITHUB_ENV
if [[ '${{ matrix.sdk_platform }}' == 'darwin' ]]; then
# If Mac, also hash vcpkg cache on Xcode version.
echo "VCPKG_EXTRA_HASH=-xcode${{env.xcodeVersion}}" >> $GITHUB_ENV
fi
- name: Add msbuild to PATH (windows)
if: startsWith(matrix.os, 'windows')
uses: microsoft/setup-msbuild@34cfbaee7f672c76950673338facd8a73f637506 # ratchet:microsoft/setup-msbuild@v1.1
- name: Cache vcpkg C++ dependencies
id: cache_vcpkg
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # ratchet:actions/cache@v3
with:
path: external/vcpkg/installed
key: dev-vcpkg-${{ matrix.architecture }}-${{ matrix.vcpkg_triplet_suffix }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}-${{ 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@6f8efc29b200d32929f49075959781ed54ec270c # ratchet:actions/cache@v3
with:
path: ccache_dir
key: dev-test-ccache-${{ env.MATRIX_UNIQUE_NAME }}
- name: Setup python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Install Desktop SDK prerequisites
uses: nick-invision/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # ratchet:nick-invision/retry@v2
with:
timeout_minutes: 15
max_attempts: 3
command: |
python scripts/gha/install_prereqs_desktop.py --gha_build --arch '${{ matrix.architecture }}' --ssl boringssl
- name: Export verbose flag
shell: bash
run: |
verbose_flag=
if [[ -n "${GITHUB_EVENT_INPUTS_VERBOSEBUILD}" && "${GITHUB_EVENT_INPUTS_VERBOSEBUILD}" -ne 0 ]]; then
verbose_flag=--verbose
fi
echo "VERBOSE_FLAG=${verbose_flag}" >> $GITHUB_ENV
env:
GITHUB_EVENT_INPUTS_VERBOSEBUILD: ${{ github.event.inputs.verboseBuild }}
# Run the build in the host OS default shell since Windows can't handle long path names in bash.
- name: Build desktop SDK
run: |
python scripts/gha/build_desktop.py --arch "${{ matrix.architecture }}" --config "${{ matrix.build_type }}" --msvc_runtime_library "${{ matrix.msvc_runtime }}" --linux_abi "${{ matrix.linux_abi }}" --build_dir out-sdk ${VERBOSE_FLAG} ${{ matrix.additional_build_flags }} --gha_build
- name: Archive SDK
shell: bash
run: |
cd out-sdk
find .. -type f -print > src_file_list.txt
# Remove intermediate build files (.o and .obj) files to save space.
find . -type f -name '*.o' -or -name '*.obj' -print0 | xargs -0 rm -f --
tar -czhf ../firebase-cpp-sdk-${SDK_NAME}-build.tgz .
- name: Print built libraries
shell: bash
run: |
find out-* -name "*.lib"
find out-* -name "*.dll"
find out-* -name "*.dylib"
find out-* -name "*.a"
find out-* -name "*.so"
find out-* -name "*.framework"
- name: Inspect firebase libraries for cpu arch and msvc runtime.
shell: bash
run: |
python scripts/gha/inspect_built_libraries.py out-sdk/
continue-on-error: true
- name: upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: firebase-cpp-sdk-${{ env.SDK_NAME }}-build
path: firebase-cpp-sdk-${{ env.SDK_NAME }}-build.tgz
package_desktop:
name: package-${{ matrix.sdk_platform }}${{ matrix.suffix }}
runs-on: ${{ matrix.runs_on_platform }}
needs: [build_tools, build_desktop]
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
strategy:
fail-fast: false
matrix:
sdk_platform: [linux, darwin, windows]
suffix: ['']
runs_on_platform: [ubuntu-22.04]
include:
# Split windows packaging into multiple runners.
- sdk_platform: windows
suffix: '-x86-Release-static'
runs_on_platform: ubuntu-22.04
- sdk_platform: windows
suffix: '-x86-Release-dynamic'
runs_on_platform: ubuntu-22.04
- sdk_platform: windows
suffix: '-x64-Release-static'
runs_on_platform: ubuntu-22.04
- sdk_platform: windows
suffix: '-x64-Release-dynamic'
runs_on_platform: ubuntu-22.04
- sdk_platform: windows
suffix: '-x86-Debug-static'
runs_on_platform: ubuntu-22.04
- sdk_platform: windows
suffix: '-x86-Debug-dynamic'
runs_on_platform: ubuntu-22.04
- sdk_platform: windows
suffix: '-x64-Debug-static'
runs_on_platform: ubuntu-22.04
- sdk_platform: windows
suffix: '-x64-Debug-dynamic'
runs_on_platform: ubuntu-22.04
- sdk_platform: darwin
runs_on_platform: macos-15
exclude:
- sdk_platform: windows
suffix: ''
- sdk_platform: darwin
runs_on_platform: ubuntu-22.04
steps:
- name: setup Xcode version (macos)
if: runner.os == 'macOS'
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
- name: fetch SDK
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
persist-credentials: true # zizmor: ignore[artipacked]
path: sdk-src
- name: download packaging-tool artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # ratchet:actions/download-artifact@v4
with:
path: artifacts
pattern: packaging-tools-*
- name: download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # ratchet:actions/download-artifact@v4
with:
path: artifacts
pattern: firebase-cpp-sdk-*
- name: Setup python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: 3.9
- name: Install prerequisites
run: |
cd sdk-src
python scripts/gha/install_prereqs_desktop.py --ssl boringssl
cd ..
if [[ $(uname) == "Darwin"* ]]; then
brew install parallel
fi
- name: postprocess and package built SDK
run: |
mkdir -p bin
if [[ $(uname) == "Linux"* ]]; then
tools_platform=linux
else
tools_platform=darwin
fi
verbose_flag=
if [[ -n "${GITHUB_EVENT_INPUTS_VERBOSEBUILD}" && "${GITHUB_EVENT_INPUTS_VERBOSEBUILD}" -ne 0 ]]; then
verbose_flag=-v
fi
declare -a additional_flags
tar -xvzf artifacts/packaging-tools-${tools_platform}/packaging-tools.tgz -C bin
rm -rf artifacts/packaging-tools-*.tgz
chmod -R u+x bin
# To save space, delete any artifacts that we don't need for packaging.
for pkg in artifacts/firebase-cpp-sdk-*; do
if [[ "${pkg}" != "artifacts/firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}"* ]]; then
echo "Deleting unneeded artifact: ${pkg}"
rm -rf "${pkg}"
fi
done
for pkg in artifacts/firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}*-build/*.tgz; do
# determine the build variant based on the artifact filename
variant=$(sdk-src/build_scripts/desktop/get_variant.sh "${pkg}")
additional_flags=(${verbose_flag})
# Several build targets require explicitly-set binutils format to be passed
# to package.sh (and thus, to merge_libraries), or use LLVM binutils.
if [[ "${{ matrix.sdk_platform }}" == "darwin" ]]; then
# MacOS: use LLVM binutils for both X64 and ARM64
additional_flags+=(-L)
elif [[ "${{ matrix.sdk_platform }}" == "windows" && "${variant}" == *"/x64/"* ]]; then
# Windows x64: force input and output target format
additional_flags+=(-f pe-x86-64,pe-bigobj-x86-64)
elif [[ "${{ matrix.sdk_platform }}" == "windows" && "${variant}" == *"/x86/"* ]]; then
# Windows x86: force input and output target format
additional_flags+=(-f pe-i386,pe-bigobj-i386)
fi
sdk-src/build_scripts/desktop/package.sh -D -b ${pkg} -o firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}-package -p ${{ matrix.sdk_platform }} -t bin -d ${variant} -P python3 -j ${additional_flags[*]}
done
if [[ "${{ matrix.sdk_platform }}" == "darwin" ]]; then
# Darwin has a final step after all the variants are done,
# create universal libraries and frameworks.
sdk-src/build_scripts/other/package.sh sdk-src tmpdir_for_headers
sdk-src/build_scripts/desktop/finish_darwin.sh firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}-package tmpdir_for_headers/include bin
fi
cd firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}-package
tar -czhf ../firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}-package.tgz .
env:
GITHUB_EVENT_INPUTS_VERBOSEBUILD: ${{ github.event.inputs.verboseBuild }}
- name: Print package contents
shell: bash
run: |
find firebase-cpp-sdk-*-package -type f
- name: upload SDK zip
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix}}-package
path: firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix}}-package.tgz
- name: Check for unrenamed namespaces
shell: bash
run: |
set +e
if [[ "${{ matrix.sdk_platform }}" == "darwin" ]]; then
nm=bin/llvm-nm
elif [[ "${{ matrix.sdk_platform }}" == "windows" ]]; then
if [[ "${{ matrix.sdk_platform }}" == *"x64"* ]]; then
nm="bin/nm --target pe-x86-64"
else
nm="bin/nm --target pe-i386"
fi
else # sdk_platform = linux
nm=bin/nm
fi
${nm} `find firebase-cpp-sdk-*-package/libs/${{ matrix.sdk_platform }} -type f` | grep '^[0-9a-fA-F][0-9a-fA-F]* ' | cut -d' ' -f3- > raw_symbols.txt
if [[ "${{ matrix.sdk_platform }}" == "windows" ]]; then
cat raw_symbols.txt | sort | uniq | bin/demumble | grep '^[a-zA-Z_]*::' > cpp_symbols.txt
elif [[ "${{ matrix.sdk_platform }}" == "darwin" ]]; then
# remove leading _ on mach-o symbols
cat raw_symbols.txt | sort | uniq | sed 's/^_//' | bin/c++filt | grep '^[a-zA-Z_]*::' > cpp_symbols.txt
else # linux
cat raw_symbols.txt | sort | uniq | bin/c++filt | grep '^[a-zA-Z_]*::' > cpp_symbols.txt
fi
# cpp_symbols.txt contains a list of all C++ symbols, sorted and deduped
# get a list of all top-level namespaces (except system namespaces)
cat cpp_symbols.txt | cut -d: -f1 | sort | uniq > cpp_namespaces.txt
echo "List of all namespaces found:"
cat cpp_namespaces.txt
# Filter out renamed namespaces (f_b_*), standard namespaces, and the public namespace (firebase::).
# These are all specified in the respective scripts, package.sh and merge_libraries.py
echo $(sdk-src/build_scripts/desktop/package.sh -R)'.*' > allow_namespaces.txt
sdk-src/build_scripts/desktop/package.sh -N >> allow_namespaces.txt
python sdk-src/scripts/print_allowed_namespaces.py >> allow_namespaces.txt
allow_namespaces=$(cat allow_namespaces.txt | tr '\n' '|')
cat cpp_namespaces.txt | grep -vE "^(${allow_namespaces})$" > extra_namespaces.txt
# If there are any namespaces in this file, print an error.
if [[ -s extra_namespaces.txt ]]; then
echo '::error ::Unrenamed C++ namespaces in ${{ matrix.sdk_platform }}${{ matrix.suffix }} package:%0A'$(cat extra_namespaces.txt | tr '\n' ' ' | sed 's/ /%0A/g')
exit 1
fi
- name: cleanup build artifacts
if: |
(
(github.event.inputs.preserveIntermediateArtifacts == 0 || github.event.inputs.preserveIntermediateArtifacts == '')
&& github.event.inputs.downloadPublicVersion == ''
&& github.event.inputs.downloadPreviousRun == ''
)
# Remove the build artifacts that were consumed during this step of packaging.
uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # ratchet:geekyeggo/delete-artifact@v2
with:
name: |
firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}*-build
failOnError: false
useGlob: true
download_sdk_package:
name: download-sdk-package
runs-on: ubuntu-22.04
needs: [log_inputs]
if: ${{ github.event.inputs.downloadPublicVersion != '' || github.event.inputs.downloadPreviousRun != '' }}
steps:
- name: fetch artifact from previous run
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # ratchet:actions/download-artifact@v4
if: ${{ github.event.inputs.downloadPreviousRun != '' }}
with:
name: 'firebase_cpp_sdk.zip'
github-token: ${{ github.token }}
run-id: ${{ github.event.inputs.downloadPreviousRun }}
- name: fetch public SDK package from web
if: ${{ github.event.inputs.downloadPublicVersion != '' && github.event.inputs.downloadPreviousRun == '' }}
run: |
if [[ ! "${GITHUB_EVENT_INPUTS_DOWNLOADPUBLICVERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo Invalid version number: "${GITHUB_EVENT_INPUTS_DOWNLOADPUBLICVERSION}"
exit 1
fi
set +e
# Retry up to 10 times because Curl has a tendency to timeout on
# Github runners.
for retry in {1..10} error; do
if [[ $retry == "error" ]]; then exit 5; fi
rm -f firebase_cpp_sdk.zip
curl -f -L --connect-timeout 30 --max-time 300 https://dl.google.com/firebase/sdk/cpp/firebase_cpp_sdk_${GITHUB_EVENT_INPUTS_DOWNLOADPUBLICVERSION}.zip --output firebase_cpp_sdk.zip && break
sleep 30
done
set -e
env:
GITHUB_EVENT_INPUTS_DOWNLOADPUBLICVERSION: ${{ github.event.inputs.downloadPublicVersion }}
- name: compute SDK hash
shell: bash
run: |
${{ env.hashCommand }} --tag firebase_cpp_sdk.zip > firebase_cpp_sdk_hash.txt
echo "::warning ::$(cat firebase_cpp_sdk_hash.txt)"
- name: upload hash
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: firebase_cpp_sdk_hash.txt
path: firebase_cpp_sdk_hash.txt
- name: upload SDK zip
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: firebase_cpp_sdk.zip
path: firebase_cpp_sdk.zip
merge_packages:
name: final-merge-packages
runs-on: ubuntu-22.04
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
needs: [build_and_package_ios_tvos, build_and_package_android, package_desktop, log_inputs]
steps:
- name: fetch SDK
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
persist-credentials: true # zizmor: ignore[artipacked]
path: sdk-src
- name: download artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # ratchet:actions/download-artifact@v4
with:
path: artifacts
pattern: firebase-cpp-sdk-*-package
- name: merge SDK packages
shell: bash
run: |
set -ex
mkdir -p firebase-cpp-sdk-final/firebase_cpp_sdk
for pkg in artifacts/firebase-cpp-sdk-*-package/*.tgz; do
tar -xzf "${pkg}" -C firebase-cpp-sdk-final/firebase_cpp_sdk
done
# Add the final files.
sdk-src/build_scripts/other/package.sh sdk-src firebase-cpp-sdk-final/firebase_cpp_sdk
# Zip up the package and grab a hash of the result.
cd firebase-cpp-sdk-final
# Save the hash of every file into the SDK package.
find firebase_cpp_sdk -type f -print0 | xargs -0 ${{ env.hashCommand }} --tag > file_hashes.txt
mv file_hashes.txt firebase_cpp_sdk/
# Zip up the SDK package recursively, preserving symlinks.
zip -9 -r -y ../firebase_cpp_sdk.zip firebase_cpp_sdk
cd ..
- name: compute SDK hash
shell: bash
run: |
${{ env.hashCommand }} --tag firebase_cpp_sdk.zip > firebase_cpp_sdk_hash.txt
echo "::warning ::$(cat firebase_cpp_sdk_hash.txt)"
- name: Print final package contents
shell: bash
run: |
cd firebase-cpp-sdk-final
find firebase_cpp_sdk -type f
- name: upload hash
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: firebase_cpp_sdk_hash.txt
path: firebase_cpp_sdk_hash.txt
- name: upload SDK zip
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: firebase_cpp_sdk.zip
path: firebase_cpp_sdk.zip
create_windows_only_package:
name: create-windows-only-package
runs-on: ubuntu-22.04
needs: [merge_packages]
steps:
- name: download SDK zip
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # ratchet:actions/download-artifact@v4
with:
name: firebase_cpp_sdk.zip
- name: unzip SDK and remove non-Windows files
run: |
set -x
unzip -q firebase_cpp_sdk.zip -d windows-sdk
cd windows-sdk
# Rename the top-level directory.
mv firebase_cpp_sdk firebase_cpp_sdk_windows
cd firebase_cpp_sdk_windows
# Remove all non-Windows files.
rm -rf xcframeworks frameworks libs/linux libs/ios libs/tvos libs/darwin libs/android Android
cat > readme_windows.md <<EOF
# Firebase C++ SDK - Windows only
This package contains only the subset of the Firebase C++ SDK needed for use on
Windows. For general SDK information, see the accompanying readme.md file.
EOF
cd ..
zip -9 -r -y ../firebase_cpp_sdk_windows.zip firebase_cpp_sdk_windows
cd ..
- name: compute Windows SDK hash
shell: bash
run: |
${{ env.hashCommand }} --tag firebase_cpp_sdk_windows.zip > firebase_cpp_sdk_windows_hash.txt
echo "::warning ::$(cat firebase_cpp_sdk_windows_hash.txt)"
- name: upload Windows hash
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: firebase_cpp_sdk_windows_hash.txt
path: firebase_cpp_sdk_windows_hash.txt
- name: upload Windows SDK zip
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: firebase_cpp_sdk_windows.zip
path: firebase_cpp_sdk_windows.zip
cleanup_packaging_artifacts:
# Clean up intermediate artifacts from packaging step.
# This can happen after the final package merge is finished.
name: cleanup-packaging-artifacts
runs-on: ubuntu-22.04
needs: [merge_packages]
if: |
(
(github.event.inputs.preserveIntermediateArtifacts == 0 || github.event.inputs.preserveIntermediateArtifacts == '')
&& github.event.inputs.downloadPublicVersion == ''
&& github.event.inputs.downloadPreviousRun == ''
)
steps:
- uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # ratchet:geekyeggo/delete-artifact@v2
with:
name: |
packaging-tools-*
firebase-cpp-sdk-*-package
failOnError: false
useGlob: true
trigger_integration_tests:
# Trigger the integration_tests workflow.
needs: [merge_packages, download_sdk_package, create_windows_only_package, cleanup_packaging_artifacts]
if: (github.event.inputs.skipIntegrationTests == 0 || github.event.inputs.skipIntegrationTests == '') && !cancelled() && !failure()
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
persist-credentials: true # zizmor: ignore[artipacked]
- name: Setup python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: '3.9'
- name: Use expanded matrix
if: github.event_name == 'schedule' || github.event.inputs.use_expanded_matrix == '1'
run: |
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.
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # ratchet:actions/create-github-app-token@v1
id: generate-token
with:
client-id: ${{ secrets.WORKFLOW_TRIGGER_CLIENT_ID }}
private-key: ${{ secrets.WORKFLOW_TRIGGER_APP_PRIVATE_KEY }}
permission-actions: write
- name: Use GitHub API to start workflow
shell: bash
run: |
pip install -r scripts/gha/python_requirements.txt
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
if [[ "${{ github.event_name }}" == "schedule" ]]; then
# trigger integration tests and generate two reports for nightly workflow run: one for firestore, one for the rest.
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} \
-p apis "analytics,app_check,auth,database,functions,installations,messaging,remote_config,storage" \
-p test_pull_request nightly-packaging \
-s 10 \
-A ${verbose_flag}
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} \
-p apis "firestore" \
-p test_pull_request nightly-packaging \
-s 10 \
-A ${verbose_flag}
else
# trigger integration tests
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} \
-s 10 \
-A ${verbose_flag}
fi
env:
GITHUB_EVENT_INPUTS_VERBOSEBUILD: ${{ github.event.inputs.verboseBuild }}
STEPS_GENERATE_TOKEN_OUTPUTS_TOKEN: ${{ steps.generate-token.outputs.token }}
attempt_retry:
name: "attempt-retry"
needs: [trigger_integration_tests]
runs-on: ubuntu-22.04
if: ${{ failure() && !cancelled() && github.event_name == 'schedule' }}
steps:
- name: Checkout repo
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
persist-credentials: true # zizmor: ignore[artipacked]
- name: Setup python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: 3.9
- name: Install python deps
run: pip install -r scripts/gha/python_requirements.txt
# The default token can't run workflows, so get an alternate token.
- name: Generate token for GitHub API
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # ratchet:actions/create-github-app-token@v1
id: generate-token
with:
client-id: ${{ secrets.WORKFLOW_TRIGGER_CLIENT_ID }}
private-key: ${{ secrets.WORKFLOW_TRIGGER_APP_PRIVATE_KEY }}
permission-actions: write
- name: Retry failed tests
run: |
echo "::warning ::Attempting to retry failed jobs"
python scripts/gha/trigger_workflow.py -t ${STEPS_GENERATE_TOKEN_OUTPUTS_TOKEN} \
-w retry-test-failures.yml \
-p run_id ${{ github.run_id }} \
-s 10 \
-A
env:
STEPS_GENERATE_TOKEN_OUTPUTS_TOKEN: ${{ steps.generate-token.outputs.token }}

Back | FazBrowse Home | New Git URL