Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into releases/v1
Browse files Browse the repository at this point in the history
* master:
  Install maintaned rubies on Ubutu 18.04 and 16.04
  npm run build
  Install libgdbm3 when ubuntu-16.04
  Bump up actions/cache to v1
  Fix README
  • Loading branch information
masa-iwasaki committed Jan 1, 2020
2 parents 15d00ae + 3c40919 commit 9952f7f
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Linux'
name: 'Ubuntu 16.04'

on:
pull_request:
Expand All @@ -9,7 +9,7 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@master

Expand All @@ -20,4 +20,6 @@ jobs:
- run: |
eval "$(rbenv init -)"
rbenv install 2.5.7
rbenv install 2.6.5
rbenv install 2.7.0
24 changes: 24 additions & 0 deletions .github/workflows/ubuntu1804.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Ubuntu 18.04'

on:
pull_request:
push:
branches:
- master
- 'releases/*'

jobs:
test:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master

- run: npm ci
- run: npm run build
- run: npm test
- uses: ./
- run: |
eval "$(rbenv init -)"
rbenv install 2.5.7
rbenv install 2.6.5
rbenv install 2.7.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ steps:
- uses: masa-iwasaki/setup-rbenv@v1

- name: Cache RBENV_ROOT
uses: actions/cache@preview
uses: actions/cache@v1
id: cache_rbenv
with:
path: /home/runner/.rbenv
Expand Down
13 changes: 12 additions & 1 deletion lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const exec = __importStar(require("@actions/exec"));
const fs = __importStar(require("fs"));
function intallRbenv(options) {
return __awaiter(this, void 0, void 0, function* () {
yield exec.exec('sudo', ['git', 'clone', 'https://github.com/rbenv/rbenv.git', options.rbenvRoot]);
Expand All @@ -31,9 +32,19 @@ function installRubyBuild(options) {
"zlib1g-dev",
"libncurses5-dev",
"libffi-dev",
"libgdbm5",
"libgdbm-dev"
];
const osRelease = fs.readFileSync("/etc/os-release", { encoding: "utf-8" });
const matched = osRelease.match(/VERSION_ID="([0-9.]+)"/);
const ubuntuVersion = matched ? matched[1] : "0";
if (parseFloat(ubuntuVersion) >= 18.04) {
// Ubuntu 18.04+ (bionic)
packages.push("libgdbm5");
}
else {
// Ubuntu 16.04 (xenial)
packages.push("libgdbm3");
}
const rubyBuildInstallPath = `${options.rbenvRoot}/plugins/ruby-build`;
yield exec.exec('sudo', ['apt-get', 'update']);
yield exec.exec('sudo', ['apt-get', 'install', '-y', ...packages]);
Expand Down
14 changes: 13 additions & 1 deletion src/installer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as exec from '@actions/exec';
import * as fs from 'fs'

export async function intallRbenv(options: RbenvOptions) {
await exec.exec('sudo', ['git', 'clone', 'https://github.com/rbenv/rbenv.git', options.rbenvRoot]);
Expand All @@ -16,10 +17,21 @@ export async function installRubyBuild(options: RbenvOptions) {
"zlib1g-dev",
"libncurses5-dev",
"libffi-dev",
"libgdbm5",
"libgdbm-dev"
];

const osRelease = fs.readFileSync("/etc/os-release", {encoding: "utf-8"});
const matched = osRelease.match(/VERSION_ID="([0-9.]+)"/);
const ubuntuVersion = matched ? matched[1] : "0";

if (parseFloat(ubuntuVersion) >= 18.04 ){
// Ubuntu 18.04+ (bionic)
packages.push("libgdbm5");
} else {
// Ubuntu 16.04 (xenial)
packages.push("libgdbm3");
}

const rubyBuildInstallPath = `${options.rbenvRoot}/plugins/ruby-build`;

await exec.exec('sudo', ['apt-get', 'update']);
Expand Down

0 comments on commit 9952f7f

Please sign in to comment.