Skip to content

Commit 5d52a61

Browse files
google-adminbenknutson-googlea-maurice
authored
Refactor Github Action per b/485167538 (#1397)
* Refactor Github Action per b/485167538 * String single quotes in target list * Revert "String single quotes in target list" This reverts commit db4a22f. * Clean the workflow inputs * Fix problems with single quotes --------- Co-authored-by: Ben Knutson <benknutson@google.com> Co-authored-by: a-maurice <amaurice@google.com>
1 parent 96777b1 commit 5d52a61

File tree

12 files changed

+355
-165
lines changed

12 files changed

+355
-165
lines changed

.github/workflows/build_android.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ jobs:
132132
shell: bash
133133
run: |
134134
# TODO add handling cmake_extras
135-
python scripts/build_scripts/build_zips.py --gha --platform=android --unity_root=$UNITY_ROOT_DIR --apis=${{ inputs.apis }}
135+
CLEAN_APIS=$(echo ${INPUTS_APIS} | tr -d "'" | tr -d "\"")
136+
python scripts/build_scripts/build_zips.py --gha --platform=android --unity_root=$UNITY_ROOT_DIR --apis=${CLEAN_APIS}
137+
env:
138+
INPUTS_APIS: ${{ inputs.apis }}
136139

137140
- name: Check zip file
138141
shell: bash

.github/workflows/build_ios.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ jobs:
101101
shell: bash
102102
run: |
103103
# TODO add handling cmake_extras
104-
python scripts/build_scripts/build_zips.py --gha --platform=ios --unity_root=$UNITY_ROOT_DIR --apis=${{ inputs.apis }}
104+
CLEAN_APIS=$(echo ${INPUTS_APIS} | tr -d "'" | tr -d "\"")
105+
python scripts/build_scripts/build_zips.py --gha --platform=ios --unity_root=$UNITY_ROOT_DIR --apis=${CLEAN_APIS}
106+
env:
107+
INPUTS_APIS: ${{ inputs.apis }}
105108

106109
- name: Check zip file
107110
shell: bash

.github/workflows/build_linux.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ jobs:
103103
shell: bash
104104
run: |
105105
# TODO add handling cmake_extras
106-
python scripts/build_scripts/build_zips.py --gha --platform=linux --use_boringssl=true --unity_root=$UNITY_ROOT_DIR --apis=${{ inputs.apis }} --gen_documentation_zip
106+
CLEAN_APIS=$(echo ${INPUTS_APIS} | tr -d "'" | tr -d "\"")
107+
python scripts/build_scripts/build_zips.py --gha --platform=linux --use_boringssl=true --unity_root=$UNITY_ROOT_DIR --apis=${CLEAN_APIS} --gen_documentation_zip
108+
env:
109+
INPUTS_APIS: ${{ inputs.apis }}
107110

108111
- name: Check zip files
109112
shell: bash

.github/workflows/build_macos.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ jobs:
124124
echo "Did not find python3.11"
125125
fi
126126
# TODO add handling cmake_extras
127-
python scripts/build_scripts/build_zips.py --gha --platform=macos --unity_root=$UNITY_ROOT_DIR --use_boringssl --architecture=x86_64 --architecture=arm64 --apis=${{ inputs.apis }}
127+
CLEAN_APIS=$(echo ${INPUTS_APIS} | tr -d "'" | tr -d "\"")
128+
python scripts/build_scripts/build_zips.py --gha --platform=macos --unity_root=$UNITY_ROOT_DIR --use_boringssl --architecture=x86_64 --architecture=arm64 --apis=${CLEAN_APIS}
129+
env:
130+
INPUTS_APIS: ${{ inputs.apis }}
128131

129132
- name: Check zip file
130133
shell: bash

.github/workflows/build_starter.yml

Lines changed: 52 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ jobs:
8989
- id: set_outputs
9090
run: |
9191
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
92-
platform=$( python scripts/gha/print_matrix_configuration.py -c -w config -k platform -o "${{ github.event.inputs.platforms }}" )
92+
platform=$( python scripts/gha/print_matrix_configuration.py -c -w config -k platform -o "${GITHUB_EVENT_INPUTS_PLATFORMS}" )
9393
echo "platform=${platform}" >> $GITHUB_OUTPUT
94-
echo "release_label=${{ github.event.inputs.release_version }}-${{ github.event.inputs.rc_index }}" >> $GITHUB_OUTPUT
95-
echo "release_version=${{ github.event.inputs.release_version }}" >> $GITHUB_OUTPUT
96-
echo "apis=${{ github.event.inputs.apis }}" >> $GITHUB_OUTPUT
97-
echo "unity_version=${{ github.event.inputs.unity_version }}" >> $GITHUB_OUTPUT
98-
echo "should_trigger_package=${{ github.event.inputs.should_trigger_package }}" >> $GITHUB_OUTPUT
99-
echo "runIntegrationTests=${{ github.event.inputs.runIntegrationTests }}" >> $GITHUB_OUTPUT
100-
echo "firebase_cpp_sdk_version=${{ github.event.inputs.firebase_cpp_sdk_version }}" >> $GITHUB_OUTPUT
101-
echo "unity_branch=${{ github.event.inputs.unity_branch }}" >> $GITHUB_OUTPUT
102-
echo "additional_cmake_flags=${{ github.event.inputs.unity_branch }}" >> $GITHUB_OUTPUT
94+
echo "release_label=${GITHUB_EVENT_INPUTS_RELEASE_VERSION}-${GITHUB_EVENT_INPUTS_RC_INDEX}" >> $GITHUB_OUTPUT
95+
echo "release_version=${GITHUB_EVENT_INPUTS_RELEASE_VERSION}" >> $GITHUB_OUTPUT
96+
echo "apis=${GITHUB_EVENT_INPUTS_APIS}" >> $GITHUB_OUTPUT
97+
echo "unity_version=${GITHUB_EVENT_INPUTS_UNITY_VERSION}" >> $GITHUB_OUTPUT
98+
echo "should_trigger_package=${GITHUB_EVENT_INPUTS_SHOULD_TRIGGER_PACKAGE}" >> $GITHUB_OUTPUT
99+
echo "runIntegrationTests=${GITHUB_EVENT_INPUTS_RUNINTEGRATIONTESTS}" >> $GITHUB_OUTPUT
100+
echo "firebase_cpp_sdk_version=${GITHUB_EVENT_INPUTS_FIREBASE_CPP_SDK_VERSION}" >> $GITHUB_OUTPUT
101+
echo "unity_branch=${GITHUB_EVENT_INPUTS_UNITY_BRANCH}" >> $GITHUB_OUTPUT
102+
echo "additional_cmake_flags=${GITHUB_EVENT_INPUTS_UNITY_BRANCH}" >> $GITHUB_OUTPUT
103103
else
104104
echo "platform='Android,iOS,tvOS,Windows,macOS,Linux,Playmode'" >> $GITHUB_OUTPUT
105105
echo "release_label=nightly-$(date "+%Y%m%d-%H%M%S")" >> $GITHUB_OUTPUT
@@ -114,9 +114,9 @@ jobs:
114114
if [[ "${{ github.event_name }}" == "schedule" ]]; then
115115
echo "runIntegrationTests=nightly-packaging" >> $GITHUB_OUTPUT
116116
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
117-
if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "tests-requested: quick" ]]; then
117+
if [[ "${GITHUB_EVENT_ACTION}" == "labeled" && "${GITHUB_EVENT_LABEL_NAME}" == "tests-requested: quick" ]]; then
118118
echo "runIntegrationTests=${{ github.event.pull_request.number }}:label-quick-packaging" >> $GITHUB_OUTPUT
119-
elif [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "tests-requested: full" ]]; then
119+
elif [[ "${GITHUB_EVENT_ACTION}" == "labeled" && "${GITHUB_EVENT_LABEL_NAME}" == "tests-requested: full" ]]; then
120120
echo "runIntegrationTests=${{ github.event.pull_request.number }}:label-full-packaging" >> $GITHUB_OUTPUT
121121
else
122122
echo "invalid_trigger=1" >> $GITHUB_OUTPUT
@@ -125,6 +125,18 @@ jobs:
125125
echo "invalid_trigger=1" >> $GITHUB_OUTPUT
126126
fi
127127
fi
128+
env:
129+
GITHUB_EVENT_INPUTS_PLATFORMS: ${{ github.event.inputs.platforms }}
130+
GITHUB_EVENT_INPUTS_RELEASE_VERSION: ${{ github.event.inputs.release_version }}
131+
GITHUB_EVENT_INPUTS_RC_INDEX: ${{ github.event.inputs.rc_index }}
132+
GITHUB_EVENT_INPUTS_APIS: ${{ github.event.inputs.apis }}
133+
GITHUB_EVENT_INPUTS_UNITY_VERSION: ${{ github.event.inputs.unity_version }}
134+
GITHUB_EVENT_INPUTS_SHOULD_TRIGGER_PACKAGE: ${{ github.event.inputs.should_trigger_package }}
135+
GITHUB_EVENT_INPUTS_RUNINTEGRATIONTESTS: ${{ github.event.inputs.runIntegrationTests }}
136+
GITHUB_EVENT_INPUTS_FIREBASE_CPP_SDK_VERSION: ${{ github.event.inputs.firebase_cpp_sdk_version }}
137+
GITHUB_EVENT_INPUTS_UNITY_BRANCH: ${{ github.event.inputs.unity_branch }}
138+
GITHUB_EVENT_ACTION: ${{ github.event.action }}
139+
GITHUB_EVENT_LABEL_NAME: ${{ github.event.label.name }}
128140
- name: Cancel workflow
129141
if: ${{ steps.set_outputs.outputs.invalid_trigger }}
130142
uses: andymckay/cancel-action@0.2
@@ -136,16 +148,27 @@ jobs:
136148
137149
- name: Print output
138150
run: |
139-
echo outputs.platform : ${{ steps.set_outputs.outputs.platform }}
140-
echo outputs.release_label : ${{ steps.set_outputs.outputs.release_label }}
141-
echo outputs.release_version : ${{ steps.set_outputs.outputs.release_version }}
142-
echo outputs.apis : ${{ steps.set_outputs.outputs.apis }}
143-
echo outputs.unity_version : ${{ steps.set_outputs.outputs.unity_version }}
144-
echo outputs.should_trigger_package : ${{ steps.set_outputs.outputs.should_trigger_package }}
145-
echo outputs.runIntegrationTests : ${{ steps.set_outputs.outputs.runIntegrationTests }}
146-
echo outputs.firebase_cpp_sdk_version : ${{ steps.set_outputs.outputs.firebase_cpp_sdk_version }}
147-
echo outputs.unity_branch : ${{ steps.set_outputs.outputs.unity_branch }}
148-
echo outputs.additional_cmake_flags : ${{ steps.set_outputs.outputs.additional_cmake_flags }}
151+
echo outputs.platform : ${STEPS_SET_OUTPUTS_OUTPUTS_PLATFORM}
152+
echo outputs.release_label : ${STEPS_SET_OUTPUTS_OUTPUTS_RELEASE_LABEL}
153+
echo outputs.release_version : ${STEPS_SET_OUTPUTS_OUTPUTS_RELEASE_VERSION}
154+
echo outputs.apis : ${STEPS_SET_OUTPUTS_OUTPUTS_APIS}
155+
echo outputs.unity_version : ${STEPS_SET_OUTPUTS_OUTPUTS_UNITY_VERSION}
156+
echo outputs.should_trigger_package : ${STEPS_SET_OUTPUTS_OUTPUTS_SHOULD_TRIGGER_PACKAGE}
157+
echo outputs.runIntegrationTests : ${STEPS_SET_OUTPUTS_OUTPUTS_RUNINTEGRATIONTESTS}
158+
echo outputs.firebase_cpp_sdk_version : ${STEPS_SET_OUTPUTS_OUTPUTS_FIREBASE_CPP_SDK_VERSION}
159+
echo outputs.unity_branch : ${STEPS_SET_OUTPUTS_OUTPUTS_UNITY_BRANCH}
160+
echo outputs.additional_cmake_flags : ${STEPS_SET_OUTPUTS_OUTPUTS_ADDITIONAL_CMAKE_FLAGS}
161+
env:
162+
STEPS_SET_OUTPUTS_OUTPUTS_PLATFORM: ${{ steps.set_outputs.outputs.platform }}
163+
STEPS_SET_OUTPUTS_OUTPUTS_RELEASE_LABEL: ${{ steps.set_outputs.outputs.release_label }}
164+
STEPS_SET_OUTPUTS_OUTPUTS_RELEASE_VERSION: ${{ steps.set_outputs.outputs.release_version }}
165+
STEPS_SET_OUTPUTS_OUTPUTS_APIS: ${{ steps.set_outputs.outputs.apis }}
166+
STEPS_SET_OUTPUTS_OUTPUTS_UNITY_VERSION: ${{ steps.set_outputs.outputs.unity_version }}
167+
STEPS_SET_OUTPUTS_OUTPUTS_SHOULD_TRIGGER_PACKAGE: ${{ steps.set_outputs.outputs.should_trigger_package }}
168+
STEPS_SET_OUTPUTS_OUTPUTS_RUNINTEGRATIONTESTS: ${{ steps.set_outputs.outputs.runIntegrationTests }}
169+
STEPS_SET_OUTPUTS_OUTPUTS_FIREBASE_CPP_SDK_VERSION: ${{ steps.set_outputs.outputs.firebase_cpp_sdk_version }}
170+
STEPS_SET_OUTPUTS_OUTPUTS_UNITY_BRANCH: ${{ steps.set_outputs.outputs.unity_branch }}
171+
STEPS_SET_OUTPUTS_OUTPUTS_ADDITIONAL_CMAKE_FLAGS: ${{ steps.set_outputs.outputs.additional_cmake_flags }}
149172

