|
1 | 1 | name: validate |
2 | 2 | on: |
3 | | - schedule: |
4 | | - - cron: '0 0 * * 0' # Every Sunday at midnight |
5 | 3 | push: |
6 | 4 | branches: ['main'] |
7 | 5 | pull_request: |
8 | 6 | branches: ['*'] |
9 | | - # Allows you to run this workflow manually from the Actions tab |
10 | 7 | workflow_dispatch: |
11 | 8 | concurrency: |
12 | 9 | group: ${{ github.workflow }}-${{ github.ref }} |
13 | 10 | cancel-in-progress: true |
14 | 11 | jobs: |
15 | | - build: |
16 | | - timeout-minutes: 60 |
17 | | - env: |
18 | | - TEMPLATE_PATH: '' |
19 | | - UNITY_EDITOR_PATH: '' # set from unity-setup step |
20 | | - UNITY_PROJECT_PATH: '' # set from unity-setup step |
21 | | - runs-on: ${{ matrix.os }} |
22 | | - strategy: |
23 | | - fail-fast: false |
24 | | - matrix: |
25 | | - os: [ubuntu-latest, windows-latest, macos-latest] |
26 | | - unity-version: [2022.3.x, 6000.0.x, 6000.1.x] |
27 | | - include: # for each os specify the build targets |
28 | | - - os: ubuntu-latest |
29 | | - build-target: StandaloneLinux64 |
30 | | - - os: windows-latest |
31 | | - build-target: StandaloneWindows64 |
32 | | - - os: macos-latest |
33 | | - build-target: StandaloneOSX |
| 12 | + setup: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + permissions: |
| 15 | + contents: read |
34 | 16 | steps: |
35 | 17 | - uses: actions/checkout@v4 |
36 | | - - run: 'npm install -g openupm-cli' |
37 | | - # Installs the Unity Editor based on your project version text file |
38 | | - # sets -> env.UNITY_EDITOR_PATH |
39 | | - # sets -> env.UNITY_PROJECT_PATH |
40 | | - - uses: buildalon/unity-setup@v1 |
41 | | - with: |
42 | | - version-file: 'None' |
43 | | - build-targets: ${{ matrix.build-target }} |
44 | | - unity-version: ${{ matrix.unity-version }} |
45 | | - - name: Find Unity Template Path |
46 | | - run: | |
47 | | - $rootPath = $env:UNITY_EDITOR_PATH -replace "Editor.*", "" |
48 | | - Write-Host "ROOT_PATH=$rootPath" |
49 | | - $templatePath = Get-ChildItem -Recurse -Filter "com.unity.template.3d*.tgz" -Path $rootPath | Select-Object -First 1 | Select-Object -ExpandProperty FullName |
50 | | - Write-Host "TEMPLATE_PATH=$templatePath" |
51 | | - echo "TEMPLATE_PATH=$templatePath" >> $env:GITHUB_ENV |
52 | | - shell: pwsh |
53 | | - # Activates the installation with the provided credentials |
54 | | - - uses: buildalon/activate-unity-license@v1 |
55 | | - with: |
56 | | - license: 'Personal' |
57 | | - username: ${{ secrets.UNITY_USERNAME }} |
58 | | - password: ${{ secrets.UNITY_PASSWORD }} |
59 | | - - uses: ./ # buildalon/unity-action |
60 | | - name: Create Test Project |
61 | 18 | with: |
62 | | - log-name: 'create-test-project' |
63 | | - args: '-quit -nographics -batchmode -createProject "${{ github.workspace }}/Test Project" -cloneFromTemplate "${{ env.TEMPLATE_PATH }}"' |
64 | | - - run: 'openupm add com.utilities.buildpipeline' |
65 | | - name: Add Build Pipeline Package |
66 | | - working-directory: ${{ github.workspace }}/Test Project |
67 | | - - uses: ./ # buildalon/unity-action |
68 | | - name: '${{ matrix.build-target }}-Build' |
| 19 | + sparse-checkout: .github/ |
| 20 | + - uses: RageAgainstThePixel/job-builder@v1 |
| 21 | + id: setup-jobs |
69 | 22 | with: |
70 | | - project-path: ${{ github.workspace }}/Test Project |
71 | | - log-name: '${{ matrix.build-target }}-Build' |
72 | | - build-target: '${{ matrix.build-target }}' |
73 | | - args: '-quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity' |
74 | | - - uses: actions/upload-artifact@v4 |
75 | | - name: Upload Artifacts |
76 | | - if: always() |
77 | | - with: |
78 | | - name: '${{ github.run_number }}.${{ github.run_attempt }}-${{ runner.os }}-${{ matrix.build-target }}-${{ matrix.unity-version }}-Artifacts' |
79 | | - path: | |
80 | | - ${{ github.workspace }}/**/*.log |
81 | | - ${{ github.workspace }}/**/Builds/${{ matrix.build-target }}/ |
| 23 | + build-options: ./.github/workflows/build-options.json |
| 24 | + group-by: 'unity-version' |
| 25 | + outputs: |
| 26 | + jobs: ${{ steps.setup-jobs.outputs.jobs }} |
| 27 | + validate: |
| 28 | + if: ${{ needs.setup.outputs.jobs }} |
| 29 | + needs: setup |
| 30 | + name: build ${{ matrix.jobs.name }} |
| 31 | + permissions: |
| 32 | + contents: read |
| 33 | + strategy: |
| 34 | + matrix: ${{ fromJSON(needs.setup.outputs.jobs) }} |
| 35 | + fail-fast: false |
| 36 | + secrets: inherit |
| 37 | + uses: ./.github/workflows/build.yml |
| 38 | + with: |
| 39 | + matrix: ${{ toJSON(matrix.jobs.matrix) }} |
0 commit comments