Skip to content

Commit f04a4a8

Browse files
authored
Make one workflow able to build 5 platforms with reuse workflow (#315)
build workflow for 5 platforms
1 parent c93a6a0 commit f04a4a8

File tree

7 files changed

+169
-109
lines changed

7 files changed

+169
-109
lines changed

.github/workflows/build_android.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,36 @@ on:
88
description: 'Unity version'
99
default: '2019'
1010
required: true
11+
type: string
1112
firebase_cpp_sdk_version:
1213
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout)'
1314
default: ''
1415
required: false
16+
type: string
1517
unity_branch:
1618
description: 'Unity branch to build against, empty means current branch'
1719
default: ''
20+
type: string
1821
apis:
1922
description: 'CSV of apis to build and test'
2023
default: 'analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
2124
required: true
25+
type: string
2226
unity_platform_name:
2327
description: 'The platform name Unity should install with'
2428
default: ''
2529
required: true
30+
type: string
2631
# Additional CMake flags to use
2732
additional_cmake_flags:
2833
description: 'Additional flags to pass into CMake'
2934
default: ''
3035
required: false
36+
type: string
3137

3238
jobs:
3339
build_android:
34-
name: build-android-macos-unity${{ github.event.inputs.unity_version }}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
40+
name: build-android-unity${{ inputs.unity_version }}-CPP${{ inputs.firebase_cpp_sdk_version }}
3541
runs-on: macos-latest
3642
strategy:
3743
fail-fast: false
@@ -49,14 +55,14 @@ jobs:
4955
uses: actions/checkout@v2
5056
with:
5157
submodules: true
52-
ref: ${{ github.event.inputs.unity_branch }}
58+
ref: ${{ inputs.unity_branch }}
5359

5460
- name: Checkout CPP Repo
5561
uses: actions/checkout@v2
5662
with:
5763
repository: firebase/firebase-cpp-sdk
5864
path: firebase-cpp-sdk
59-
ref: ${{ github.event.inputs.firebase_cpp_sdk_version }}
65+
ref: ${{ inputs.firebase_cpp_sdk_version }}
6066
submodules: true
6167

6268
- uses: ruby/setup-ruby@v1
@@ -96,12 +102,12 @@ jobs:
96102
- name: Install Unity
97103
shell: bash
98104
run: |
99-
python scripts/gha/unity_installer.py --install --platforms ${{ github.event.inputs.unity_platform_name }} --version ${{ github.event.inputs.unity_version }}
105+
python scripts/gha/unity_installer.py --install --platforms ${{ inputs.unity_platform_name }} --version ${{ inputs.unity_version }}
100106
101107
- name: Setup Unity path
102108
shell: bash
103109
run: |
104-
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{ github.event.inputs.unity_version }} -k unity_path )" >> $GITHUB_ENV
110+
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{ inputs.unity_version }} -k unity_path )" >> $GITHUB_ENV
105111
106112
- name: Display Swig Version
107113
shell: bash
@@ -111,7 +117,8 @@ jobs:
111117
- name: Build SDK (Android)
112118
shell: bash
113119
run: |
114-
python scripts/build_scripts/build_zips.py --platform=android --unity_root=$UNITY_ROOT_DIR --extra_cmakes=${{ github.event.inputs.additional_cmake_flags }}
120+
# TODO add handling cmake_extras
121+
python scripts/build_scripts/build_zips.py --platform=android --unity_root=$UNITY_ROOT_DIR --apis=${{ inputs.apis }}
115122
116123
- name: Upload Build
117124
uses: actions/upload-artifact@v2

.github/workflows/build_ios.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,36 @@ on:
88
description: 'Unity version'
99
default: '2019'
1010
required: true
11+
type: string
1112
firebase_cpp_sdk_version:
1213
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout)'
1314
default: ''
1415
required: false
16+
type: string
1517
unity_branch:
1618
description: 'Unity branch to build against, empty means current branch'
1719
default: ''
20+
type: string
1821
apis:
1922
description: 'CSV of apis to build and test'
2023
default: 'analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
2124
required: true
25+
type: string
2226
unity_platform_name:
2327
description: 'The platform name Unity should install with'
2428
default: ''
2529
required: true
30+
type: string
2631
# Additional CMake flags to use
2732
additional_cmake_flags:
2833
description: 'Additional flags to pass into CMake'
2934
default: ''
3035
required: false
36+
type: string
3137