150173
update_versions:
151174
uses: ./.github/workflows/update_versions.yml
@@ -167,12 +190,16 @@ jobs:
167190
steps:
168191
- id: decide_branch
169192
run: |
170-
if [[ "${{ needs.check_and_prepare.outputs.release_version }}" == "'NoVersion'" ]]; then
193+
if [[ "${NEEDS_CHECK_AND_PREPARE_OUTPUTS_RELEASE_VERSION}" == "'NoVersion'" ]]; then
171194
# Triggered by callable
172-
echo "branch=${{ needs.check_and_prepare.outputs.unity_branch }}" >> $GITHUB_OUTPUT
195+
echo "branch=${NEEDS_CHECK_AND_PREPARE_OUTPUTS_UNITY_BRANCH}" >> $GITHUB_OUTPUT
173196
else
174-
echo "branch=${{ needs.update_versions.outputs.new_branch }}" >> $GITHUB_OUTPUT
197+
echo "branch=${NEEDS_UPDATE_VERSIONS_OUTPUTS_NEW_BRANCH}" >> $GITHUB_OUTPUT
175198
fi
199+
env:
200+
NEEDS_CHECK_AND_PREPARE_OUTPUTS_RELEASE_VERSION: ${{ needs.check_and_prepare.outputs.release_version }}
201+
NEEDS_CHECK_AND_PREPARE_OUTPUTS_UNITY_BRANCH: ${{ needs.check_and_prepare.outputs.unity_branch }}
202+
NEEDS_UPDATE_VERSIONS_OUTPUTS_NEW_BRANCH: ${{ needs.update_versions.outputs.new_branch }}
176203

