Skip to content

Commit ac824de

Browse files
committedMar 12, 2020
tweak ci scripts
1 parent 4ef10bf commit ac824de

File tree

5 files changed

+29
-17
lines changed

5 files changed

+29
-17
lines changed
 

‎.circleci/config.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jobs: # a collection of steps
33
build: # runs not using Workflows must have a `build` job as entry point
44
working_directory: ~/git/bucklescript # directory where steps will run
55
docker: # run the steps with Docker
6-
- image: circleci/node:8.9.4 # ...with this image as the primary container; this is where all `steps` will run
6+
- image: circleci/node:dubnium # ...with this image as the primary container; this is where all `steps` will run
77
steps: # a collection of executable commands
88
- checkout # special step to check out source code to working directory
99
- run:
@@ -21,8 +21,8 @@ jobs: # a collection of steps
2121
git submodule init
2222
git submodule update
2323
- run:
24-
name: install-npm-wee
25-
command: npm install # `npm ci` is not available on node v8
24+
name: ci-install
25+
command: npm ci # `npm ci` is not available on node v8
2626

2727
- run: # run tests
2828
name: test

‎.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,5 @@ jscomp/.lsp
142142
.vscode/launch.json
143143
tracing*.json
144144
darwin/bsc
145-
.nyc_output
145+
.nyc_output
146+
themes

‎.npmignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ vendor/cppo
3535
vendor/rollup.js
3636
package/
3737
*.tgz
38-
.nyc_output/
38+
.nyc_output/
39+
themes

‎scripts/ciTest.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ function main() {
7272
// console.log('OCaml:', output)
7373
var binDir = path.join(__dirname, "..", "jscomp", "bin");
7474
if (ounitTest) {
75-
var fn = fs.copyFileSync ? fs.copyFileSync : fs.renameSync;
76-
fn(
75+
76+
// running tests for native code
77+
fs.copyFileSync(
7778
path.join(
7879
__dirname,
7980
"..",
@@ -94,13 +95,16 @@ function main() {
9495
cp.execSync(`./test.exe`, { cwd: binDir, stdio: [0, 1, 2] });
9596
}
9697

98+
// running generated js tests
9799
if (mochaTest) {
98100
cp.execSync(`mocha jscomp/test/**/*test.js`, {
99101
cwd: path.join(__dirname, ".."),
100102
stdio: [0, 1, 2]
101103
});
102104
}
103105

106+
// set up global directory properly using
107+
// npm config set prefix '~/.npm-global'
104108
if (installGlobal) {
105109
console.log("install bucklescript globally");
106110
cp.execSync("sudo npm i -g --unsafe-perm . && bsc -bs-internal-check", {
@@ -127,6 +131,13 @@ function main() {
127131
.map(x => x.trim())
128132
.filter(x => x);
129133
var themesDir = path.join(__dirname, "..", "themes");
134+
135+
if(fs.existsSync(themesDir)){
136+
// fs.rmdirSync(themesDir,{recursive : true})
137+
cp.execSync(`rm -rf ${themesDir}`,{stdio:[0,1,2]})
138+
// we dont remove post-installation
139+
// since it is useful for debugging
140+
}
130141
fs.mkdirSync(themesDir);
131142
themes.forEach(function(theme) {
132143
cp.exec(
@@ -167,6 +178,9 @@ function main() {
167178
var files = fs.readdirSync(buildTestDir);
168179
files.forEach(function(file) {
169180
var testDir = path.join(buildTestDir, file);
181+
if(file === 'node_modules' || !fs.lstatSync(testDir).isDirectory()){
182+
return
183+
}
170184
if (!fs.existsSync(path.join(testDir, "input.js"))) {
171185
console.warn(`input.js does not exist in ${testDir}`);
172186
} else {

‎scripts/install.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ if (supported_os.indexOf(process.platform) < 0) {
2424
}
2525
var is_windows = process.platform === "win32";
2626

27-
28-
2927
var ninja_bin_output = path.join(root_dir, process.platform, "ninja.exe");
3028

3129
/**
@@ -99,8 +97,6 @@ function ensureExists(dir) {
9997
}
10098
}
10199

102-
103-
104100
/**
105101
* @returns {string|undefined}
106102
*/
@@ -176,7 +172,7 @@ function provideCompiler() {
176172
if (myVersion !== undefined) {
177173
return myVersion;
178174
} else {
179-
myVersion = require("./buildocaml.js").getVersionPrefix();
175+
myVersion = "4.06.1";
180176
var ocamlopt =
181177
process.env.ESY === "true"
182178
? "ocamlopt.opt"
@@ -203,11 +199,11 @@ function provideCompiler() {
203199

204200
var filePath = path.join(lib_dir, "release.ninja");
205201
fs.writeFileSync(filePath, releaseNinja, "ascii");
206-
cp.execFileSync(ninja_bin_output, ["-f", "release.ninja","-t", "clean"], {
202+
cp.execFileSync(ninja_bin_output, ["-f", "release.ninja", "-t", "clean"], {
207203
cwd: lib_dir,
208204
stdio: [0, 1, 2]
209205
});
210-
cp.execFileSync(ninja_bin_output, ["-f", "release.ninja","-v"], {
206+
cp.execFileSync(ninja_bin_output, ["-f", "release.ninja", "-v"], {
211207
cwd: lib_dir,
212208
stdio: [0, 1, 2]
213209
});
@@ -218,11 +214,11 @@ function provideCompiler() {
218214

219215
provideNinja();
220216

221-
var ocamlVersion = provideCompiler();
217+
provideCompiler();
222218

223-
var stdlib = ocamlVersion.includes("4.02") ? "stdlib-402" : "stdlib-406";
219+
var stdlib = "stdlib-406";
224220

225221
if (process.env.BS_TRAVIS_CI) {
226222
buildLibs(stdlib);
227-
require('./installUtils.js').install()
223+
require("./installUtils.js").install();
228224
}

0 commit comments

Comments
 (0)
Please sign in to comment.