unity-test #256
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
# Secrets | |
# UNITY_LICENSE: | |
name: unity-test | |
on: | |
push: | |
branches: | |
- develop | |
tags: | |
- "!*" | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
schedule: | |
- cron: "0 0 * * 0" # weekly | |
workflow_dispatch: | |
env: | |
MINIMUM_UNITY_VERSION: 2018.3 | |
EXCLUDE_UNITY_VERSION: "2018.3|2019.2" | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
versions: ${{ steps.setup.outputs.versions }} | |
steps: | |
- id: setup | |
run: | | |
VERSIONS=`npx unity-changeset list --versions --all --latest-patch --min ${{ env.MINIMUM_UNITY_VERSION }} --json \ | |
| jq -c '[ .[] | select(test("${{ env.EXCLUDE_UNITY_VERSION }}")==false) ]'` | |
echo "::set-output name=versions::$VERSIONS" | |
test: | |
runs-on: ubuntu-latest | |
needs: setup | |
strategy: | |
max-parallel: 4 | |
fail-fast: false | |
matrix: | |
version: ${{ fromJson(needs.setup.outputs.versions) }} | |
steps: | |
# Checkout sandbox project | |
- uses: actions/checkout@v2 | |
with: | |
ref: sandbox | |
submodules: true | |
fetch-depth: 0 | |
# Update package submodule | |
- name: "Update package submodule" | |
working-directory: Packages/dev | |
run: git checkout ${{ github.sha }} | |
- name: "Setup" | |
id: setup | |
run: | | |
# Remove CSC_SETTINGS_DEVELOP symbol | |
sed -i -e 's/CSC_SETTINGS_DEVELOP//' ProjectSettings/ProjectSettings.asset | |
# IL2CPP Support | |
echo '${{ matrix.version }}' | grep -q '\(2018\|2019.1\|2019.2\|2019.3\|2020.1\)' \ | |
&& echo "module=" >> $GITHUB_ENV | tee \ | |
|| echo "module=-linux-il2cpp" >> $GITHUB_ENV | tee | |
# Cache | |
# - uses: actions/cache@v2 | |
# with: | |
# path: Library | |
# key: Library-${{ matrix.version }}-${{ github.sha }} | |
# restore-keys: | | |
# Library-${{ matrix.version }}- | |
# Library- | |
# Run tests | |
- name: Run tests | |
uses: game-ci/unity-test-runner@main | |
with: | |
customImage: mobsakai/unity3d:${{ matrix.version }}${{ env.module }} | |
customParameters: -nographics | |
testMode: playmode | |
checkName: ${{ matrix.version }} Test Results | |
githubToken: ${{ github.token }} | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
# Build (Mono) | |
- name: Build (Mono) | |
uses: game-ci/unity-builder@main | |
with: | |
customImage: mobsakai/unity3d:${{ matrix.version }}${{ env.module }} | |
customParameters: -nographics /Headless /ScriptBackend Mono2x /BuildTarget StandaloneLinux64 | |
targetPlatform: StandaloneLinux64 | |
buildMethod: UnitTestBuilder.BuildUnitTest | |
allowDirtyBuild: true | |
versioning: Custom | |
version: 1.0.0 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
# Execute unit test player (Mono) | |
- name: "Execute unit test player (Mono)" | |
run: | | |
tree ./bin | |
./bin/UnitTest/StandaloneLinux64_Mono2x/test | |
# Build (IL2CPP) | |
- name: Build (IL2CPP) | |
uses: game-ci/unity-builder@main | |
if: env.module == '-linux-il2cpp' | |
with: | |
customImage: mobsakai/unity3d:${{ matrix.version }}${{ env.module }} | |
customParameters: -nographics /Headless /ScriptBackend IL2CPP /BuildTarget StandaloneLinux64 | |
targetPlatform: StandaloneLinux64 | |
buildMethod: UnitTestBuilder.BuildUnitTest | |
allowDirtyBuild: true | |
versioning: Custom | |
version: 1.0.0 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
# Execute unit test player (IL2CPP) | |
- name: "Execute unit test player (IL2CPP)" | |
if: env.module == '-linux-il2cpp' | |
run: | | |
tree ./bin | |
./bin/UnitTest/StandaloneLinux64_IL2CPP/test |