177204
build_android:
178205
name: build-android-unity${{ needs.check_and_prepare.outputs.unity_version }}-CPP${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}

.github/workflows/build_tvos.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ jobs:
122122
shell: bash
123123
run: |
124124
# TODO add handling cmake_extras
125-
python scripts/build_scripts/build_zips.py --gha --platform=tvos --unity_root=$UNITY_ROOT_DIR --apis=${{ inputs.apis }}
125+
CLEAN_APIS=$(echo ${INPUTS_APIS} | tr -d "'" | tr -d "\"")
126+
python scripts/build_scripts/build_zips.py --gha --platform=tvos --unity_root=$UNITY_ROOT_DIR --apis=${CLEAN_APIS}
127+
env:
128+
INPUTS_APIS: ${{ inputs.apis }}
126129

127130
- name: Check zip file
128131
shell: bash

.github/workflows/build_windows.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ jobs:
123123
shell: bash
124124
run: |
125125
# TODO add handling cmake_extras
126-
python scripts/build_scripts/build_zips.py --gha --platform=windows --unity_root="$UNITY_ROOT_DIR" --swig_dir="$SWIG_DIR" --apis=${{ inputs.apis }}
126+
CLEAN_APIS=$(echo ${INPUTS_APIS} | tr -d "'" | tr -d "\"")
127+
python scripts/build_scripts/build_zips.py --gha --platform=windows --unity_root="$UNITY_ROOT_DIR" --swig_dir="$SWIG_DIR" --apis=${CLEAN_APIS}
128+
env:
129+
INPUTS_APIS: ${{ inputs.apis }}
127130

128131
- name: Check zip file
129132
shell: bash

.github/workflows/generate_swig.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ jobs:
8484
shell: bash
8585
run: |
8686
# TODO add handling cmake_extras
87-
python scripts/build_scripts/build_zips.py --gha --platform=linux --apis=${{ inputs.apis }} --gen_swig_only
87+
CLEAN_APIS=$(echo ${INPUTS_APIS} | tr -d "'" | tr -d "\"")
88+
python scripts/build_scripts/build_zips.py --gha --platform=linux --apis=${CLEAN_APIS} --gen_swig_only
89+
env:
90+
INPUTS_APIS: ${{ inputs.apis }}
8891

8992
- name: Check zip files
9093
shell: bash

0 commit comments

Comments
 (0)