Support new unity versioning scheme with regex matching groups (#264)
* Support new unity versioning scheme with regex matching groups * Update github action packages * Pin windows runner image version to 2022. Fix artifact name. Remove max-parallel cap for testspull/267/head
parent
75d0d76deb
commit
fea469be8c
|
@ -31,11 +31,10 @@ jobs:
|
|||
runs-on: ${{ matrix.baseRunner }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 2
|
||||
matrix:
|
||||
baseRunner:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
- windows-2022
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
unityVersion:
|
||||
|
@ -58,7 +57,7 @@ jobs:
|
|||
###########################
|
||||
# Cache #
|
||||
###########################
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ matrix.projectPath }}/Library
|
||||
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
|
||||
|
@ -72,9 +71,9 @@ jobs:
|
|||
testMode: ${{ matrix.testMode }}
|
||||
artifactsPath: ${{ matrix.testMode }}-artifacts
|
||||
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Test results for ${{ matrix.testMode }}
|
||||
name: Test results for ${{ matrix.testMode }} (${{ matrix.baseRunner }}, ${{ matrix.unityVersion }})
|
||||
path: ${{ steps.tests.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
|
@ -86,7 +85,7 @@ jobs:
|
|||
matrix:
|
||||
baseRunner:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
- windows-2022
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
unityVersion:
|
||||
|
@ -104,7 +103,7 @@ jobs:
|
|||
###########################
|
||||
# Cache #
|
||||
###########################
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ matrix.projectPath }}/Library
|
||||
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
|
||||
|
@ -124,17 +123,17 @@ jobs:
|
|||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Test results (all)
|
||||
name: Test results (all) (${{ matrix.baseRunner }}, ${{ matrix.unityVersion }})
|
||||
path: ${{ steps.allTests.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
# Upload coverage
|
||||
- name: Upload coverage results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Coverage results (all)
|
||||
name: Coverage results (all) (${{ matrix.baseRunner }}, ${{ matrix.unityVersion }})
|
||||
path: ${{ steps.allTests.outputs.coveragePath }}
|
||||
retention-days: 14
|
||||
|
||||
|
@ -146,7 +145,7 @@ jobs:
|
|||
matrix:
|
||||
baseRunner:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
- windows-2022
|
||||
unityVersion:
|
||||
- 2022.3.13f1
|
||||
- 2023.1.19f1
|
||||
|
@ -167,7 +166,7 @@ jobs:
|
|||
###########################
|
||||
# Cache #
|
||||
###########################
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ matrix.projectPath }}/Library
|
||||
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
|
||||
|
@ -187,17 +186,17 @@ jobs:
|
|||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Test results (edit mode)
|
||||
name: Test results (edit mode) (${{ matrix.baseRunner }}, ${{ matrix.unityVersion }}, ${{ matrix.runAsHostUser }})
|
||||
path: ${{ steps.editMode.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
# Upload coverage
|
||||
- name: Upload coverage results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Coverage results (edit mode)
|
||||
name: Coverage results (edit mode) (${{ matrix.baseRunner }}, ${{ matrix.unityVersion }}, ${{ matrix.runAsHostUser }})
|
||||
path: ${{ steps.editMode.outputs.coveragePath }}
|
||||
retention-days: 14
|
||||
|
||||
|
@ -209,7 +208,7 @@ jobs:
|
|||
matrix:
|
||||
baseRunner:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
- windows-2022
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
unityVersion:
|
||||
|
@ -227,7 +226,7 @@ jobs:
|
|||
###########################
|
||||
# Cache #
|
||||
###########################
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ matrix.projectPath }}/Library
|
||||
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
|
||||
|
@ -246,17 +245,17 @@ jobs:
|
|||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Test results (play mode)
|
||||
name: Test results (play mode) (${{ matrix.baseRunner }}, ${{ matrix.unityVersion }})
|
||||
path: ${{ steps.playMode.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
# Upload coverage
|
||||
- name: Upload coverage results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Coverage results (play mode)
|
||||
name: Coverage results (play mode) (${{ matrix.baseRunner }}, ${{ matrix.unityVersion }})
|
||||
path: ${{ steps.playMode.outputs.coveragePath }}
|
||||
retention-days: 14
|
||||
|
||||
|
@ -268,7 +267,7 @@ jobs:
|
|||
matrix:
|
||||
baseRunner:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
- windows-2022
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
unityVersion:
|
||||
|
@ -286,12 +285,11 @@ jobs:
|
|||
###########################
|
||||
# Cache #
|
||||
###########################
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ matrix.projectPath }}/Library
|
||||
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
||||
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
|
||||
restore-keys: |
|
||||
Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}-
|
||||
Library-${{ matrix.baseRunner }}-
|
||||
|
||||
# Configure test runner
|
||||
|
@ -306,9 +304,9 @@ jobs:
|
|||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Test results (play mode)
|
||||
name: Test results (play mode standalone) (${{ matrix.baseRunner }}, ${{ matrix.unityVersion }})
|
||||
path: ${{ steps.standalone.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
|
@ -320,7 +318,7 @@ jobs:
|
|||
matrix:
|
||||
baseRunner:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
- windows-2022
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
unityVersion:
|
||||
|
@ -338,7 +336,7 @@ jobs:
|
|||
###########################
|
||||
# Cache #
|
||||
###########################
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ matrix.projectPath }}/Library
|
||||
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
|
||||
|
@ -365,9 +363,9 @@ jobs:
|
|||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Test results (play mode)
|
||||
name: Test results (play mode standalone il2cpp) (${{ matrix.baseRunner }}, ${{ matrix.unityVersion }})
|
||||
path: ${{ steps.standalone.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
|
@ -379,7 +377,7 @@ jobs:
|
|||
matrix:
|
||||
baseRunner:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
- windows-2022
|
||||
unityVersion:
|
||||
- 2022.3.13f1
|
||||
- 2023.1.19f1
|
||||
|
@ -397,7 +395,7 @@ jobs:
|
|||
###########################
|
||||
# Cache #
|
||||
###########################
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ matrix.projectPath }}/Library
|
||||
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
|
||||
|
@ -433,9 +431,9 @@ jobs:
|
|||
|
||||
# Upload combined artifacts
|
||||
- name: Upload combined test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Test results (combined)
|
||||
name: Test results (combined sequential) (${{ matrix.baseRunner }}, ${{ matrix.unityVersion }})
|
||||
path: artifacts/
|
||||
retention-days: 14
|
||||
|
||||
|
@ -474,9 +472,9 @@ jobs:
|
|||
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
|
||||
packageMode: true
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package test results for ${{ matrix.testMode }}
|
||||
name: Package test results for ${{ matrix.testMode }} (${{ matrix.unityVersion }})
|
||||
path: ${{ steps.packageTests.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
|
@ -514,17 +512,17 @@ jobs:
|
|||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package test results (all)
|
||||
name: Package test results (all) (${{ matrix.unityVersion }})
|
||||
path: ${{ steps.packageAllTests.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
# Upload coverage
|
||||
- name: Upload coverage results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package Coverage results (all)
|
||||
name: Package Coverage results (all) (${{ matrix.unityVersion }})
|
||||
path: ${{ steps.packageAllTests.outputs.coveragePath }}
|
||||
retention-days: 14
|
||||
|
||||
|
@ -562,17 +560,17 @@ jobs:
|
|||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package test results (edit mode)
|
||||
name: Package test results (edit mode) (${{ matrix.unityVersion }})
|
||||
path: ${{ steps.packageEditMode.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
# Upload coverage
|
||||
- name: Upload coverage results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package Coverage results (edit mode)
|
||||
name: Package Coverage results (edit mode) (${{ matrix.unityVersion }})
|
||||
path: ${{ steps.packageEditMode.outputs.coveragePath }}
|
||||
retention-days: 14
|
||||
|
||||
|
@ -610,17 +608,17 @@ jobs:
|
|||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package test results (play mode)
|
||||
name: Package test results (play mode) (${{ matrix.unityVersion }})
|
||||
path: ${{ steps.packagePlayMode.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
# Upload coverage
|
||||
- name: Upload coverage results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package Coverage results (play mode)
|
||||
name: Package Coverage results (play mode) (${{ matrix.unityVersion }})
|
||||
path: ${{ steps.packagePlayMode.outputs.coveragePath }}
|
||||
retention-days: 14
|
||||
|
||||
|
@ -666,9 +664,9 @@ jobs:
|
|||
|
||||
# Upload combined artifacts
|
||||
- name: Upload combined test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package test results (combined)
|
||||
name: Package test results (combined sequential) (${{ matrix.unityVersion }})
|
||||
path: packageArtifacts/
|
||||
retention-days: 14
|
||||
|
||||
|
@ -708,17 +706,17 @@ jobs:
|
|||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package test results (all)
|
||||
name: Package test results (Scope Registry) (${{ matrix.unityVersion }})
|
||||
path: ${{ steps.packageAllTests.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
# Upload coverage
|
||||
- name: Upload coverage results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package Coverage results (all)
|
||||
name: Package Coverage results (Scope Registry) (${{ matrix.unityVersion }})
|
||||
path: ${{ steps.packageAllTests.outputs.coveragePath }}
|
||||
retention-days: 14
|
||||
|
||||
|
@ -758,16 +756,16 @@ jobs:
|
|||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package test results (all)
|
||||
name: Package test results (Multi Scope Regristy) (${{ matrix.unityVersion }})
|
||||
path: ${{ steps.packageAllTests.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
# Upload coverage
|
||||
- name: Upload coverage results
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Package Coverage results (all)
|
||||
name: Package Coverage results (Multi Scope Registry) (${{ matrix.unityVersion }})
|
||||
path: ${{ steps.packageAllTests.outputs.coveragePath }}
|
||||
retention-days: 14
|
||||
|
|
|
@ -1411,15 +1411,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const UnityVersionParser = {
|
||||
get versionPattern() {
|
||||
return /20\d{2}\.\d\.\w{3,4}|3/;
|
||||
},
|
||||
parse(projectVersionTxt) {
|
||||
const matches = projectVersionTxt.match(UnityVersionParser.versionPattern);
|
||||
if (!matches || matches.length === 0) {
|
||||
throw new Error(`Failed to parse version from "${projectVersionTxt}".`);
|
||||
const versionRegex = /m_EditorVersion: (\d+\.\d+\.\d+[A-Za-z]?\d+)/;
|
||||
const matches = projectVersionTxt.match(versionRegex);
|
||||
if (!matches || matches.length < 2) {
|
||||
throw new Error(`Failed to extract version from "${projectVersionTxt}".`);
|
||||
}
|
||||
return matches[0];
|
||||
return matches[1];
|
||||
},
|
||||
read(projectPath) {
|
||||
const filePath = path_1.default.join(projectPath, 'ProjectSettings', 'ProjectVersion.txt');
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,6 +11,12 @@ describe('UnityVersionParser', () => {
|
|||
m_EditorVersionWithRevision: 2022.3.7f1 (b16b3b16c7a0)`;
|
||||
expect(UnityVersionParser.parse(projectVersionContents)).toBe('2022.3.7f1');
|
||||
});
|
||||
|
||||
it('parses Unity 6000 and newer from ProjectVersion.txt', () => {
|
||||
const projectVersionContents = `m_EditorVersion: 6000.0.0f1
|
||||
m_EditorVersionWithRevision: 6000.0.0f1 (cb45f9cae8b7)`;
|
||||
expect(UnityVersionParser.parse(projectVersionContents)).toBe('6000.0.0f1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('read', () => {
|
||||
|
|
|
@ -2,16 +2,15 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
|
||||
const UnityVersionParser = {
|
||||
get versionPattern() {
|
||||
return /20\d{2}\.\d\.\w{3,4}|3/;
|
||||
},
|
||||
|
||||
parse(projectVersionTxt) {
|
||||
const matches = projectVersionTxt.match(UnityVersionParser.versionPattern);
|
||||
if (!matches || matches.length === 0) {
|
||||
throw new Error(`Failed to parse version from "${projectVersionTxt}".`);
|
||||
const versionRegex = /m_EditorVersion: (\d+\.\d+\.\d+[A-Za-z]?\d+)/;
|
||||
const matches = projectVersionTxt.match(versionRegex);
|
||||
|
||||
if (!matches || matches.length < 2) {
|
||||
throw new Error(`Failed to extract version from "${projectVersionTxt}".`);
|
||||
}
|
||||
return matches[0];
|
||||
|
||||
return matches[1];
|
||||
},
|
||||
|
||||
read(projectPath) {
|
||||
|
|
Loading…
Reference in New Issue