Last active
April 28, 2022 22:20
-
-
Save aallbrig/c54066dfcb6e2cd527c9313f396c7f48 to your computer and use it in GitHub Desktop.
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 CI CD Pipeline | |
on: | |
push: | |
paths: | |
- 'unity/**' | |
pull_request: | |
paths: | |
- 'unity/**' | |
workflow_dispatch: | |
paths: | |
- 'unity/**' | |
jobs: | |
tests: | |
name: Test in ${{ matrix.testMode }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
projectPath: | |
- unity/UNITY_PROJECT_DIRECTORY_NAME | |
testMode: | |
- playmode | |
- editmode | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
lfs: true | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ matrix.projectPath }}/Library | |
key: Library-${{ matrix.projectPath }} | |
restore-keys: | | |
Library- | |
- uses: game-ci/unity-test-runner@v2 | |
id: tests | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
with: | |
projectPath: ${{ matrix.projectPath }} | |
testMode: ${{ matrix.testMode }} | |
artifactsPath: ${{ matrix.testMode }}-artifacts | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
checkName: ${{ matrix.testMode }} Test Results | |
- uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: Test results for ${{ matrix.testMode }} | |
path: ${{ steps.tests.outputs.artifactsPath }} | |
builds: | |
name: Build ${{ matrix.targetPlatform }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
projectPath: | |
- unity/UNITY_PROJECT_DIRECTORY_NAME | |
targetPlatform: | |
- WebGL | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
lfs: true | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ matrix.projectPath }}/Library | |
key: Library-${{ matrix.projectPath}}/${{ matrix.targetPlatform }} | |
restore-keys: | | |
Library-${{ matrix.projectPath }}- | |
Library- | |
- uses: game-ci/unity-builder@v2 | |
id: builds | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
with: | |
targetPlatform: ${{ matrix.targetPlatform }} | |
projectPath: ${{ matrix.projectPath }} | |
buildName: ${{ matrix.targetPlatform }} | |
allowDirtyBuild: true | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: Build-${{ matrix.targetPlatform }} | |
path: build/${{ matrix.targetPlatform }} | |
deploy: | |
name: Deploys WebGL Game to Github Pages | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
needs: [tests, builds] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
lfs: true | |
- uses: actions/download-artifact@v2 | |
with: | |
name: Build-WebGL | |
path: build/WebGL | |
- uses: JamesIves/github-pages-deploy-action@4.1.5 | |
with: | |
branch: github-pages | |
folder: build/WebGL | |
target-folder: docs | |
clean: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment