Skip to content

Initial setup for starter and reuse workflow #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions .github/workflows/build_android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Workflow to handle building the Unity SDK on android
name: Build Android Reuse

on:
workflow_call:
inputs:
unity_version:
description: 'Unity version'
default: '2019'
required: true
firebase_cpp_sdk_version:
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout)'
default: ''
required: false
unity_branch:
description: 'Unity branch to build against, empty means current branch'
default: ''
apis:
description: 'CSV of apis to build and test'
default: 'analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
required: true
unity_platform_name:
description: 'The platform name Unity should install with'
default: ''
required: true
# Additional CMake flags to use
additional_cmake_flags:
description: 'Additional flags to pass into CMake'
default: ''
required: false

jobs:
build_android:
name: build-android-macos-unity${{ github.event.inputs.unity_version }}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
runs-on: macos-latest
strategy:
fail-fast: false
env:
# LC_ALL, LANG and U3D_PASSWORD are needed for U3D.
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
U3D_PASSWORD: ""
# Disable checking for U3D updates, since it is buggy
U3D_SKIP_UPDATE_CHECK: 1
CCACHE_DIR: ${{ github.workspace }}/ccache_dir

steps:
- name: Checkout Unity Repo
uses: actions/checkout@v2
with:
submodules: true
ref: ${{ github.event.inputs.unity_branch }}

- name: Checkout CPP Repo
uses: actions/checkout@v2
with:
repository: firebase/firebase-cpp-sdk
path: firebase-cpp-sdk
ref: ${{ github.event.inputs.firebase_cpp_sdk_version }}
submodules: true

- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6

- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.7'

- name: Install prerequisites
shell: bash
run: |
echo "FIREBASE_CPP_SDK_DIR=${{ github.workspace }}/firebase-cpp-sdk" >> $GITHUB_ENV
cd firebase-cpp-sdk
python scripts/gha/install_prereqs_desktop.py
build_scripts/android/install_prereqs.sh
cd ..

- name: Cache NDK
id: cache_ndk
uses: actions/cache@v2
with:
path: /tmp/android-ndk-r16b
key: android-ndk-${{ matrix.os }}-r16b

- name: Install Unity installer (U3D)
shell: bash
run: gem install u3d -v 1.2.3

- name: Install python deps
shell: bash
run: |
pip install -r scripts/gha/requirements.txt

- name: Install Unity
shell: bash
run: |
python scripts/gha/unity_installer.py --install --platforms ${{ github.event.inputs.unity_platform_name }} --version ${{ github.event.inputs.unity_version }}

- name: Setup Unity path
shell: bash
run: |
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{ github.event.inputs.unity_version }} -k unity_path )" >> $GITHUB_ENV

- name: Display Swig Version
shell: bash
run: |
swig -version

- name: Build SDK (Android)
shell: bash
run: |
python scripts/build_scripts/build_zips.py --platform=android --unity_root=$UNITY_ROOT_DIR --extra_cmakes=${{ github.event.inputs.additional_cmake_flags }}

