|
51 | 51 | build_matrix: ${{ steps.matrix_config.outputs.build_matrix }} |
52 | 52 | test_matrix: ${{ steps.matrix_config.outputs.test_matrix }} |
53 | 53 | playmode_matrix: ${{ steps.matrix_config.outputs.playmode_matrix }} |
| 54 | + macos_runner: ${{ steps.matrix_config.outputs.macos_runner }} |
54 | 55 | steps: |
55 | 56 | ### Fail the workflow if the user does not have admin access to run the tests. |
56 | 57 | - name: Check if user has permission to trigger tests |
@@ -282,9 +283,11 @@ jobs: |
282 | 283 | MATRIX_PLATFORM: ${{ matrix.platform }} |
283 | 284 | MATRIX_IOS_SDK: ${{ matrix.ios_sdk }} |
284 | 285 | STEPS_MATRIX_INFO_OUTPUTS_INFO: ${{ steps.matrix_info.outputs.info }} |
285 | | - - name: Return Unity license |
286 | | - # Always returns true, even when job failed or canceled. But will not run when a critical failure prevents the task from running. |
287 | | - if: always() |
| 286 | + - name: Return Unity license (Non-macOS only) |
| 287 | + # Always returns true, even when job failed or canceled. But will not run when a critical failure prevents the task from running. |
| 288 | + # Note: macOS is handled by the 'teardown-unity-license' step. |
| 289 | + # This is due to a quirk with licenses see the teardown-unity-license' step. |
| 290 | + if: always() && runner.os != 'macOS' |
288 | 291 | uses: ./gha/unity |
289 | 292 | with: |
290 | 293 | version: ${{ matrix.unity_version }} |
@@ -484,9 +487,11 @@ jobs: |
484 | 487 | GITHUB_EVENT_INPUTS_PACKAGED_SDK_RUN_ID: ${{ github.event.inputs.packaged_sdk_run_id }} |
485 | 488 | NEEDS_CHECK_AND_PREPARE_OUTPUTS_APIS: ${{ needs.check_and_prepare.outputs.apis }} |
486 | 489 | STEPS_MATRIX_INFO_OUTPUTS_INFO: ${{ steps.matrix_info.outputs.info }} |
487 | | - - name: Return Unity license |
488 | | - # Always returns true, even when job failed or canceled. But will not run when a critical failure prevents the task from running. |
489 | | - if: always() |
| 490 | + - name: Return Unity license (Non-macOS only) |
| 491 | + # Always returns true, even when job failed or canceled. But will not run when a critical failure prevents the task from running. |
| 492 | + # Note: macOS is handled by the 'teardown-unity-license' step. |
| 493 | + # This is due to a quirk with licenses see the teardown-unity-license step for more information |
| 494 | + if: always() && runner.os != 'macOS' |
490 | 495 | uses: ./gha/unity |
491 | 496 | with: |
492 | 497 | version: ${{ matrix.unity_version }} |
@@ -813,3 +818,41 @@ jobs: |
813 | 818 | -A |
814 | 819 | env: |
815 | 820 | STEPS_GENERATE_TOKEN_OUTPUTS_TOKEN: ${{ steps.generate-token.outputs.token }} |
| 821 | + |
| 822 | + teardown_unity_license: |
| 823 | + name: "teardown-unity-license" |
| 824 | + # When one Mac runner is released, the license is removed from all of them. |
| 825 | + # This appears to be quirk of the Github actions Mac VM's and the Unity license server. |
| 826 | + # For some reason the Unity license server see all the Mac runners as the same machine. |
| 827 | + # As a result returning one machine's license returns it from all the machines. |
| 828 | + # Our best guess is something to do with the MAC address all being the same across the Mac runners. |
| 829 | + # Therefore we wait for the builds to complete before returning the license. |
| 830 | + # Ensures that all the build and playmode tests complete before the license is returned from all the machines. |
| 831 | + runs-on: macos-14 |
| 832 | + # Wait for both build and playmode to finish before returning the license |
| 833 | + needs: [build_testapp, playmode_test] |
| 834 | + if: always() |
| 835 | + strategy: |
| 836 | + fail-fast: false |
| 837 | + matrix: |
| 838 | + unity_version: ['2021', '2022'] |
| 839 | + steps: |
| 840 | + - uses: actions/checkout@v3 |
| 841 | + - name: Setup python |
| 842 | + uses: actions/setup-python@v4 |
| 843 | + with: |
| 844 | + python-version: '3.9' |
| 845 | + - name: Install python deps |
| 846 | + run: pip install -r scripts/gha/requirements.txt |
| 847 | + - name: Activate Unity license |
| 848 | + uses: ./gha/unity |
| 849 | + with: |
| 850 | + version: ${{ matrix.unity_version }} |
| 851 | + username: ${{ secrets.UNITY_USERNAME }} |
| 852 | + password: ${{ secrets.UNITY_PASSWORD }} |
| 853 | + serial_ids: ${{ secrets.SERIAL_ID }} |
| 854 | + - name: Return Unity license |
| 855 | + uses: ./gha/unity |
| 856 | + with: |
| 857 | + version: ${{ matrix.unity_version }} |
| 858 | + release_license: "true" |
0 commit comments