652 lines
19 KiB
YAML
652 lines
19 KiB
YAML
name: Actions 😎
|
|
on:
|
|
push:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
|
|
jobs:
|
|
tests:
|
|
name: Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18.x
|
|
- run: yarn
|
|
- run: yarn lint
|
|
- run: yarn test
|
|
- run: yarn build || { echo "build command should always succeed" ; exit 61; }
|
|
# - run: yarn build --quiet && git diff --quiet action || { echo "ERROR - index.js is different from repository version. Forgot to run `yarn build`?" ; exit 62; }
|
|
|
|
testAllModesLikeInTheReadme:
|
|
name: Test in ${{ matrix.testMode }} on version ${{ matrix.unityVersion }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
projectPath:
|
|
- unity-project-with-correct-tests
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
testMode:
|
|
- playmode
|
|
- editmode
|
|
- standalone
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
###########################
|
|
# Cache #
|
|
###########################
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: ${{ matrix.projectPath }}/Library
|
|
key: Library-${{ matrix.projectPath }}
|
|
restore-keys: |
|
|
Library-
|
|
- uses: ./
|
|
id: tests
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: ${{ matrix.testMode }}
|
|
artifactsPath: ${{ matrix.testMode }}-artifacts
|
|
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Test results for ${{ matrix.testMode }}
|
|
path: ${{ steps.tests.outputs.artifactsPath }}
|
|
retention-days: 14
|
|
|
|
testRunnerInAllModes:
|
|
name: Test all modes ✨
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
projectPath:
|
|
- unity-project-with-correct-tests
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
###########################
|
|
# Cache #
|
|
###########################
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: ${{ matrix.projectPath }}/Library
|
|
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
|
restore-keys: |
|
|
Library-${{ matrix.projectPath }}-
|
|
Library-
|
|
|
|
# Configure test runner
|
|
- name: Run tests
|
|
id: allTests
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: all
|
|
coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+MyScripts;dontClear'
|
|
# Test implicit artifactsPath, by not setting it
|
|
|
|
# Upload artifacts
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Test results (all)
|
|
path: ${{ steps.allTests.outputs.artifactsPath }}
|
|
retention-days: 14
|
|
|
|
# Upload coverage
|
|
- name: Upload coverage results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Coverage results (all)
|
|
path: ${{ steps.allTests.outputs.coveragePath }}
|
|
retention-days: 14
|
|
|
|
testRunnerInEditMode:
|
|
name: Test edit mode 📝
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
projectPath:
|
|
- unity-project-with-correct-tests
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
###########################
|
|
# Cache #
|
|
###########################
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: ${{ matrix.projectPath }}/Library
|
|
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
|
restore-keys: |
|
|
Library-${{ matrix.projectPath }}-
|
|
Library-
|
|
|
|
# Configure test runner
|
|
- name: Run tests
|
|
id: editMode
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: editmode
|
|
artifactsPath: artifacts/editmode
|
|
|
|
# Upload artifacts
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Test results (edit mode)
|
|
path: ${{ steps.editMode.outputs.artifactsPath }}
|
|
retention-days: 14
|
|
|
|
# Upload coverage
|
|
- name: Upload coverage results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Coverage results (edit mode)
|
|
path: ${{ steps.editMode.outputs.coveragePath }}
|
|
retention-days: 14
|
|
|
|
testRunnerInPlayMode:
|
|
name: Test play mode 📺
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
projectPath:
|
|
- unity-project-with-correct-tests
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
###########################
|
|
# Cache #
|
|
###########################
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: ${{ matrix.projectPath }}/Library
|
|
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
|
restore-keys: |
|
|
Library-${{ matrix.projectPath }}-
|
|
Library-
|
|
|
|
# Configure test runner
|
|
- name: Run tests
|
|
id: playMode
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: playmode
|
|
artifactsPath: artifacts/playmode
|
|
|
|
# Upload artifacts
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Test results (play mode)
|
|
path: ${{ steps.playMode.outputs.artifactsPath }}
|
|
retention-days: 14
|
|
|
|
# Upload coverage
|
|
- name: Upload coverage results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Coverage results (play mode)
|
|
path: ${{ steps.playMode.outputs.coveragePath }}
|
|
retention-days: 14
|
|
|
|
testRunnerInStandalone:
|
|
name: Test standalone 📺
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
projectPath:
|
|
- unity-project-with-correct-tests
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
###########################
|
|
# Cache #
|
|
###########################
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: ${{ matrix.projectPath }}/Library
|
|
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
|
restore-keys: |
|
|
Library-${{ matrix.projectPath }}-
|
|
Library-
|
|
|
|
# Configure test runner
|
|
- name: Run tests
|
|
id: standalone
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: standalone
|
|
artifactsPath: artifacts/standalone
|
|
|
|
# Upload artifacts
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Test results (play mode)
|
|
path: ${{ steps.standalone.outputs.artifactsPath }}
|
|
retention-days: 14
|
|
|
|
testRunnerInStandaloneWithIL2CPP:
|
|
name: Test standalone with IL2CPP 📺
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
projectPath:
|
|
- unity-project-with-correct-tests
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
###########################
|
|
# Cache #
|
|
###########################
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: ${{ matrix.projectPath }}/Library
|
|
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
|
restore-keys: |
|
|
Library-${{ matrix.projectPath }}-
|
|
Library-
|
|
|
|
# Set scripting backend to IL2CPP
|
|
- name: Rewrite ProjectSettings
|
|
run: |
|
|
DefineOriginal=" scriptingBackend: {}"
|
|
DefineReplace=" scriptingBackend: \\n Standalone: 1"
|
|
sed -i "{s/$DefineOriginal/$DefineReplace/g}" ${{ matrix.projectPath }}/ProjectSettings/ProjectSettings.asset
|
|
|
|
# Configure test runner
|
|
- name: Run tests
|
|
id: standalone
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: standalone
|
|
artifactsPath: artifacts/standalone
|
|
|
|
# Upload artifacts
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Test results (play mode)
|
|
path: ${{ steps.standalone.outputs.artifactsPath }}
|
|
retention-days: 14
|
|
|
|
testEachModeSequentially:
|
|
name: Test each mode sequentially 👩👩👧👦 # don't try this at home (it's much slower)
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
projectPath:
|
|
- unity-project-with-correct-tests
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
###########################
|
|
# Cache #
|
|
###########################
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: ${{ matrix.projectPath }}/Library
|
|
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
|
restore-keys: |
|
|
Library-${{ matrix.projectPath }}-
|
|
Library-
|
|
|
|
# Configure first test runner
|
|
- name: Tests in editmode 📝
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: editmode
|
|
artifactsPath: artifacts/editmode
|
|
|
|
# Configure second test runner
|
|
- name: Tests in playmode 📺
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: playmode
|
|
artifactsPath: artifacts/playmode
|
|
|
|
# Configure third test runner
|
|
- name: Tests in standalone 📺
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: standalone
|
|
artifactsPath: artifacts/playmode
|
|
|
|
# Upload combined artifacts
|
|
- name: Upload combined test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Test results (combined)
|
|
path: artifacts/
|
|
retention-days: 14
|
|
|
|
testAllPackageModesLikeInTheReadme:
|
|
name: Test package mode 📦 in ${{ matrix.testMode }} on version ${{ matrix.unityVersion }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
projectPath:
|
|
- unity-package-with-correct-tests/com.example.testpackage
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
testMode:
|
|
- playmode
|
|
- editmode
|
|
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
- uses: ./
|
|
id: packageTests
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: ${{ matrix.testMode }}
|
|
artifactsPath: ${{ matrix.testMode }}-packageArtifacts
|
|
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
|
|
packageMode: true
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Package test results for ${{ matrix.testMode }}
|
|
path: ${{ steps.packageTests.outputs.artifactsPath }}
|
|
retention-days: 14
|
|
|
|
testPackageRunnerInAllModes:
|
|
name: Test package mode in all modes 📦✨
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
projectPath:
|
|
- unity-package-with-correct-tests/com.example.testpackage
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
# Configure test runner
|
|
- name: Run tests
|
|
id: packageAllTests
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: all
|
|
coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+example.testpackage.*,-*Tests*'
|
|
packageMode: true
|
|
# Test implicit artifactsPath, by not setting it
|
|
|
|
# Upload artifacts
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Package test results (all)
|
|
path: ${{ steps.packageAllTests.outputs.artifactsPath }}
|
|
retention-days: 14
|
|
|
|
# Upload coverage
|
|
- name: Upload coverage results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Package Coverage results (all)
|
|
path: ${{ steps.packageAllTests.outputs.coveragePath }}
|
|
retention-days: 14
|
|
|
|
testPackageRunnerInEditMode:
|
|
name: Test package mode in edit mode 📦📝
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
projectPath:
|
|
- unity-package-with-correct-tests/com.example.testpackage
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
# Configure test runner
|
|
- name: Run tests
|
|
id: packageEditMode
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: editmode
|
|
coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+example.testpackage.*,-*Tests*'
|
|
artifactsPath: artifacts/packageeditmode
|
|
packageMode: true
|
|
|
|
# Upload artifacts
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Package test results (edit mode)
|
|
path: ${{ steps.packageEditMode.outputs.artifactsPath }}
|
|
retention-days: 14
|
|
|
|
# Upload coverage
|
|
- name: Upload coverage results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Package Coverage results (edit mode)
|
|
path: ${{ steps.packageEditMode.outputs.coveragePath }}
|
|
retention-days: 14
|
|
|
|
testPackageRunnerInPlayMode:
|
|
name: Test package mode in play mode 📦📺
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
projectPath:
|
|
- unity-package-with-correct-tests/com.example.testpackage
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
# Configure test runner
|
|
- name: Run tests
|
|
id: packagePlayMode
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: playmode
|
|
coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+example.testpackage.*,-*Tests*'
|
|
artifactsPath: artifacts/packageplaymode
|
|
packageMode: true
|
|
|
|
# Upload artifacts
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Package test results (play mode)
|
|
path: ${{ steps.packagePlayMode.outputs.artifactsPath }}
|
|
retention-days: 14
|
|
|
|
# Upload coverage
|
|
- name: Upload coverage results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Package Coverage results (play mode)
|
|
path: ${{ steps.packagePlayMode.outputs.coveragePath }}
|
|
retention-days: 14
|
|
|
|
testPackageModeEachModeSequentially:
|
|
name: Test package mode in each mode sequentially 📦 👩👩👧👦 # don't try this at home (it's much slower)
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
unityVersion:
|
|
- 2022.3.13f1
|
|
- 2023.1.19f1
|
|
- 2023.2.2f1
|
|
projectPath:
|
|
- unity-package-with-correct-tests/com.example.testpackage
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
# Configure first test runner
|
|
- name: Test package mode in editmode 📦📝
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: editmode
|
|
artifactsPath: packageArtifacts/editmode
|
|
packageMode: true
|
|
|
|
# Configure second test runner
|
|
- name: Test package mode in playmode 📦📺
|
|
uses: ./
|
|
with:
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
testMode: playmode
|
|
artifactsPath: packageArtifacts/playmode
|
|
packageMode: true
|
|
|
|
# Upload combined artifacts
|
|
- name: Upload combined test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Package test results (combined)
|
|
path: packageArtifacts/
|
|
retention-days: 14
|