3238
jobs:
3339
build_ios:
34-
name: build-ios-macos-${{ github.event.inputs.unity_version }}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
40+
name: build-ios-unity${{ inputs.unity_version }}-CPP${{ inputs.firebase_cpp_sdk_version }}
3541
runs-on: macos-12
3642
strategy:
3743
fail-fast: false
@@ -50,14 +56,14 @@ jobs:
5056
uses: actions/checkout@v2
5157
with:
5258
submodules: true
53-
ref: ${{ github.event.inputs.unity_branch }}
59+
ref: ${{ inputs.unity_branch }}
5460

5561
- name: Checkout CPP Repo
5662
uses: actions/checkout@v2
5763
with:
5864
repository: firebase/firebase-cpp-sdk
5965
path: firebase-cpp-sdk
60-
ref: ${{ github.event.inputs.firebase_cpp_sdk_version }}
66+
ref: ${{ inputs.firebase_cpp_sdk_version }}
6167
submodules: true
6268

6369
- name: Setup python
@@ -88,17 +94,18 @@ jobs:
8894
- name: Install Unity
8995
shell: bash
9096
run: |
91-
python scripts/gha/unity_installer.py --install --platforms ${{ github.event.inputs.unity_platform_name }} --version ${{ github.event.inputs.unity_version }}
97+
python scripts/gha/unity_installer.py --install --platforms ${{ inputs.unity_platform_name }} --version ${{ inputs.unity_version }}
9298
9399
- name: Setup Unity path
94100
shell: bash
95101
run: |
96-
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{ github.event.inputs.unity_version }} -k unity_path )" >> $GITHUB_ENV
102+
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{ inputs.unity_version }} -k unity_path )" >> $GITHUB_ENV
97103
98104
- name: Build SDK (iOS)
99105
shell: bash
100106
run: |
101-
python scripts/build_scripts/build_zips.py --platform=iOS --unity_root=$UNITY_ROOT_DIR --extra_cmakes=${{ github.event.inputs.additional_cmake_flags }}
107+
# TODO add handling cmake_extras
108+
python scripts/build_scripts/build_zips.py --platform=ios --unity_root=$UNITY_ROOT_DIR --apis=${{ inputs.apis }}
102109
103110
- name: Upload Build
104111
uses: actions/upload-artifact@v2

.github/workflows/build_linux.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,36 @@ on:
88
description: 'Unity version'
99
default: '2019'
1010
required: true
11+
type: string
1112
firebase_cpp_sdk_version:
1213
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout)'
1314
default: ''
1415
required: false
16+
type: string
1517
unity_branch:
1618
description: 'Unity branch to build against, empty means current branch'
1719
default: ''
20+
type: string
1821
apis:
1922
description: 'CSV of apis to build and test'
2023
default: 'analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
2124
required: true
25+
type: string
2226
unity_platform_name:
2327
description: 'The platform name Unity should install with'
2428
default: ''
2529
required: true
30+
type: string
2631
# Additional CMake flags to use
2732
additional_cmake_flags:
2833
description: 'Additional flags to pass into CMake'
2934
default: ''
3035
required: false
36+
type: string
3137

3238
jobs:
3339
build_desktop:
34-
name: build-desktop-linux-${{matrix.unity_version}}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
40+
name: build-linux-unity${{inputs.unity_version}}-CPP${{ inputs.firebase_cpp_sdk_version }}
3541
runs-on: ubuntu-latest
3642
strategy:
3743
fail-fast: false
@@ -47,14 +53,14 @@ jobs:
4753
- uses: actions/checkout@v2
4854
with:
4955
submodules: true
50-
ref: ${{ github.event.inputs.unity_branch }}
56+
ref: ${{ inputs.unity_branch }}
5157

5258
- uses: actions/checkout@v2
5359
with:
5460
repository: firebase/firebase-cpp-sdk
5561
path: firebase-cpp-sdk
5662
submodules: true
57-
ref: ${{ github.event.inputs.firebase_cpp_sdk_version }}
63+
ref: ${{ inputs.firebase_cpp_sdk_version }}
5864

