Update main.yml #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unity Cross-Platform Build and Test Workflow | |
on: [push, pull_request] | |
jobs: | |
buildAndTestForLinuxBasedPlatforms: | |
name: Build for ${{ matrix.targetPlatform }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
projectPath: | |
- unity-sdk | |
unityVersion: | |
- 2022.3.17f1 | |
targetPlatform: | |
- StandaloneLinux64 # Build a Linux 64-bit standalone. | |
- iOS # Build an iOS player. | |
- Android # Build an Android player. | |
- WebGL # WebGL. | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lfs: false | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.projectPath }}/Library | |
key: | |
Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-${{ | |
hashFiles(matrix.projectPath) }} | |
restore-keys: | | |
Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}- | |
Library-${{ matrix.projectPath }}- | |
Library- | |
- name: Setup config.json | |
env: | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
run: | | |
mkdir -p Assets/Tests/Resources | |
echo '{"clientId": "${{ secrets.CLIENT_ID }}"}' > Assets/Tests/Resources/config.json | |
shell: bash | |
- uses: game-ci/unity-test-runner@v4 | |
id: testRunner | |
env: | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
projectPath: ${{ matrix.projectPath }} | |
unityVersion: ${{ matrix.unityVersion }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
testMode: PlayMode # Run PlayMode tests. | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: Test results (all modes) | |
path: ${{ steps.testRunner.outputs.artifactsPath }} | |
- if: matrix.targetPlatform == 'Android' | |
uses: jlumbroso/[email protected] | |
- uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
projectPath: ${{ matrix.projectPath }} | |
unityVersion: ${{ matrix.unityVersion }} | |
targetPlatform: ${{ matrix.targetPlatform }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Build | |
path: build | |
buildForWindowsBasedPlatforms: | |
name: Build for ${{ matrix.targetPlatform }} | |
runs-on: windows-2022 | |
strategy: | |
fail-fast: false | |
matrix: | |
projectPath: | |
- unity-sdk | |
unityVersion: | |
- 2022.3.17f1 | |
targetPlatform: | |
- StandaloneWindows64 # Build a Windows 64-bit standalone. | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lfs: false | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.projectPath }}/Library | |
key: | |
Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-${{ | |
hashFiles(matrix.projectPath) }} | |
restore-keys: | | |
Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}- | |
Library-${{ matrix.projectPath }}- | |
Library- | |
- uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
projectPath: ${{ matrix.projectPath }} | |
unityVersion: ${{ matrix.unityVersion }} | |
targetPlatform: ${{ matrix.targetPlatform }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Build | |
path: build | |
buildForMacOSBasedPlatforms: | |
name: Build for ${{ matrix.targetPlatform }} | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
projectPath: | |
- unity-sdk | |
unityVersion: | |
- 2022.3.17f1 | |
targetPlatform: | |
- StandaloneOSX # Build a macOS standalone. | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lfs: false | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.projectPath }}/Library | |
key: | |
Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-${{ | |
hashFiles(matrix.projectPath) }} | |
restore-keys: | | |
Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}- | |
Library-${{ matrix.projectPath }}- | |
Library- | |
- uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
projectPath: ${{ matrix.projectPath }} | |
unityVersion: ${{ matrix.unityVersion }} | |
targetPlatform: ${{ matrix.targetPlatform }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Build | |
path: build |