Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:fix: support for Ubuntu 24.04.1 #126

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Set up your GitHub Actions workflow with a specific version of
[Minikube](https://github.com/kubernetes/minikube)
and [Kubernetes](https://github.com/kubernetes/kubernetes).

_Currently only Linux Ubuntu 18.04, 20.04, or 22.04
_Currently only Linux Ubuntu 18.04, 20.04, 22.04, or 24.04
[CI environment](https://help.github.com/en/github/automating-your-workflow-with-github-actions/virtual-environments-for-github-actions)
is supported._

Expand Down
19 changes: 16 additions & 3 deletions src/__tests__/check-environment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('check-environment module test suite', () => {
process.platform = 'win32';
// When - Then
expect(checkEnvironment).toThrow(
'Unsupported OS, action only works in Ubuntu 18, 20, or 22'
'Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24'
);
});
test('OS is Linux but not Ubuntu, should throw Error', () => {
Expand All @@ -24,7 +24,7 @@ describe('check-environment module test suite', () => {
fs.readFileSync.mockImplementation(() => 'SOME DIFFERENT OS');
// When - Then
expect(checkEnvironment).toThrow(
'Unsupported OS, action only works in Ubuntu 18, 20, or 22'
'Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24'
);
expect(fs.existsSync).toHaveBeenCalled();
expect(fs.readFileSync).toHaveBeenCalledTimes(0);
Expand All @@ -36,7 +36,7 @@ describe('check-environment module test suite', () => {
fs.readFileSync.mockImplementation(() => 'SOME DIFFERENT OS');
// When - Then
expect(checkEnvironment).toThrow(
'Unsupported OS, action only works in Ubuntu 18, 20, or 22'
'Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24'
);
expect(fs.existsSync).toHaveBeenCalled();
expect(fs.readFileSync).toHaveBeenCalled();
Expand Down Expand Up @@ -80,5 +80,18 @@ describe('check-environment module test suite', () => {
// When - Then
expect(checkEnvironment).not.toThrow();
});
test('OS is Linux and Ubuntu 24, should not throw Error', () => {
// Given
Object.defineProperty(process, 'platform', {value: 'linux'});
fs.existsSync.mockImplementation(() => true);
fs.readFileSync.mockImplementation(
() => `
NAME="Ubuntu"
VERSION="24.04.1 LTS (Noble Numbat)"
`
);
// When - Then
expect(checkEnvironment).not.toThrow();
});
});
});
6 changes: 3 additions & 3 deletions src/check-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const isUbuntu = version => () => {
osInfo.indexOf(`VERSION="${version}`) >= 0
);
};
['18', '20', '22'].some(v => isUbuntu(v)())
const isValidLinux = () => isLinux() && ['18', '20', '22'].some(v => isUbuntu(v)());
['18', '20', '22', '24'].some(v => isUbuntu(v)())
const isValidLinux = () => isLinux() && ['18', '20', '22', '24'].some(v => isUbuntu(v)());
const checkOperatingSystem = () => {
if (!isValidLinux()) {
throw Error('Unsupported OS, action only works in Ubuntu 18, 20, or 22');
throw Error('Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24');
}
};

Expand Down