5965
# Set up the requirements, and install Unity
6066
# Ruby setup has to happen before python install and setup, to keep the absl config.
@@ -91,20 +97,21 @@ jobs:
9197
- name: Install Unity
9298
shell: bash
9399
run: |
94-
python scripts/gha/unity_installer.py --install --platforms ${{ github.event.inputs.unity_platform_name }} --version ${{ matrix.unity_version }}
100+
python scripts/gha/unity_installer.py --install --platforms ${{ inputs.unity_platform_name }} --version ${{ inputs.unity_version }}
95101
96102
- name: Setup Unity path
97103
shell: bash
98104
run: |
99-
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{matrix.unity_version}} -k unity_path )" >> $GITHUB_ENV
105+
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{inputs.unity_version}} -k unity_path )" >> $GITHUB_ENV
100106
echo "$(swig -swiglib)" >> $GITHUB_PATH
101107
swig -swiglib
102108
echo "SWIG_DIR=$(swig -swiglib)" >> $GITHUB_ENV
103109
104110
- name: Build SDK (Linux)
105111
shell: bash
106112
run: |
107-
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 }}
113+
# TODO add handling cmake_extras
114+
python scripts/build_scripts/build_zips.py --platform=linux --use_boringssl=true --unity_root=$UNITY_ROOT_DIR --apis=${{ inputs.apis }}
108115
109116
- name: Upload Build
110117
uses: actions/upload-artifact@v2

.github/workflows/build_macos.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,36 @@ on:
88
description: 'Unity version'
99
default: '2019'
1010
required: true
11+
type: string
1112
firebase_cpp_sdk_version:
1213
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout)'
1314
default: ''
1415
required: false
16+
type: string
1517
unity_branch:
1618
description: 'Unity branch to build against, empty means current branch'
1719
default: ''
20+
type: string
1821
apis:
1922
description: 'CSV of apis to build and test'
2023
default: 'analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
2124
required: true
25+
type: string
2226
unity_platform_name:
2327
description: 'The platform name Unity should install with'
2428
default: ''
2529
required: true
30+
type: string
2631
# Additional CMake flags to use
2732
additional_cmake_flags:
2833
description: 'Additional flags to pass into CMake'
2934
default: ''
3035
required: false
36+
type: string
3137

3238
jobs:
3339
build_desktop:
34-
name: build-desktop-macOS-${{matrix.unity_version}}-CPP${{ github.event.inputs.firebase_cpp_sdk_version }}
40+
name: build-macOS-unity${{ inputs.unity_version}}-CPP${{ inputs.firebase_cpp_sdk_version }}
3541
runs-on: macos-latest
3642
strategy:
3743
fail-fast: false
@@ -47,14 +53,14 @@ jobs:
4753
- uses: actions/checkout@v2
4854
with:
4955
submodules: true
50-
ref: ${{ github.event.inputs.unity_branch }}
56+
ref: ${{ inputs.unity_branch }}
5157

5258
- uses: actions/checkout@v2
5359
with:
5460
repository: firebase/firebase-cpp-sdk
5561
path: firebase-cpp-sdk
5662
submodules: true
57-
ref: ${{ github.event.inputs.firebase_cpp_sdk_version }}
63+
ref: ${{ inputs.firebase_cpp_sdk_version }}
5864

5965
# Set up the requirements, and install Unity
6066
# Ruby setup has to happen before python install and setup, to keep the absl config.
@@ -97,20 +103,21 @@ jobs:
97103
- name: Install Unity
98104
shell: bash
99105
run: |
100-
python scripts/gha/unity_installer.py --install --platforms ${{ github.event.inputs.unity_platform_name }} --version ${{ matrix.unity_version }}
106+
python scripts/gha/unity_installer.py --install --platforms ${{ inputs.unity_platform_name }} --version ${{ inputs.unity_version }}
101107
102108
- name: Setup Unity path
103109
shell: bash
104110
run: |
105-
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{matrix.unity_version}} -k unity_path )" >> $GITHUB_ENV
111+
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{ inputs.unity_version }} -k unity_path )" >> $GITHUB_ENV
106112
echo "$(swig -swiglib)" >> $GITHUB_PATH
107113
swig -swiglib
108114
echo "SWIG_DIR=$(swig -swiglib)" >> $GITHUB_ENV
109115
110116
- name: Build SDK (MacOS)
111117
shell: bash
112118
run: |
113-
python scripts/build_scripts/build_zips.py --platform=macos --unity_root=$UNITY_ROOT_DIR --use_boringssl --architecture=x86_64 --architecture=arm64 --cmake_extras="${{ github.event.inputs.additional_cmake_flags }}"
119+
# TODO add handling cmake_extras
120+
python scripts/build_scripts/build_zips.py --platform=macos --unity_root=$UNITY_ROOT_DIR --use_boringssl --architecture=x86_64 --architecture=arm64 --apis=${{ inputs.apis }}
114121
115122
- name: Upload Build
116123
uses: actions/upload-artifact@v2

0 commit comments

Comments
 (0)