Skip to content

Commit

Permalink
remove support for Ubuntu 18.04
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Apr 28, 2024
1 parent b4d3c0f commit f86dc92
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 56 deletions.
8 changes: 1 addition & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
"@actions/github": "^6.0.0",
"@actions/io": "^1.1.3",
"node-fetch": "^2.6.7",
"shlex": "^2.1.2",
"ubuntu-version": "^2.0.0"
"shlex": "^2.1.2"
},
"devDependencies": {
"@types/eslint__js": "^8.42.3",
Expand Down
16 changes: 1 addition & 15 deletions src/install_linux.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
import * as core from '@actions/core';
import { getUbuntuVersion } from 'ubuntu-version';
import type { Installed } from './install';
import type { Config } from './config';
import { exec } from './shell';
import { buildVim } from './vim';
import { buildNightlyNeovim, downloadNeovim, downloadStableNeovim } from './neovim';

async function isUbuntu18OrEarlier(): Promise<boolean> {
const version = await getUbuntuVersion();
if (version.length === 0) {
core.error('Trying to install apt package but current OS is not Ubuntu');
return false; // Should be unreachable
}

core.debug(`Ubuntu system version: ${version.join('.')}`);

return version[0] <= 18;
}

async function installVimStable(): Promise<Installed> {
core.debug('Installing stable Vim on Linux using apt');
const pkg = (await isUbuntu18OrEarlier()) ? 'vim-gnome' : 'vim-gtk3';
await exec('sudo', ['apt-get', 'update', '-y']);
await exec('sudo', ['apt-get', 'install', '-y', '--no-install-recommends', pkg]);
await exec('sudo', ['apt-get', 'install', '-y', '--no-install-recommends', 'vim-gtk3']);
return {
executable: 'vim',
binDir: '/usr/bin',
Expand Down
34 changes: 2 additions & 32 deletions test/vim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,44 +201,14 @@ describe('installVimStable()', function () {

before(function () {
stub = mockExec();
installVimOnLinux = mock.reRequire('../src/install_linux').install;
});

after(function () {
mock.stop('../src/shell');
});

afterEach(function () {
mock.stop('ubuntu-version');
});

it('installs vim-gnome package for Ubuntu 18.10 or earlier (#11)', async function () {
async function getUbuntuVersion(): Promise<unknown> {
return Promise.resolve([18, 4]);
}
mock('ubuntu-version', { getUbuntuVersion });
installVimOnLinux = mock.reRequire('../src/install_linux').install;

const installed = await installVimOnLinux({
version: 'stable',
neovim: false,
os: 'linux',
configureArgs: null,
token: null,
});

A.equal(installed.executable, 'vim');
A.equal(installed.binDir, '/usr/bin');
const aptArgs = stub.called[stub.called.length - 1][1];
A.equal(aptArgs[aptArgs.length - 1], 'vim-gnome', aptArgs.join(' '));
});

it('installs vim-gtk3 package for Ubuntu 19.04 or later (#11)', async function () {
async function getUbuntuVersion(): Promise<unknown> {
return Promise.resolve([20, 4, 2]);
}
mock('ubuntu-version', { getUbuntuVersion });
installVimOnLinux = mock.reRequire('../src/install_linux').install;

it('installs vim-gtk3 package', async function () {
const installed = await installVimOnLinux({
version: 'stable',
neovim: false,
Expand Down

0 comments on commit f86dc92

Please sign in to comment.