291 lines
11 KiB
YAML
291 lines
11 KiB
YAML
name: Actions 😎
|
|
on:
|
|
push: { branches: [main] }
|
|
pull_request:
|
|
paths-ignore:
|
|
- '.github/**'
|
|
|
|
env:
|
|
UNITY_LICENSE: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>\n <License id=\"Terms\">\n <MachineBindings>\n <Binding Key=\"1\" Value=\"576562626572264761624c65526f7578\"/>\n <Binding Key=\"2\" Value=\"576562626572264761624c65526f7578\"/>\n </MachineBindings>\n <MachineID Value=\"D7nTUnjNAmtsUMcnoyrqkgIbYdM=\"/>\n <SerialHash Value=\"2033b8ac3e6faa3742ca9f0bfae44d18f2a96b80\"/>\n <Features>\n <Feature Value=\"33\"/>\n <Feature Value=\"1\"/>\n <Feature Value=\"12\"/>\n <Feature Value=\"2\"/>\n <Feature Value=\"24\"/>\n <Feature Value=\"3\"/>\n <Feature Value=\"36\"/>\n <Feature Value=\"17\"/>\n <Feature Value=\"19\"/>\n <Feature Value=\"62\"/>\n </Features>\n <DeveloperData Value=\"AQAAAEY0LUJHUlgtWEQ0RS1aQ1dWLUM1SlctR0RIQg==\"/>\n <SerialMasked Value=\"F4-BGRX-XD4E-ZCWV-C5JW-XXXX\"/>\n <StartDate Value=\"2021-02-08T00:00:00\"/>\n <UpdateDate Value=\"2021-02-09T00:34:57\"/>\n <InitialActivationDate Value=\"2021-02-08T00:34:56\"/>\n <LicenseVersion Value=\"6.x\"/>\n <ClientProvidedVersion Value=\"2018.4.30f1\"/>\n <AlwaysOnline Value=\"false\"/>\n <Entitlements>\n <Entitlement Ns=\"unity_editor\" Tag=\"UnityPersonal\" Type=\"EDITOR\" ValidTo=\"9999-12-31T00:00:00\"/>\n <Entitlement Ns=\"unity_editor\" Tag=\"DarkSkin\" Type=\"EDITOR_FEATURE\" ValidTo=\"9999-12-31T00:00:00\"/>\n </Entitlements>\n </License>\n<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\"/><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/><Reference URI=\"#Terms\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>m0Db8UK+ktnOLJBtHybkfetpcKo=</DigestValue></Reference></SignedInfo><SignatureValue>o/pUbSQAukz7+ZYAWhnA0AJbIlyyCPL7bKVEM2lVqbrXt7cyey+umkCXamuOgsWPVUKBMkXtMH8L\n5etLmD0getWIhTGhzOnDCk+gtIPfL4jMo9tkEuOCROQAXCci23VFscKcrkB+3X6h4wEOtA2APhOY\nB+wvC794o8/82ffjP79aVAi57rp3Wmzx+9pe9yMwoJuljAy2sc2tIMgdQGWVmOGBpQm3JqsidyzI\nJWG2kjnc7pDXK9pwYzXoKiqUqqrut90d+kQqRyv7MSZXR50HFqD/LI69h68b7P8Bjo3bPXOhNXGR\n9YCoemH6EkfCJxp2gIjzjWW+l2Hj2EsFQi8YXw==</SignatureValue></Signature></root>"
|
|
|
|
jobs:
|
|
tests:
|
|
name: Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 12.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:
|
|
- 2019.2.11f1
|
|
testMode:
|
|
- playmode
|
|
- editmode
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
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:
|
|
- 2019.2.11f1
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v3
|
|
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: 'enableCyclomaticComplexity;generateHtmlReport;generateBadgeReport;assemblyFilters:+MyScripts'
|
|
# 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:
|
|
- 2019.2.11f1
|
|
projectPath:
|
|
- unity-project-with-correct-tests
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v3
|
|
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:
|
|
- 2019.2.11f1
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v3
|
|
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
|
|
|
|
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:
|
|
- 2019.2.11f1
|
|
projectPath:
|
|
- unity-project-with-correct-tests
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v3
|
|
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
|
|
|
|
# Upload combined artifacts
|
|
- name: Upload combined test results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Test results (combined)
|
|
path: artifacts/
|
|
retention-days: 14
|