1
+ on :
2
+ workflow_call :
3
+ inputs :
4
+ unity-version :
5
+ required : true
6
+ type : string
7
+
8
+ defaults :
9
+ run :
10
+ shell : pwsh
11
+
12
+ jobs :
13
+ build :
14
+ name : ${{ inputs.unity-version }}
15
+ runs-on : ubuntu-latest
16
+ strategy :
17
+ matrix :
18
+ include :
19
+ - platform : Android
20
+ check_symbols : false
21
+ build_platform : Android-Export
22
+ env :
23
+ UNITY_PATH : docker exec unity unity-editor
24
+
25
+ steps :
26
+ - name : Checkout
27
+ uses : actions/checkout@v3
28
+
29
+ - name : Free Disk Space (Ubuntu)
30
+ uses : jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8
31
+ with :
32
+ android : true
33
+ dotnet : false
34
+ haskell : true
35
+ large-packages : false
36
+ docker-images : false
37
+ swap-storage : true
38
+
39
+ - run : echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}"
40
+
41
+ - name : Docker Login
42
+ uses : docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pinned v3
43
+ with :
44
+ registry : ghcr.io
45
+ username : ${{ github.actor }}
46
+ password : ${{ secrets.GITHUB_TOKEN }}
47
+
48
+ - name : Start the Unity docker container
49
+ run : ./scripts/ci-docker.sh '${{ inputs.unity-version }}' 'android' '${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}'
50
+ shell : bash
51
+
52
+ # Workaround for missing libMonoPosixHelper.so
53
+ # See https://github.com/getsentry/sentry-unity/pull/1295
54
+ - name : Install mono-devel
55
+ if : ${{ inputs.unity-version == '2019' }}
56
+ run : |
57
+ docker exec --user root unity apt-get update
58
+ docker exec --user root unity apt-get -y -q install mono-devel
59
+
60
+ - name : Download IntegrationTest project
61
+ uses : actions/download-artifact@v4
62
+ with :
63
+ name : smoke-test-${{ inputs.unity-version }}
64
+
65
+ - name : Extract project archive
66
+ run : tar -xvzf test-project.tar.gz
67
+
68
+ - name : Download UPM package
69
+ uses : vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848
70
+ with :
71
+ name : ${{ github.sha }}
72
+ wait-timeout : 3600
73
+
74
+ - name : Extract UPM package
75
+ run : ./test/Scripts.Integration.Test/extract-package.ps1
76
+
77
+ - name : Add Sentry to the project
78
+ run : ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}"
79
+
80
+ - name : Configure Sentry
81
+ run : ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols
82
+
83
+ - name : Build Project
84
+ run : ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}"
85
+
86
+ # We create tar explicitly because upload-artifact is slow for many files.
87
+ # TODO verify this is still true with upload-artifact@v4 which improved performance a lot.
88
+ - name : Create archive
89
+ shell : bash
90
+ run : |
91
+ # Note: remove local.properties file that contains Android SDK & NDK paths in the Unity installation.
92
+ rm -rf samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
93
+ tar -cvzf test-app-runtime.tar.gz samples/IntegrationTest/Build
94
+
95
+ # Upload runtime initialization build
96
+ - name : Upload test app
97
+ uses : actions/upload-artifact@v4
98
+ with :
99
+ name : testapp-android-${{ inputs.unity-version }}-runtime
100
+ if-no-files-found : error
101
+ path : test-app-runtime.tar.gz
102
+ retention-days : 14
103
+
104
+ - name : Configure Sentry for mobile platforms (build-time initialization)
105
+ run : |
106
+ $optionsPath = "samples/IntegrationTest/Assets/Scripts/OptionsConfiguration.cs"
107
+ $content = Get-Content $optionsPath -Raw
108
+ $content = $content -replace 'AndroidNativeInitializationType = NativeInitializationType.Runtime', 'AndroidNativeInitializationType = NativeInitializationType.BuildTime'
109
+ Set-Content $optionsPath $content
110
+
111
+ - name : Build Project for mobile platforms (build-time initialization)
112
+ run : ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform ${{ matrix.build_platform }} -CheckSymbols:$false -UnityVersion "${{ inputs.unity-version }}"
113
+
114
+ - name : Create archive (build-time initialization)
115
+ shell : bash
116
+ run : |
117
+ rm -rf samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
118
+ tar -cvzf test-app-buildtime.tar.gz samples/IntegrationTest/Build
119
+
120
+ # Upload build-time initialization build
121
+ - name : Upload test app (build-time initialization)
122
+ uses : actions/upload-artifact@v4
123
+ with :
124
+ name : testapp-android-${{ inputs.unity-version }}-buildtime
125
+ if-no-files-found : error
126
+ path : test-app-buildtime.tar.gz
127
+ retention-days : 14
128
+
129
+ - name : Upload IntegrationTest project on failure
130
+ if : ${{ failure() }}
131
+ uses : actions/upload-artifact@v4
132
+ with :
133
+ name : failed-project-android-${{ inputs.unity-version }}
134
+ path : |
135
+ samples/IntegrationTest
136
+ !samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
137
+ # Lower retention period - we only need this to retry CI.
138
+ retention-days : 14
0 commit comments