Skip to content

Commit 0bc8e57

Browse files
updated workflows to use latest versions of action steps
added defineConstraints to AssetConfiguration in export_unity_package.py added unit tests for defineConstraints in export_unity_package_test.py
1 parent aaa9dbb commit 0bc8e57

File tree

6 files changed

+43
-10
lines changed

6 files changed

+43
-10
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
runs-on: ubuntu-latest
6565
steps:
6666
- name: Fetch All builds
67-
uses: actions/download-artifact@v3
67+
uses: actions/download-artifact@v4
6868
with:
6969
path: built_artifact
7070

.github/workflows/build_macos.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ env:
3333
jobs:
3434
build_desktop:
3535
name: build-macOS-unity${{ inputs.unity_version}}
36-
runs-on: macos-13
36+
runs-on: macos-15
3737
strategy:
3838
fail-fast: false
3939

4040
steps:
41-
- uses: actions/checkout@v3
41+
- uses: actions/checkout@v4
4242

4343
- id: build_setup
4444
uses: ./gha/build_setup
@@ -89,15 +89,15 @@ jobs:
8989
fi
9090
9191
- name: Upload build results artifact
92-
uses: actions/upload-artifact@v3
92+
uses: actions/upload-artifact@v4
9393
if: ${{ !cancelled() }}
9494
with:
9595
name: ${{ env.assetPackageArtifactName }}
9696
path: build/external-dependency-manager.unitypackage
9797
retention-days: ${{ env.artifactRetentionDays }}
9898

9999
- name: Upload build results artifact
100-
uses: actions/upload-artifact@v3
100+
uses: actions/upload-artifact@v4
101101
if: ${{ !cancelled() }}
102102
with:
103103
name: ${{ env.tarballPackageArtifactName }}

.github/workflows/test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ jobs:
107107
108108
test_on_macos:
109109
name: test-macOS-unity${{ needs.check_and_prepare.outputs.unity_version }}
110-
runs-on: macos-13
110+
runs-on: macos-15
111111
needs: [check_and_prepare]
112112
strategy:
113113
fail-fast: false
114114
steps:
115-
- uses: actions/checkout@v3
115+
- uses: actions/checkout@v4
116116
- id: build_setup
117117
uses: ./gha/build_setup
118118
timeout-minutes: 30
@@ -168,7 +168,7 @@ jobs:
168168
release_license: "true"
169169

170170
- name: Upload build logs
171-
uses: actions/upload-artifact@v3
171+
uses: actions/upload-artifact@v4
172172
if: ${{ !cancelled() }}
173173
with:
174174
name: logs

gha/build_setup/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ runs:
4242
using: 'composite'
4343
steps:
4444
# Download GHA tools and requirements from Firebase Unity SDK repo
45-
- uses: actions/checkout@v3
45+
- uses: actions/checkout@v4
4646
with:
4747
repository: firebase/firebase-unity-sdk
4848
path: external/firebase-unity-sdk
@@ -51,7 +51,7 @@ runs:
5151
sparse-checkout-cone-mode: false
5252

5353
- name: Setup python
54-
uses: actions/setup-python@v4
54+
uses: actions/setup-python@v5
5555
with:
5656
python-version: ${{ inputs.python_version }}
5757

source/ExportUnityPackage/export_unity_package.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,6 +1851,12 @@ def importer_metadata(self):
18511851
if "Android" in platforms and cpu_string != "AnyCPU":
18521852
importer_metadata = Asset.set_cpu_for_android(
18531853
importer_metadata, cpu_string)
1854+
1855+
# set define constraints
1856+
define_constraints = safe_dict_get_value(self._json, "defineConstraints", default_value=None)
1857+
if define_constraints:
1858+
importer_metadata["PluginImporter"]["defineConstraints"] = define_constraints
1859+
18541860
else:
18551861
raise ProjectConfigurationError(
18561862
"Unknown importer type %s for package %s, paths %s" % (

source/ExportUnityPackage/export_unity_package_test.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,6 +2181,33 @@ def test_importer_metadata_standalone_only_x86_64(self):
21812181
"platforms": ["Standalone"],
21822182
"cpu": "x86_64"}).importer_metadata)
21832183

2184+
def test_importer_define_constraints(self):
2185+
"""Test defineConstraints property."""
2186+
define_constraints = ["UNITY_EDITOR", "UNITY_IOS"]
2187+
self.plugin_metadata["PluginImporter"]["defineConstraints"] = define_constraints
2188+
self.assertEqual(
2189+
self.plugin_metadata,
2190+
export_unity_package.AssetConfiguration(
2191+
self.package, {
2192+
"importer": "PluginImporter",
2193+
"defineConstraints": define_constraints
2194+
}).importer_metadata)
2195+
2196+
def test_importer_define_constraints_upm(self):
2197+
"""Test defineConstraints property for UPM."""
2198+
define_constraints = ["UNITY_EDITOR", "UNITY_IOS"]
2199+
self.plugin_metadata["PluginImporter"]["defineConstraints"] = define_constraints
2200+
self.assertEqual(
2201+
self.plugin_metadata,
2202+
export_unity_package.AssetConfiguration(
2203+
self.package, {
2204+
"importer": "PluginImporter",
2205+
"override_metadata_upm": {
2206+
"PluginImporter": {
2207+
"defineConstraints": define_constraints
2208+
}
2209+
}
2210+
}).override_metadata_upm)
21842211

21852212
class AssetPackageAndProjectFileOperationsTest(absltest.TestCase):
21862213
"""Tests for file operation methods."""

0 commit comments

Comments
 (0)