test #31
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: Game test & build 🎮 | |
on: push | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
jobs: | |
testRunner: | |
name: Test in ${{ matrix.testMode }} ✨ | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
testMode: | |
- EditMode | |
- PlayMode | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v2 | |
id: lfs-cache | |
with: | |
path: test_game/.git/lfs | |
key: ${{ runner.os }}-lfs-${{ hashFiles('test_game/.lfs-assets-id') }} | |
- name: Git LFS Pull | |
run: | | |
cd test_game | |
git lfs pull | |
git add . | |
git reset --hard | |
- name: Restore Library cache | |
uses: actions/cache@v2 | |
with: | |
path: test_game/Library | |
key: Library-test-project-${{ matrix.targetPlatform }} | |
restore-keys: | | |
Library-test-project- | |
Library- | |
- name: Run tests | |
uses: game-ci/unity-test-runner@v2 | |
id: testRunner | |
with: | |
testMode: ${{ matrix.testMode }} | |
checkName: ${{ matrix.testMode }} test results | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
projectPath: test_game | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: Test results (${{ matrix.testMode }}) | |
path: ${{ steps.testRunner.outputs.artifactsPath }} | |
buildWebGL: | |
needs: testRunner | |
name: Build for WebGL 🖥️ | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
lfs: true | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v2 | |
id: lfs-cache | |
with: | |
path: game_test/.git/lfs | |
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} | |
- name: Git LFS Pull | |
run: | | |
git lfs pull | |
git add . | |
git reset --hard | |
git clean -fd | |
- name: Restore Library cache | |
uses: actions/cache@v2 | |
with: | |
path: test_game/Library | |
key: Library-build-WebGL | |
restore-keys: | | |
Library-build- | |
Library- | |
- uses: game-ci/unity-builder@v2 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
targetPlatform: WebGL | |
projectPath: test_game/game-build | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: build-WebGL | |
path: test_game/game-build | |
SaveToBuildFile: | |
needs: buildWebGL | |
name: Save to Game build file 🗂️ | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Copy WebGL build to build folder | |
run: | | |
cp -r test_game/game-build/. test_game/game-build | |
- name: Commit changes | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git add test_game/game-build | |
git commit -m "Update WebGL build [skip ci]" | |
git push |