11name : Build and test UPM packages for platforms, all branches except main
22
33on :
4- # pull_request:
5- # branches-ignore:
6- # - 'release '
4+ pull_request :
5+ branches-ignore :
6+ - ' main '
77 # Ignore PRs targeting main
88
99 # Allows you to run this workflow manually from the Actions tab
@@ -13,18 +13,79 @@ concurrency:
1313 group : ${{ github.ref }}
1414 cancel-in-progress : true
1515
16+ # Ensure default token scopes and inherit org-level secrets via env mapping
17+ permissions :
18+ contents : write
19+ packages : read
20+
21+ env :
22+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
23+ GIT_PAT : ${{ secrets.GIT_PAT }}
24+
1625jobs :
17- # Check Unity version required by the package
18- # Run Unity build unit tests defined in the package for a single version for feature branches
19- Run-Partial-Unit-Tests :
20- name : Run Unity Unit Tests
21- if : github.ref != 'refs/heads/development'
22- uses : ./.github/workflows/rununitysinglebuild.yml
23- with :
24- unityversion : 2020.3
25-
26- # Run Unity multi-version build unit tests defined in the package for the development branch
27- Run-Full-Unit-Tests :
28- name : Run Unity Unit Tests
29- if : github.ref == 'refs/heads/development'
30- uses : ./.github/workflows/rununitybuildmultiversion.yml
26+ test-unity-build :
27+ name : Test Unity UPM Build
28+ runs-on : ${{ matrix.os }}
29+ if : always()
30+ strategy :
31+ fail-fast : false
32+ matrix :
33+ os : [ubuntu-latest, windows-latest, macos-latest]
34+ unity-version :
35+ - 2019
36+ - 2020
37+ - 2021
38+ - 2022
39+ - 6000.0.x
40+ - 6000
41+ include :
42+ - os : ubuntu-latest
43+ build-targets : StandaloneLinux64, Android
44+ - os : windows-latest
45+ build-targets : StandaloneWindows64
46+ - os : macos-latest
47+ build-targets : StandaloneOSX, iOS
48+ steps :
49+ - uses : buildalon/unity-setup@v2
50+ id : unity-setup
51+ with :
52+ version-file : " None"
53+ unity-version : ${{ matrix.unity-version }} # overrides version in version-file
54+ build-targets : ${{ matrix.build-targets }}
55+
56+ - run : |
57+ echo "Step Outputs:"
58+ echo "steps.unity-setup.unity-hub-path: '${{ steps.unity-setup.outputs.unity-hub-path }}'"
59+ echo "steps.unity-setup.unity-editors: '${{ steps.unity-setup.outputs.unity-editors }}'"
60+ echo "steps.unity-setup.unity-editor-path: '${{ steps.unity-setup.outputs.unity-editor-path }}'"
61+ echo "steps.unity-setup.unity-project-path: '${{ steps.unity-setup.outputs.unity-project-path }}'"
62+
63+ echo "Environment Variables:"
64+ echo "UNITY_HUB_PATH: '${{ env.UNITY_HUB_PATH }}'"
65+ echo "UNITY_EDITORS: '${{ env.UNITY_EDITORS }}'"
66+ echo "UNITY_EDITOR_PATH: '${{ env.UNITY_EDITOR_PATH }}'"
67+ echo "UNITY_PROJECT_PATH: '${{ env.UNITY_PROJECT_PATH }}'"
68+
69+ - uses : buildalon/activate-unity-license@v2
70+ if : runner.environment == 'github-hosted'
71+ with :
72+ license : " Personal" # Choose license type to use [ Personal, Professional, Floating ]
73+ username : ${{ secrets.UNITY_USER}}
74+ password : ${{ secrets.UNITY_ACC}}
75+
76+ - uses : buildalon/create-unity-project@v2
77+ id : create-unity-project
78+ with :
79+ project-name : P
80+
81+ - name : Setup Unity UPM Build
82+ uses : realitycollective/reality-collective-actions/setup-unity-upm-build@v1
83+ with :
84+ unity-project-path : ${{ steps.create-unity-project.outputs.project-path }}
85+
86+ - name : Run Unity Build
87+ uses : realitycollective/reality-collective-actions/run-unity-multitarget-build@v1
88+ with :
89+ unity-editor-path : ${{ steps.unity-setup.outputs.unity-editor-path }}
90+ unity-project-path : ${{ steps.create-unity-project.outputs.project-path }}
91+ build-targets : ${{ matrix.build-targets }}
0 commit comments