mirror of
https://github.com/actions/setup-dotnet.git
synced 2026-05-10 17:08:18 +01:00
Add dotnet-version: latest support with dotnet-channel input (#730)
* feat: add dotnet-version: latest keyword with dotnet-channel support (#497) * restore test-proxy container image * update e2e-tests.yml and documentation * fix(tests): correct release-type and support-phase values in latest-version test mocks
This commit is contained in:
@@ -84,7 +84,7 @@ describe('setup-dotnet tests', () => {
|
||||
inputs['dotnet-version'] = ['10.0'];
|
||||
inputs['dotnet-quality'] = 'fictitiousQuality';
|
||||
|
||||
const expectedErrorMessage = `Value '${inputs['dotnet-quality']}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`;
|
||||
const expectedErrorMessage = `Value '${inputs['dotnet-quality']}' is not supported for the 'dotnet-quality' option. Supported values are: daily, preview, ga.`;
|
||||
|
||||
await setup.run();
|
||||
expect(setFailedSpy).toHaveBeenCalledWith(expectedErrorMessage);
|
||||
@@ -256,5 +256,95 @@ describe('setup-dotnet tests', () => {
|
||||
await setup.run();
|
||||
expect(setFailedSpy).toHaveBeenCalledWith(expectedErrorMessage);
|
||||
});
|
||||
|
||||
it('should fail the action if unsupported dotnet-channel value is provided with latest', async () => {
|
||||
inputs['dotnet-version'] = ['latest'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
inputs['dotnet-channel'] = 'invalid';
|
||||
inputs['architecture'] = '';
|
||||
|
||||
const expectedErrorMessage = `Value 'invalid' is not supported for the 'dotnet-channel' option. Supported values are: LTS, STS, A.B (e.g. 8.0), A.B.Cxx (e.g. 8.0.1xx).`;
|
||||
|
||||
await setup.run();
|
||||
expect(setFailedSpy).toHaveBeenCalledWith(expectedErrorMessage);
|
||||
});
|
||||
|
||||
it('should warn but not fail if unsupported dotnet-channel value is provided with a specific version', async () => {
|
||||
inputs['dotnet-version'] = ['8.0.x'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
inputs['dotnet-channel'] = 'invalid';
|
||||
inputs['architecture'] = '';
|
||||
|
||||
installDotnetSpy.mockImplementation(() => Promise.resolve(''));
|
||||
|
||||
await setup.run();
|
||||
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||
expect(warningSpy).toHaveBeenCalledWith(
|
||||
`Value 'invalid' is not supported for the 'dotnet-channel' option and will be ignored because 'dotnet-version' is not set to 'latest'. Supported values are: LTS, STS, A.B (e.g. 8.0), A.B.Cxx (e.g. 8.0.1xx).`
|
||||
);
|
||||
});
|
||||
|
||||
it('should pass valid dotnet-channel value through without error', async () => {
|
||||
inputs['dotnet-version'] = ['latest'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
inputs['dotnet-channel'] = 'LTS';
|
||||
inputs['architecture'] = '';
|
||||
|
||||
installDotnetSpy.mockImplementation(() => Promise.resolve(''));
|
||||
|
||||
await setup.run();
|
||||
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should pass A.B channel value through without error when used with latest', async () => {
|
||||
inputs['dotnet-version'] = ['latest'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
inputs['dotnet-channel'] = '8.0';
|
||||
inputs['architecture'] = '';
|
||||
|
||||
installDotnetSpy.mockImplementation(() => Promise.resolve(''));
|
||||
|
||||
await setup.run();
|
||||
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should pass A.B.Cxx channel value through without error when used with latest', async () => {
|
||||
inputs['dotnet-version'] = ['latest'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
inputs['dotnet-channel'] = '8.0.1xx';
|
||||
inputs['architecture'] = '';
|
||||
|
||||
installDotnetSpy.mockImplementation(() => Promise.resolve(''));
|
||||
|
||||
await setup.run();
|
||||
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should fail with A.B.Cxx channel if major version is below 5', async () => {
|
||||
inputs['dotnet-version'] = ['latest'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
inputs['dotnet-channel'] = '3.1.1xx';
|
||||
inputs['architecture'] = '';
|
||||
|
||||
const expectedErrorMessage = `Value '3.1.1xx' is not supported for the 'dotnet-channel' option. Supported values are: LTS, STS, A.B (e.g. 8.0), A.B.Cxx (e.g. 8.0.1xx).`;
|
||||
|
||||
await setup.run();
|
||||
expect(setFailedSpy).toHaveBeenCalledWith(expectedErrorMessage);
|
||||
});
|
||||
|
||||
it('should warn and not fail if valid dotnet-channel is provided with a non-latest version', async () => {
|
||||
inputs['dotnet-version'] = ['8.0.x'];
|
||||
inputs['dotnet-quality'] = '';
|
||||
inputs['dotnet-channel'] = 'LTS';
|
||||
inputs['architecture'] = '';
|
||||
|
||||
installDotnetSpy.mockImplementation(() => Promise.resolve(''));
|
||||
|
||||
await setup.run();
|
||||
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||
expect(warningSpy).toHaveBeenCalledWith(
|
||||
`The 'dotnet-channel' input is only supported when 'dotnet-version' is set to 'latest'.`
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user