Skip to content
140 changes: 108 additions & 32 deletions .github/workflows/cpp-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,40 +59,116 @@ jobs:
matrix:
architecture: [arm64, x86_64]
steps:
- name: fetch SDK
uses: actions/checkout@v2.3.1
with:
path: sdk-src
ref: ${{ github.event.inputs.commitId }}
- name: install prerequisites
run: sdk-src/build_scripts/ios/install_prereqs.sh
- name: build sdk
run: |
sdk-src/build_scripts/ios/build.sh firebase-cpp-sdk-ios-${{ matrix.architecture }} sdk-src ${{ matrix.architecture }}
tar -czf firebase-cpp-sdk-ios-${{ matrix.architecture }}.tgz firebase-cpp-sdk-ios-${{ matrix.architecture }}
- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: firebase-cpp-sdk-ios-${{ matrix.architecture }}
path: firebase-cpp-sdk-ios-${{ matrix.architecture }}.tgz
- name: fetch SDK
uses: actions/checkout@v2.3.1
with:
path: sdk-src
ref: ${{ github.event.inputs.commitId }}
- name: install prerequisites
run: sdk-src/build_scripts/ios/install_prereqs.sh
- name: build sdk
run: |
sdk-src/build_scripts/ios/build.sh firebase-cpp-sdk-ios-${{ matrix.architecture }} sdk-src ${{ matrix.architecture }}
tar -czf firebase-cpp-sdk-ios-${{ matrix.architecture }}.tgz firebase-cpp-sdk-ios-${{ matrix.architecture }}
- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: firebase-cpp-sdk-ios-${{ matrix.architecture }}
path: firebase-cpp-sdk-ios-${{ matrix.architecture }}.tgz

build_android:
name: build-sdk-android
runs-on: ubuntu-latest
steps:
- name: fetch SDK
uses: actions/checkout@v2.3.1
with:
path: sdk-src
ref: ${{ github.event.inputs.commitId }}
- 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 sdk-src
tar -czf firebase-cpp-sdk-android.tgz firebase-cpp-sdk-android
- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: firebase-cpp-sdk-android
path: firebase-cpp-sdk-android.tgz
- name: fetch SDK
uses: actions/checkout@v2.3.1
with:
path: sdk-src
ref: ${{ github.event.inputs.commitId }}
- 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 sdk-src
tar -czf firebase-cpp-sdk-android.tgz firebase-cpp-sdk-android
- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: firebase-cpp-sdk-android
path: firebase-cpp-sdk-android.tgz

build_desktop:
name: build-sdk-desktop-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
build_type: ["Release", "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
ref: ${{ github.event.inputs.commitId }}

- 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 }}"
echo "::set-env name=SDK_NAME::${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}"

- 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 prerequisites
run: |
python scripts/gha/install_prereqs_desktop.py

- name: Build SDK
run: |
python scripts/gha/build_desktop.py --arch "${{ matrix.architecture }}" --config "${{ matrix.build_type }}" --build_dir firebase-cpp-sdk-${{ env.SDK_NAME }}
tar -czf firebase-cpp-sdk-${{ env.SDK_NAME }}.tgz firebase-cpp-sdk-${{ env.SDK_NAME }}

- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: firebase-cpp-sdk-${{ env.SDK_NAME }}
path: firebase-cpp-sdk-${{ env.SDK_NAME }}.tgz

- name: Stats for ccache (mac and linux)
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
run: ccache -s


8 changes: 4 additions & 4 deletions build_scripts/android/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -ex

buildpath=$1
sourcepath=$2
Expand All @@ -19,6 +19,7 @@ if [[ -n $(ls) ]]; then
echo "Error: build path '${buildpath}' not empty."
exit 2
fi
absbuildpath=$( pwd -P )
cd -

# If NDK_ROOT is not set or is the wrong version, use to the version in /tmp.
Expand Down Expand Up @@ -55,12 +56,11 @@ set -x

if [[ $(uname) == "Linux" ]] || [[ $(uname) == "Darwin" ]]; then
# Turn buildpath into an absolute path for use later with rsync.
buildpath=$( cd "${buildpath}" ; pwd -P )
# Use rsync to copy the relevent paths to the destination directory.
rsync -aR "${paths[@]}" "${buildpath}/"
rsync -aR "${paths[@]}" "${absbuildpath}/"
else
# rsync has to be specifically installed on windows bash (including github runners)
# Also, rsync with absolute destination path doesn't work on Windows.
# Using a simple copy instead of rsync on Windows.
cp -R --parents "${paths[@]}" "${buildpath}"
cp -R --parents "${paths[@]}" "${absbuildpath}"
fi
2 changes: 1 addition & 1 deletion build_scripts/ios/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -ex

buildpath=$1
sourcepath=$2
Expand Down