Add workflow caching and strategy for multiple versions

pull/11/head
Webber 2020-01-29 21:32:58 +01:00 committed by Webber Takken
parent 311b685893
commit a08a398026
1 changed files with 91 additions and 29 deletions

View File

@ -10,24 +10,39 @@ jobs:
testRunnerInAllModes: testRunnerInAllModes:
name: Test all modes ✨ name: Test all modes ✨
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unityVersion:
- 2018.4.15f1
- 2019.2.11f1
projectPath:
- unity-project-with-correct-tests
steps: steps:
# Checkout repository (required to test local actions) # Checkout repository (required to test local actions)
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v1 uses: actions/checkout@v2
with:
lfs: true
# Activate license # Enable caching
- name: Activate Unity - uses: actions/cache@v1.1.0
uses: webbertakken/unity-activate@v1 with:
env: path: ${{ matrix.projectPath }}/Library
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# Configure test runner # Configure test runner
- name: Run tests - name: Run tests
id: allTests id: allTests
uses: ./ uses: ./
with:
unityVersion: ${{ matrix.unityVersion }}
env: env:
TEST_MODE: all TEST_MODE: all
PROJECT_PATH: unity-project-with-correct-tests PROJECT_PATH: ${{ matrix.projectPath }}
# Test implicit ARTIFACTS_PATH, by not setting it # Test implicit ARTIFACTS_PATH, by not setting it
# Upload artifacts # Upload artifacts
@ -40,24 +55,39 @@ jobs:
testRunnerInEditMode: testRunnerInEditMode:
name: Test edit mode 📝 name: Test edit mode 📝
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unityVersion:
- 2018.4.15f1
- 2019.2.11f1
projectPath:
- unity-project-with-correct-tests
steps: steps:
# Checkout repository (required to test local actions) # Checkout repository (required to test local actions)
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v1 uses: actions/checkout@v2
with:
lfs: true
# Activate license # Enable caching
- name: Activate Unity - uses: actions/cache@v1.1.0
uses: webbertakken/unity-activate@v1 with:
env: path: ${{ matrix.projectPath }}/Library
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# Configure test runner # Configure test runner
- name: Run tests - name: Run tests
id: editMode id: editMode
uses: ./ uses: ./
with:
unityVersion: ${{ matrix.unityVersion }}
env: env:
TEST_MODE: editmode TEST_MODE: editmode
PROJECT_PATH: unity-project-with-correct-tests PROJECT_PATH: ${{ matrix.projectPath }}
ARTIFACTS_PATH: artifacts/editmode ARTIFACTS_PATH: artifacts/editmode
# Upload artifacts # Upload artifacts
@ -70,24 +100,39 @@ jobs:
testRunnerInPlayMode: testRunnerInPlayMode:
name: Test play mode 📺 name: Test play mode 📺
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unityVersion:
- 2018.4.15f1
- 2019.2.11f1
projectPath:
- unity-project-with-correct-tests
steps: steps:
# Checkout repository (required to test local actions) # Checkout repository (required to test local actions)
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v1 uses: actions/checkout@v2
with:
lfs: true
# Activate license # Enable caching
- name: Activate Unity - uses: actions/cache@v1.1.0
uses: webbertakken/unity-activate@v1 with:
env: path: ${{ matrix.projectPath }}/Library
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# Configure test runner # Configure test runner
- name: Run tests - name: Run tests
id: playMode id: playMode
uses: ./ uses: ./
with:
unityVersion: ${{ matrix.unityVersion }}
env: env:
TEST_MODE: playmode TEST_MODE: playmode
PROJECT_PATH: unity-project-with-correct-tests PROJECT_PATH: ${{ matrix.projectPath }}
ARTIFACTS_PATH: artifacts/editmode ARTIFACTS_PATH: artifacts/editmode
# Upload artifacts # Upload artifacts
@ -100,31 +145,48 @@ jobs:
testRunnerInEachModeSeparately: testRunnerInEachModeSeparately:
name: Test each mode sequentially 👩‍👩‍👧‍👦 # don't try this at home (it's much slower) name: Test each mode sequentially 👩‍👩‍👧‍👦 # don't try this at home (it's much slower)
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
unityVersion:
- 2018.4.15f1
- 2019.2.11f1
projectPath:
- unity-project-with-correct-tests
steps: steps:
# Checkout repository (required to test local actions) # Checkout repository (required to test local actions)
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v1 uses: actions/checkout@v2
with:
lfs: true
# Activate license # Enable caching
- name: Activate Unity - uses: actions/cache@v1.1.0
uses: webbertakken/unity-activate@v1 with:
env: path: ${{ matrix.projectPath }}/Library
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# Configure first test runner # Configure first test runner
- name: Tests in editmode 📝 - name: Tests in editmode 📝
uses: ./ uses: ./
with:
unityVersion: ${{ matrix.unityVersion }}
env: env:
TEST_MODE: editmode TEST_MODE: editmode
PROJECT_PATH: unity-project-with-correct-tests PROJECT_PATH: ${{ matrix.projectPath }}
ARTIFACTS_PATH: artifacts/editmode ARTIFACTS_PATH: artifacts/editmode
# Configure second test runner # Configure second test runner
- name: Tests in playmode 📺 - name: Tests in playmode 📺
uses: ./ uses: ./
with:
unityVersion: ${{ matrix.unityVersion }}
env: env:
TEST_MODE: playmode TEST_MODE: playmode
PROJECT_PATH: unity-project-with-correct-tests PROJECT_PATH: ${{ matrix.projectPath }}
ARTIFACTS_PATH: artifacts/playmode ARTIFACTS_PATH: artifacts/playmode
# Upload combined artifacts # Upload combined artifacts