- name: Upload Build
uses: actions/upload-artifact@v2
with:
name: android_unity
path: android_unity/*.zip
107 changes: 107 additions & 0 deletions .github/workflows/build_ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Workflow to handle building the Unity SDK on iOS
name: Build iOS Reuse

on:
workflow_call:
inputs:
unity_version:
description: 'Unity version'
default: '2019'
required: true
firebase_cpp_sdk_version:
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout)'
default: ''
required: false
unity_branch:
description: 'Unity branch to build against, empty means current branch'
default: ''
apis:
description: 'CSV of apis to build and test'
default: 'analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
required: true
unity_platform_name:
description: 'The platform name Unity should install with'
default: ''
required: true
# Additional CMake flags to use
additional_cmake_flags:
description: 'Additional flags to pass into CMake'
default: ''
required: false

jobs:
build_ios:
name: build-ios-macos-${{ github.event.inputs.unity_version }}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
runs-on: macos-12
strategy:
fail-fast: false

env:
# LC_ALL, LANG and U3D_PASSWORD are needed for U3D.
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
U3D_PASSWORD: ""
# Disable checking for U3D updates, since it is buggy
U3D_SKIP_UPDATE_CHECK: 1
xcodeVersion: "13.3.1"

steps:
- name: Checkout Unity Repo
uses: actions/checkout@v2
with:
submodules: true
ref: ${{ github.event.inputs.unity_branch }}

- name: Checkout CPP Repo
uses: actions/checkout@v2
with:
repository: firebase/firebase-cpp-sdk
path: firebase-cpp-sdk
ref: ${{ github.event.inputs.firebase_cpp_sdk_version }}
submodules: true

- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.7'

- name: setup Xcode version
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer

- name: Install prerequisites
shell: bash
run: |
echo "FIREBASE_CPP_SDK_DIR=${{ github.workspace }}/firebase-cpp-sdk" >> $GITHUB_ENV
cd firebase-cpp-sdk
python scripts/gha/install_prereqs_desktop.py
cd ..

- name: Install Unity installer (U3D)
shell: bash
run: gem install u3d -v 1.2.3

- name: Install python deps
shell: bash
run: |
pip install -r scripts/gha/requirements.txt

- name: Install Unity
shell: bash
run: |
python scripts/gha/unity_installer.py --install --platforms ${{ github.event.inputs.unity_platform_name }} --version ${{ github.event.inputs.unity_version }}

- name: Setup Unity path
shell: bash
run: |
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{ github.event.inputs.unity_version }} -k unity_path )" >> $GITHUB_ENV

- name: Build SDK (iOS)
shell: bash
run: |
python scripts/build_scripts/build_zips.py --platform=iOS --unity_root=$UNITY_ROOT_DIR --extra_cmakes=${{ github.event.inputs.additional_cmake_flags }}

- name: Upload Build
uses: actions/upload-artifact@v2
with:
name: ios_unity
path: ios_unity/*.zip
113 changes: 113 additions & 0 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Workflow to handle building the Unity SDK on linux
name: Build linux Reuse

on:
workflow_call:
inputs:
unity_version:
description: 'Unity version'
default: '2019'
required: true
firebase_cpp_sdk_version:
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout)'
default: ''
required: false
unity_branch:
description: 'Unity branch to build against, empty means current branch'
default: ''
apis:
description: 'CSV of apis to build and test'
default: 'analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
required: true
unity_platform_name:
description: 'The platform name Unity should install with'
default: ''
required: true
# Additional CMake flags to use
additional_cmake_flags:
description: 'Additional flags to pass into CMake'
default: ''
required: false

jobs:
build_desktop:
name: build-desktop-linux-${{matrix.unity_version}}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false

env:
# LC_ALL, LANG and U3D_PASSWORD are needed for U3D.
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
U3D_PASSWORD: ""
# Disable checking for U3D updates, since it is buggy
U3D_SKIP_UPDATE_CHECK: 1
steps:
- uses: actions/checkout@v2
with:
submodules: true
ref: ${{ github.event.inputs.unity_branch }}

- uses: actions/checkout@v2
with:
repository: firebase/firebase-cpp-sdk
path: firebase-cpp-sdk
submodules: true
ref: ${{ github.event.inputs.firebase_cpp_sdk_version }}

# Set up the requirements, and install Unity
# Ruby setup has to happen before python install and setup, to keep the absl config.
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.2

- name: Install Unity installer (U3D)
shell: bash
run: gem install u3d -v 1.2.3

- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.7'

- name: Install prerequisites
shell: bash
run: |
echo "FIREBASE_CPP_SDK_DIR=${{ github.workspace }}/firebase-cpp-sdk" >> $GITHUB_ENV
cd firebase-cpp-sdk
python scripts/gha/install_prereqs_desktop.py
cd ..

- name: Install python deps
shell: bash
run: |
pip install -r scripts/gha/requirements.txt

- name: Install OpenSSL (Linux)
run: |
sudo apt install openssl

- name: Install Unity
shell: bash
run: |
python scripts/gha/unity_installer.py --install --platforms ${{ github.event.inputs.unity_platform_name }} --version ${{ matrix.unity_version }}

- name: Setup Unity path
shell: bash
run: |
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{matrix.unity_version}} -k unity_path )" >> $GITHUB_ENV
echo "$(swig -swiglib)" >> $GITHUB_PATH
swig -swiglib
echo "SWIG_DIR=$(swig -swiglib)" >> $GITHUB_ENV

- name: Build SDK (Linux)
shell: bash
run: |
python scripts/build_scripts/build_zips.py --platform=linux --use_boringssl=true --unity_root=$UNITY_ROOT_DIR --extra_cmakes=${{ github.event.inputs.additional_cmake_flags }}

- name: Upload Build
uses: actions/upload-artifact@v2
with:
name: linux_unity
path: linux_unity/*.zip
Loading