Updated parameter names and default values for code coverage
parent
2e6c7ac4f3
commit
7c0f210aae
|
@ -105,8 +105,7 @@ jobs:
|
|||
projectPath: ${{ matrix.projectPath }}
|
||||
unityVersion: ${{ matrix.unityVersion }}
|
||||
testMode: all
|
||||
coverageParameters: 'enableCyclomaticComplexity;generateHtmlReport;generateBadgeReport;assemblyFilters:+MyScripts'
|
||||
coverageResultsPath: 'artifacts'
|
||||
coverageOptions: 'enableCyclomaticComplexity;generateHtmlReport;generateBadgeReport;assemblyFilters:+MyScripts'
|
||||
# Test implicit artifactsPath, by not setting it
|
||||
|
||||
# Upload artifacts
|
||||
|
@ -117,6 +116,14 @@ jobs:
|
|||
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
|
||||
|
@ -164,6 +171,14 @@ jobs:
|
|||
path: ${{ steps.editMode.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
|
||||
|
||||
testRunnerInPlayMode:
|
||||
name: Test play mode 📺
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -211,6 +226,14 @@ jobs:
|
|||
path: ${{ steps.playMode.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
|
||||
|
||||
testEachModeSequentially:
|
||||
name: Test each mode sequentially 👩👩👧👦 # don't try this at home (it's much slower)
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -248,7 +271,6 @@ jobs:
|
|||
unityVersion: ${{ matrix.unityVersion }}
|
||||
testMode: editmode
|
||||
artifactsPath: artifacts/editmode
|
||||
coverageResultsPath: artifacts/editmode
|
||||
|
||||
# Configure second test runner
|
||||
- name: Tests in playmode 📺
|
||||
|
@ -258,7 +280,6 @@ jobs:
|
|||
unityVersion: ${{ matrix.unityVersion }}
|
||||
testMode: playmode
|
||||
artifactsPath: artifacts/playmode
|
||||
coverageResultsPath: artifacts/playmode
|
||||
|
||||
# Upload combined artifacts
|
||||
- name: Upload combined test results
|
||||
|
|
|
@ -20,14 +20,10 @@ inputs:
|
|||
required: false
|
||||
default: 'all'
|
||||
description: 'The type of tests to be run by the test runner.'
|
||||
coverageParameters:
|
||||
coverageOptions:
|
||||
required: false
|
||||
default: 'enableCyclomaticComplexity;generateHtmlReport;generateBadgeReport'
|
||||
description: 'Optional coverage parameters for the -coverageOptions argument.'
|
||||
coverageResultsPath:
|
||||
required: false
|
||||
default: 'coverage'
|
||||
description: 'Path to write coverage results to when collecting code coverage.'
|
||||
artifactsPath:
|
||||
required: false
|
||||
default: 'artifacts'
|
||||
|
@ -55,7 +51,7 @@ inputs:
|
|||
outputs:
|
||||
artifactsPath:
|
||||
description: 'Path where the artifacts are stored.'
|
||||
coverageResultsPath:
|
||||
coveragePath:
|
||||
description: 'Path where the code coverage results are stored.'
|
||||
branding:
|
||||
icon: 'box'
|
||||
|
|
|
@ -42,7 +42,7 @@ function run() {
|
|||
try {
|
||||
model_1.Action.checkCompatibility();
|
||||
const { workspace, actionFolder } = model_1.Action;
|
||||
const { editorVersion, customImage, projectPath, customParameters, testMode, coverageParameters, coverageResultsPath, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, checkName, } = model_1.Input.getFromUser();
|
||||
const { editorVersion, customImage, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, checkName, } = model_1.Input.getFromUser();
|
||||
const baseImage = new model_1.ImageTag({ editorVersion, customImage });
|
||||
const runnerTemporaryPath = process.env.RUNNER_TEMP;
|
||||
try {
|
||||
|
@ -53,8 +53,7 @@ function run() {
|
|||
projectPath,
|
||||
customParameters,
|
||||
testMode,
|
||||
coverageParameters,
|
||||
coverageResultsPath,
|
||||
coverageOptions,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
|
@ -65,7 +64,7 @@ function run() {
|
|||
}
|
||||
finally {
|
||||
yield model_1.Output.setArtifactsPath(artifactsPath);
|
||||
yield model_1.Output.setCoverageResultsPath(coverageResultsPath);
|
||||
yield model_1.Output.setCoveragePath('CodeCoverage');
|
||||
}
|
||||
if (githubToken) {
|
||||
const failedTestCount = yield model_1.ResultsCheck.createCheck(artifactsPath, githubToken, checkName);
|
||||
|
@ -155,7 +154,7 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
|
|||
const Docker = {
|
||||
run(image, parameters, silent = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageParameters, coverageResultsPath, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, } = parameters;
|
||||
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, } = parameters;
|
||||
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
||||
if (!(0, fs_1.existsSync)(githubHome))
|
||||
(0, fs_1.mkdirSync)(githubHome);
|
||||
|
@ -175,8 +174,8 @@ const Docker = {
|
|||
--env PROJECT_PATH="${projectPath}" \
|
||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||
--env TEST_PLATFORMS="${testPlatforms}" \
|
||||
--env COVERAGE_OPTIONS="${coverageParameters}" \
|
||||
--env COVERAGE_RESULTS_PATH="${coverageResultsPath}" \
|
||||
--env COVERAGE_OPTIONS="${coverageOptions}" \
|
||||
--env COVERAGE_RESULTS_PATH="CodeCoverage" \
|
||||
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||
--env GITHUB_REF \
|
||||
--env GITHUB_SHA \
|
||||
|
@ -391,8 +390,7 @@ const Input = {
|
|||
const rawProjectPath = (0, core_1.getInput)('projectPath') || '.';
|
||||
const customParameters = (0, core_1.getInput)('customParameters') || '';
|
||||
const testMode = ((0, core_1.getInput)('testMode') || 'all').toLowerCase();
|
||||
const coverageParameters = (0, core_1.getInput)('coverageParameters') || '';
|
||||
const rawCoverageResultsPath = (0, core_1.getInput)('coverageResultsPath') || 'CodeCoverage';
|
||||
const coverageOptions = (0, core_1.getInput)('coverageOptions') || '';
|
||||
const rawArtifactsPath = (0, core_1.getInput)('artifactsPath') || 'artifacts';
|
||||
const rawUseHostNetwork = (0, core_1.getInput)('useHostNetwork') || 'false';
|
||||
const sshAgent = (0, core_1.getInput)('sshAgent') || '';
|
||||
|
@ -403,9 +401,6 @@ const Input = {
|
|||
if (!this.testModes.includes(testMode)) {
|
||||
throw new Error(`Invalid testMode ${testMode}`);
|
||||
}
|
||||
if (!this.isValidFolderName(rawCoverageResultsPath)) {
|
||||
throw new Error(`Invalid coverageResultsPath "${rawCoverageResultsPath}"`);
|
||||
}
|
||||
if (!this.isValidFolderName(rawProjectPath)) {
|
||||
throw new Error(`Invalid projectPath "${rawProjectPath}"`);
|
||||
}
|
||||
|
@ -419,7 +414,6 @@ const Input = {
|
|||
const projectPath = rawProjectPath.replace(/\/$/, '');
|
||||
const artifactsPath = rawArtifactsPath.replace(/\/$/, '');
|
||||
const useHostNetwork = rawUseHostNetwork === 'true';
|
||||
const coverageResultsPath = rawCoverageResultsPath.replace(/\/$/, '');
|
||||
const editorVersion = unityVersion === 'auto' ? unity_version_parser_1.default.read(projectPath) : unityVersion;
|
||||
// Return sanitised input
|
||||
return {
|
||||
|
@ -428,8 +422,7 @@ const Input = {
|
|||
projectPath,
|
||||
customParameters,
|
||||
testMode,
|
||||
coverageParameters,
|
||||
coverageResultsPath,
|
||||
coverageOptions,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
|
@ -485,9 +478,9 @@ const Output = {
|
|||
yield core.setOutput('artifactsPath', artifactsPath);
|
||||
});
|
||||
},
|
||||
setCoverageResultsPath(coverageResultsPath) {
|
||||
setCoveragePath(coveragePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield core.setOutput('coverageResultsPath', coverageResultsPath);
|
||||
yield core.setOutput('coveragePath', coveragePath);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -99,7 +99,7 @@ for platform in ${TEST_PLATFORMS//;/ }; do
|
|||
echo "Unexpected exit code $TEST_EXIT_CODE";
|
||||
fi
|
||||
|
||||
if [ $TEST_EXIT_CODE -gt 0 ]; then
|
||||
if [ $TEST_EXIT_CODE -ne 0 ]; then
|
||||
TEST_RUNNER_EXIT_CODE=$TEST_EXIT_CODE
|
||||
fi
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@ async function run() {
|
|||
projectPath,
|
||||
customParameters,
|
||||
testMode,
|
||||
coverageParameters,
|
||||
coverageResultsPath,
|
||||
coverageOptions,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
|
@ -32,8 +31,7 @@ async function run() {
|
|||
projectPath,
|
||||
customParameters,
|
||||
testMode,
|
||||
coverageParameters,
|
||||
coverageResultsPath,
|
||||
coverageOptions,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
|
@ -43,7 +41,7 @@ async function run() {
|
|||
});
|
||||
} finally {
|
||||
await Output.setArtifactsPath(artifactsPath);
|
||||
await Output.setCoverageResultsPath(coverageResultsPath);
|
||||
await Output.setCoveragePath('CodeCoverage');
|
||||
}
|
||||
|
||||
if (githubToken) {
|
||||
|
|
|
@ -11,8 +11,7 @@ const Docker = {
|
|||
projectPath,
|
||||
customParameters,
|
||||
testMode,
|
||||
coverageParameters,
|
||||
coverageResultsPath,
|
||||
coverageOptions,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
|
@ -41,8 +40,8 @@ const Docker = {
|
|||
--env PROJECT_PATH="${projectPath}" \
|
||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||
--env TEST_PLATFORMS="${testPlatforms}" \
|
||||
--env COVERAGE_OPTIONS="${coverageParameters}" \
|
||||
--env COVERAGE_RESULTS_PATH="${coverageResultsPath}" \
|
||||
--env COVERAGE_OPTIONS="${coverageOptions}" \
|
||||
--env COVERAGE_RESULTS_PATH="CodeCoverage" \
|
||||
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||
--env GITHUB_REF \
|
||||
--env GITHUB_SHA \
|
||||
|
|
|
@ -19,8 +19,7 @@ const Input = {
|
|||
const rawProjectPath = getInput('projectPath') || '.';
|
||||
const customParameters = getInput('customParameters') || '';
|
||||
const testMode = (getInput('testMode') || 'all').toLowerCase();
|
||||
const coverageParameters = getInput('coverageParameters') || '';
|
||||
const rawCoverageResultsPath = getInput('coverageResultsPath') || 'CodeCoverage';
|
||||
const coverageOptions = getInput('coverageOptions') || '';
|
||||
const rawArtifactsPath = getInput('artifactsPath') || 'artifacts';
|
||||
const rawUseHostNetwork = getInput('useHostNetwork') || 'false';
|
||||
const sshAgent = getInput('sshAgent') || '';
|
||||
|
@ -33,10 +32,6 @@ const Input = {
|
|||
throw new Error(`Invalid testMode ${testMode}`);
|
||||
}
|
||||
|
||||
if (!this.isValidFolderName(rawCoverageResultsPath)) {
|
||||
throw new Error(`Invalid coverageResultsPath "${rawCoverageResultsPath}"`);
|
||||
}
|
||||
|
||||
if (!this.isValidFolderName(rawProjectPath)) {
|
||||
throw new Error(`Invalid projectPath "${rawProjectPath}"`);
|
||||
}
|
||||
|
@ -53,7 +48,6 @@ const Input = {
|
|||
const projectPath = rawProjectPath.replace(/\/$/, '');
|
||||
const artifactsPath = rawArtifactsPath.replace(/\/$/, '');
|
||||
const useHostNetwork = rawUseHostNetwork === 'true';
|
||||
const coverageResultsPath = rawCoverageResultsPath.replace(/\/$/, '');
|
||||
const editorVersion =
|
||||
unityVersion === 'auto' ? UnityVersionParser.read(projectPath) : unityVersion;
|
||||
|
||||
|
@ -64,8 +58,7 @@ const Input = {
|
|||
projectPath,
|
||||
customParameters,
|
||||
testMode,
|
||||
coverageParameters,
|
||||
coverageResultsPath,
|
||||
coverageOptions,
|
||||
artifactsPath,
|
||||
useHostNetwork,
|
||||
sshAgent,
|
||||
|
|
|
@ -6,19 +6,19 @@ describe('Output', () => {
|
|||
await expect(Output.setArtifactsPath('')).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
describe('setCoverageResultsPath', () => {
|
||||
describe('setCoveragePath', () => {
|
||||
it('does not throw', async () => {
|
||||
await expect(Output.setCoverageResultsPath('')).resolves.not.toThrow();
|
||||
await expect(Output.setCoverageResultsPath('artifacts')).resolves.not.toThrow();
|
||||
await expect(Output.setCoverageResultsPath('coverage')).resolves.not.toThrow();
|
||||
await expect(Output.setCoverageResultsPath('CodeCoverage')).resolves.not.toThrow();
|
||||
await expect(Output.setCoverageResultsPath('./artifacts')).resolves.not.toThrow();
|
||||
await expect(Output.setCoverageResultsPath('./coverage')).resolves.not.toThrow();
|
||||
await expect(Output.setCoverageResultsPath('./CodeCoverage')).resolves.not.toThrow();
|
||||
await expect(Output.setCoverageResultsPath('./artifacts/coverage')).resolves.not.toThrow();
|
||||
await expect(Output.setCoverageResultsPath('./coverage/')).resolves.not.toThrow();
|
||||
await expect(Output.setCoverageResultsPath('./CodeCoverage/')).resolves.not.toThrow();
|
||||
await expect(Output.setCoverageResultsPath('./artifacts/coverage/')).resolves.not.toThrow();
|
||||
await expect(Output.setCoveragePath('')).resolves.not.toThrow();
|
||||
await expect(Output.setCoveragePath('artifacts')).resolves.not.toThrow();
|
||||
await expect(Output.setCoveragePath('coverage')).resolves.not.toThrow();
|
||||
await expect(Output.setCoveragePath('CodeCoverage')).resolves.not.toThrow();
|
||||
await expect(Output.setCoveragePath('./artifacts')).resolves.not.toThrow();
|
||||
await expect(Output.setCoveragePath('./coverage')).resolves.not.toThrow();
|
||||
await expect(Output.setCoveragePath('./CodeCoverage')).resolves.not.toThrow();
|
||||
await expect(Output.setCoveragePath('./artifacts/coverage')).resolves.not.toThrow();
|
||||
await expect(Output.setCoveragePath('./coverage/')).resolves.not.toThrow();
|
||||
await expect(Output.setCoveragePath('./CodeCoverage/')).resolves.not.toThrow();
|
||||
await expect(Output.setCoveragePath('./artifacts/coverage/')).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,8 +4,8 @@ const Output = {
|
|||
async setArtifactsPath(artifactsPath) {
|
||||
await core.setOutput('artifactsPath', artifactsPath);
|
||||
},
|
||||
async setCoverageResultsPath(coverageResultsPath) {
|
||||
await core.setOutput('coverageResultsPath', coverageResultsPath);
|
||||
async setCoveragePath(coveragePath) {
|
||||
await core.setOutput('coveragePath', coveragePath);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue