Skip to content

Commit 3d6c824

Browse files
committed
Generate artifacts
1 parent 77339b9 commit 3d6c824

File tree

228 files changed

+16756
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+16756
-9
lines changed

.gitignore

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
__tests__/runner/*
22

33
# comment out in distribution branches
4-
/node_modules/
54

65
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
76
# Logs
@@ -21,8 +20,6 @@ pids
2120
*.seed
2221
*.pid.lock
2322

24-
# Directory for instrumented libs generated by jscoverage/JSCover
25-
lib-cov
2623

2724
# Coverage directory used by tools like istanbul
2825
coverage
@@ -42,10 +39,8 @@ bower_components
4239
# sbt specific
4340
.cache
4441
.history
45-
.lib/
4642
dist/*
4743
target/
48-
lib_managed/
4944
src_managed/
5045
project/boot/
5146
project/plugins/project/
@@ -70,14 +65,10 @@ local.*
7065

7166
.DS_Store
7267

73-
node_modules
7468

75-
lib/core/metadata.js
76-
lib/core/MetadataBlog.js
7769

7870
website/translated_docs
7971
website/build/
8072
website/yarn.lock
81-
website/node_modules
8273
website/i18n/*
8374
!website/i18n/en.json

lib/install.js

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5+
}) : (function(o, m, k, k2) {
6+
if (k2 === undefined) k2 = k;
7+
o[k2] = m[k];
8+
}));
9+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10+
Object.defineProperty(o, "default", { enumerable: true, value: v });
11+
}) : function(o, v) {
12+
o["default"] = v;
13+
});
14+
var __importStar = (this && this.__importStar) || function (mod) {
15+
if (mod && mod.__esModule) return mod;
16+
var result = {};
17+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18+
__setModuleDefault(result, mod);
19+
return result;
20+
};
21+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23+
return new (P || (P = Promise))(function (resolve, reject) {
24+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27+
step((generator = generator.apply(thisArg, _arguments || [])).next());
28+
});
29+
};
30+
Object.defineProperty(exports, "__esModule", { value: true });
31+
exports.install = void 0;
32+
const core = __importStar(require("@actions/core"));
33+
const shell = __importStar(require("shelljs"));
34+
const path = __importStar(require("path"));
35+
const homedir = require("os").homedir();
36+
const bin = path.join(homedir, "bin");
37+
function install(javaVersion, jabbaVersion) {
38+
return __awaiter(this, void 0, void 0, function* () {
39+
setEnvironmentVariableCI();
40+
installJava(javaVersion, jabbaVersion);
41+
installSbt();
42+
});
43+
}
44+
exports.install = install;
45+
function setEnvironmentVariableCI() {
46+
core.exportVariable("CI", "true");
47+
}
48+
function jabbaUrlSuffix() {
49+
const runnerOs = shell.env["RUNNER_OS"] || "undefined";
50+
switch (runnerOs.toLowerCase()) {
51+
case "linux":
52+
const arch = shell.exec("uname -m", { silent: true }).stdout;
53+
switch (arch) {
54+
case "arm64":
55+
case "aarch64":
56+
return "linux-arm64";
57+
default:
58+
return "linux-amd64";
59+
}
60+
case "macos":
61+
return "darwin-amd64";
62+
case "windows":
63+
return "windows-amd64.exe";
64+
default:
65+
throw new Error(`unknown runner OS: ${runnerOs}, expected one of Linux, macOS or Windows.`);
66+
}
67+
}
68+
function isWindows() {
69+
return shell.env["RUNNER_OS"] === "Windows";
70+
}
71+
function jabbaName() {
72+
if (isWindows())
73+
return "jabba.exe";
74+
else
75+
return "jabba";
76+
}
77+
function installJava(javaVersion, jabbaVersion) {
78+
core.startGroup("Install Java");
79+
core.addPath(bin);
80+
const jabbaUrl = `https://github.com/shyiko/jabba/releases/download/${jabbaVersion}/jabba-${jabbaVersion}-${jabbaUrlSuffix()}`;
81+
shell.mkdir(bin);
82+
const jabba = path.join(bin, jabbaName());
83+
shell.set("-ev");
84+
shell.exec(`curl -sL -o ${jabba} ${jabbaUrl}`, { silent: true });
85+
shell.chmod(755, jabba);
86+
const jabbaInstall = javaVersion.includes("=")
87+
? installJavaByExactVersion(javaVersion)
88+
: installJavaByFuzzyVersion(jabba, javaVersion);
89+
if (!jabbaInstall)
90+
return;
91+
console.log(`Installing ${jabbaInstall.name}`);
92+
const result = shell.exec(`${jabba} install ${jabbaInstall.install}`);
93+
if (result.code > 0) {
94+
core.setFailed(`Failed to install Java ${javaVersion}, Jabba stderr: ${result.stderr}`);
95+
return;
96+
}
97+
const javaHome = shell
98+
.exec(`${jabba} which --home ${jabbaInstall.name}`)
99+
.stdout.trim();
100+
core.exportVariable("JAVA_HOME", javaHome);
101+
core.addPath(path.join(javaHome, "bin"));
102+
core.endGroup();
103+
}
104+
function installJavaByFuzzyVersion(jabba, javaVersion) {
105+
const toInstall = shell
106+
.exec(`${jabba} ls-remote`)
107+
.grep(javaVersion)
108+
.head({ "-n": 1 })
109+
.stdout.trim();
110+
if (!toInstall) {
111+
core.setFailed(`Couldn't find Java ${javaVersion}. To fix this problem, run 'jabba ls-remote' to see the list of valid Java versions.`);
112+
return;
113+
}
114+
return {
115+
name: toInstall,
116+
install: toInstall,
117+
};
118+
}
119+
function installJavaByExactVersion(javaVersion) {
120+
return {
121+
name: javaVersion.split("=")[0],
122+
install: javaVersion,
123+
};
124+
}
125+
function installSbt() {
126+
core.startGroup("Install sbt");
127+
core.addPath(bin);
128+
curl("https://raw.githubusercontent.com/paulp/sbt-extras/master/sbt", path.join(bin, "sbt"));
129+
curl("https://raw.githubusercontent.com/coursier/sbt-extras/master/sbt", path.join(bin, "csbt"));
130+
core.endGroup();
131+
}
132+
function curl(url, outputFile) {
133+
shell.exec(`curl -sL ${url}`, { silent: true }).to(outputFile);
134+
shell.chmod(755, outputFile);
135+
shell.cat(outputFile);
136+
console.log(`Downloaded '${path.basename(outputFile)}' to ${outputFile}`);
137+
}

lib/main.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5+
}) : (function(o, m, k, k2) {
6+
if (k2 === undefined) k2 = k;
7+
o[k2] = m[k];
8+
}));
9+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10+
Object.defineProperty(o, "default", { enumerable: true, value: v });
11+
}) : function(o, v) {
12+
o["default"] = v;
13+
});
14+
var __importStar = (this && this.__importStar) || function (mod) {
15+
if (mod && mod.__esModule) return mod;
16+
var result = {};
17+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18+
__setModuleDefault(result, mod);
19+
return result;
20+
};
21+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23+
return new (P || (P = Promise))(function (resolve, reject) {
24+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27+
step((generator = generator.apply(thisArg, _arguments || [])).next());
28+
});
29+
};
30+
Object.defineProperty(exports, "__esModule", { value: true });
31+
const core = __importStar(require("@actions/core"));
32+
const install_1 = require("./install");
33+
function run() {
34+
return __awaiter(this, void 0, void 0, function* () {
35+
try {
36+
const javaVersion = core.getInput("java-version", { required: true });
37+
const jabbaVersion = core.getInput("jabba-version", { required: true });
38+
console.log(`Installing Java version '${javaVersion}'`);
39+
yield install_1.install(javaVersion, jabbaVersion);
40+
}
41+
catch (error) {
42+
core.setFailed(error.message);
43+
}
44+
});
45+
}
46+
run();

node_modules/.bin/shjs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)