mirror of
https://github.com/DeLaGuardo/setup-clojure.git
synced 2024-12-25 23:40:49 +08:00
wip
This commit is contained in:
parent
3244f02343
commit
9ba054f0b3
3
.eslintignore
Normal file
3
.eslintignore
Normal file
@ -0,0 +1,3 @@
|
||||
dist/
|
||||
lib/
|
||||
node_modules/
|
75
.eslintrc.json
Normal file
75
.eslintrc.json
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"plugins": [
|
||||
"jest",
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"extends": [
|
||||
"plugin:github/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
"sourceType": "module",
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"rules": {
|
||||
"eslint-comments/no-use": "off",
|
||||
"import/no-namespace": "off",
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": "error",
|
||||
"@typescript-eslint/explicit-member-accessibility": [
|
||||
"error",
|
||||
{
|
||||
"accessibility": "no-public"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
"@typescript-eslint/array-type": "error",
|
||||
"@typescript-eslint/await-thenable": "error",
|
||||
"@typescript-eslint/ban-ts-comment": "error",
|
||||
"camelcase": "off",
|
||||
"@typescript-eslint/consistent-type-assertions": "error",
|
||||
"@typescript-eslint/explicit-function-return-type": [
|
||||
"error",
|
||||
{
|
||||
"allowExpressions": true
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/func-call-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"@typescript-eslint/no-array-constructor": "error",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"@typescript-eslint/no-extraneous-class": "error",
|
||||
"@typescript-eslint/no-for-in-array": "error",
|
||||
"@typescript-eslint/no-inferrable-types": "error",
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-useless-constructor": "error",
|
||||
"@typescript-eslint/no-var-requires": "error",
|
||||
"@typescript-eslint/prefer-for-of": "warn",
|
||||
"@typescript-eslint/prefer-function-type": "warn",
|
||||
"@typescript-eslint/prefer-includes": "error",
|
||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||||
"@typescript-eslint/promise-function-async": "error",
|
||||
"@typescript-eslint/require-array-sort-compare": "error",
|
||||
"@typescript-eslint/restrict-plus-operands": "error",
|
||||
"semi": "off",
|
||||
"@typescript-eslint/semi": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"@typescript-eslint/unbound-method": "error"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true,
|
||||
"jest/globals": true
|
||||
}
|
||||
}
|
3
.prettierignore
Normal file
3
.prettierignore
Normal file
@ -0,0 +1,3 @@
|
||||
dist/
|
||||
lib/
|
||||
node_modules/
|
@ -1,11 +1,10 @@
|
||||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "avoid",
|
||||
"parser": "typescript"
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "avoid"
|
||||
}
|
||||
|
@ -1,94 +1,74 @@
|
||||
import io = require('@actions/io');
|
||||
import os = require('os');
|
||||
import fs = require('fs');
|
||||
import path = require('path');
|
||||
import io = require('@actions/io')
|
||||
import os = require('os')
|
||||
import fs = require('fs')
|
||||
import path = require('path')
|
||||
|
||||
const toolDir = path.join(__dirname, 'runner', 'tools', 'boot');
|
||||
const tempDir = path.join(__dirname, 'runner', 'temp', 'boot');
|
||||
const toolDir = path.join(__dirname, 'runner', 'tools', 'boot')
|
||||
const tempDir = path.join(__dirname, 'runner', 'temp', 'boot')
|
||||
|
||||
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
||||
process.env['RUNNER_TEMP'] = tempDir;
|
||||
import * as boot from '../src/boot';
|
||||
process.env['RUNNER_TOOL_CACHE'] = toolDir
|
||||
process.env['RUNNER_TEMP'] = tempDir
|
||||
import * as boot from '../src/boot'
|
||||
|
||||
describe('boot tests', () => {
|
||||
beforeAll(async () => {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
}, 300000);
|
||||
await io.rmRF(toolDir)
|
||||
await io.rmRF(tempDir)
|
||||
}, 300000)
|
||||
|
||||
afterAll(async () => {
|
||||
try {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
await io.rmRF(toolDir)
|
||||
await io.rmRF(tempDir)
|
||||
} catch {
|
||||
console.log('Failed to remove test directories');
|
||||
console.log('Failed to remove test directories')
|
||||
}
|
||||
}, 100000);
|
||||
}, 100000)
|
||||
|
||||
it('Throws if invalid version', async () => {
|
||||
let thrown = false;
|
||||
try {
|
||||
await boot.setup('1000');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
});
|
||||
it('Throws if invalid version', async () => {
|
||||
let thrown = false
|
||||
try {
|
||||
await boot.setup('1000')
|
||||
} catch {
|
||||
thrown = true
|
||||
}
|
||||
expect(thrown).toBe(true)
|
||||
})
|
||||
|
||||
it('Install boot with normal version', async () => {
|
||||
await boot.setup('2.8.3');
|
||||
const clojureDir = path.join(
|
||||
toolDir,
|
||||
'Boot',
|
||||
'2.8.3',
|
||||
os.arch()
|
||||
);
|
||||
it('Install boot with normal version', async () => {
|
||||
await boot.setup('2.8.3')
|
||||
const clojureDir = path.join(toolDir, 'Boot', '2.8.3', os.arch())
|
||||
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'boot'))).toBe(true);
|
||||
}, 100000);
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true)
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'boot'))).toBe(true)
|
||||
}, 100000)
|
||||
|
||||
it('Install latest boot', async () => {
|
||||
await boot.setup('latest');
|
||||
const clojureDir = path.join(
|
||||
toolDir,
|
||||
'Boot',
|
||||
'latest.0.0',
|
||||
os.arch()
|
||||
);
|
||||
it('Install latest boot', async () => {
|
||||
await boot.setup('latest')
|
||||
const clojureDir = path.join(toolDir, 'Boot', 'latest.0.0', os.arch())
|
||||
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'boot'))).toBe(true);
|
||||
}, 100000);
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true)
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'boot'))).toBe(true)
|
||||
}, 100000)
|
||||
|
||||
it('Uses version of boot installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'Boot',
|
||||
'2.8.3',
|
||||
os.arch()
|
||||
);
|
||||
await io.mkdirP(clojureDir);
|
||||
fs.writeFileSync(`${clojureDir}.complete`, 'hello');
|
||||
await boot.setup('2.8.3');
|
||||
return;
|
||||
});
|
||||
it('Uses version of boot installed in cache', async () => {
|
||||
const clojureDir: string = path.join(toolDir, 'Boot', '2.8.3', os.arch())
|
||||
await io.mkdirP(clojureDir)
|
||||
fs.writeFileSync(`${clojureDir}.complete`, 'hello')
|
||||
await boot.setup('2.8.3')
|
||||
return
|
||||
})
|
||||
|
||||
it('Doesnt use version of clojure that was only partially installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'Boot',
|
||||
'2.8.3',
|
||||
os.arch()
|
||||
);
|
||||
await io.mkdirP(clojureDir);
|
||||
let thrown = false;
|
||||
try {
|
||||
await boot.setup('1000');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
return;
|
||||
});
|
||||
});
|
||||
it('Doesnt use version of clojure that was only partially installed in cache', async () => {
|
||||
const clojureDir: string = path.join(toolDir, 'Boot', '2.8.3', os.arch())
|
||||
await io.mkdirP(clojureDir)
|
||||
let thrown = false
|
||||
try {
|
||||
await boot.setup('1000')
|
||||
} catch {
|
||||
thrown = true
|
||||
}
|
||||
expect(thrown).toBe(true)
|
||||
return
|
||||
})
|
||||
})
|
||||
|
@ -1,94 +1,84 @@
|
||||
import io = require('@actions/io');
|
||||
import os = require('os');
|
||||
import fs = require('fs');
|
||||
import path = require('path');
|
||||
import io = require('@actions/io')
|
||||
import os = require('os')
|
||||
import fs = require('fs')
|
||||
import path = require('path')
|
||||
|
||||
const toolDir = path.join(__dirname, 'runner', 'tools', 'leiningen');
|
||||
const tempDir = path.join(__dirname, 'runner', 'temp', 'leiningen');
|
||||
const toolDir = path.join(__dirname, 'runner', 'tools', 'leiningen')
|
||||
const tempDir = path.join(__dirname, 'runner', 'temp', 'leiningen')
|
||||
|
||||
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
||||
process.env['RUNNER_TEMP'] = tempDir;
|
||||
import * as leiningen from '../src/leiningen';
|
||||
process.env['RUNNER_TOOL_CACHE'] = toolDir
|
||||
process.env['RUNNER_TEMP'] = tempDir
|
||||
import * as leiningen from '../src/leiningen'
|
||||
|
||||
describe('leiningen tests', () => {
|
||||
beforeAll(async () => {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
}, 300000);
|
||||
await io.rmRF(toolDir)
|
||||
await io.rmRF(tempDir)
|
||||
}, 300000)
|
||||
|
||||
afterAll(async () => {
|
||||
try {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
await io.rmRF(toolDir)
|
||||
await io.rmRF(tempDir)
|
||||
} catch {
|
||||
console.log('Failed to remove test directories');
|
||||
console.log('Failed to remove test directories')
|
||||
}
|
||||
}, 100000);
|
||||
}, 100000)
|
||||
|
||||
it('Throws if invalid version', async () => {
|
||||
let thrown = false;
|
||||
try {
|
||||
await leiningen.setup('1000');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
});
|
||||
it('Throws if invalid version', async () => {
|
||||
let thrown = false
|
||||
try {
|
||||
await leiningen.setup('1000')
|
||||
} catch {
|
||||
thrown = true
|
||||
}
|
||||
expect(thrown).toBe(true)
|
||||
})
|
||||
|
||||
it('Install leiningen with normal version', async () => {
|
||||
await leiningen.setup('2.9.1');
|
||||
const clojureDir = path.join(
|
||||
toolDir,
|
||||
'Leiningen',
|
||||
'2.9.1',
|
||||
os.arch()
|
||||
);
|
||||
it('Install leiningen with normal version', async () => {
|
||||
await leiningen.setup('2.9.1')
|
||||
const clojureDir = path.join(toolDir, 'Leiningen', '2.9.1', os.arch())
|
||||
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'lein'))).toBe(true);
|
||||
}, 100000);
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true)
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'lein'))).toBe(true)
|
||||
}, 100000)
|
||||
|
||||
it('Install latest leiningen', async () => {
|
||||
await leiningen.setup('latest');
|
||||
const clojureDir = path.join(
|
||||
toolDir,
|
||||
'Leiningen',
|
||||
'latest.0.0',
|
||||
os.arch()
|
||||
);
|
||||
it('Install latest leiningen', async () => {
|
||||
await leiningen.setup('latest')
|
||||
const clojureDir = path.join(toolDir, 'Leiningen', 'latest.0.0', os.arch())
|
||||
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'lein'))).toBe(true);
|
||||
}, 100000);
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true)
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'lein'))).toBe(true)
|
||||
}, 100000)
|
||||
|
||||
it('Uses version of leiningen installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'Leiningen',
|
||||
'2.9.1',
|
||||
os.arch()
|
||||
);
|
||||
await io.mkdirP(clojureDir);
|
||||
fs.writeFileSync(`${clojureDir}.complete`, 'hello');
|
||||
await leiningen.setup('2.9.1');
|
||||
return;
|
||||
});
|
||||
it('Uses version of leiningen installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'Leiningen',
|
||||
'2.9.1',
|
||||
os.arch()
|
||||
)
|
||||
await io.mkdirP(clojureDir)
|
||||
fs.writeFileSync(`${clojureDir}.complete`, 'hello')
|
||||
await leiningen.setup('2.9.1')
|
||||
return
|
||||
})
|
||||
|
||||
it('Doesnt use version of clojure that was only partially installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'Leiningen',
|
||||
'2.9.1',
|
||||
os.arch()
|
||||
);
|
||||
await io.mkdirP(clojureDir);
|
||||
let thrown = false;
|
||||
try {
|
||||
await leiningen.setup('1000');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
return;
|
||||
});
|
||||
});
|
||||
it('Doesnt use version of clojure that was only partially installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'Leiningen',
|
||||
'2.9.1',
|
||||
os.arch()
|
||||
)
|
||||
await io.mkdirP(clojureDir)
|
||||
let thrown = false
|
||||
try {
|
||||
await leiningen.setup('1000')
|
||||
} catch {
|
||||
thrown = true
|
||||
}
|
||||
expect(thrown).toBe(true)
|
||||
return
|
||||
})
|
||||
})
|
||||
|
@ -1,95 +1,95 @@
|
||||
import io = require('@actions/io');
|
||||
import exec = require('@actions/exec');
|
||||
import os = require('os');
|
||||
import fs = require('fs');
|
||||
import path = require('path');
|
||||
import io = require('@actions/io')
|
||||
import exec = require('@actions/exec')
|
||||
import os = require('os')
|
||||
import fs = require('fs')
|
||||
import path = require('path')
|
||||
|
||||
const toolDir = path.join(__dirname, 'runner', 'tools', 'tdeps');
|
||||
const tempDir = path.join(__dirname, 'runner', 'temp', 'tdeps');
|
||||
const toolDir = path.join(__dirname, 'runner', 'tools', 'tdeps')
|
||||
const tempDir = path.join(__dirname, 'runner', 'temp', 'tdeps')
|
||||
|
||||
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
||||
process.env['RUNNER_TEMP'] = tempDir;
|
||||
import * as tdeps from '../src/tdeps';
|
||||
process.env['RUNNER_TOOL_CACHE'] = toolDir
|
||||
process.env['RUNNER_TEMP'] = tempDir
|
||||
import * as tdeps from '../src/tdeps'
|
||||
|
||||
describe('tdeps tests', () => {
|
||||
beforeAll(async () => {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
}, 300000);
|
||||
beforeAll(async () => {
|
||||
await io.rmRF(toolDir)
|
||||
await io.rmRF(tempDir)
|
||||
}, 300000)
|
||||
|
||||
afterAll(async () => {
|
||||
try {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
} catch {
|
||||
console.log('Failed to remove test directories');
|
||||
}
|
||||
}, 100000);
|
||||
afterAll(async () => {
|
||||
try {
|
||||
await io.rmRF(toolDir)
|
||||
await io.rmRF(tempDir)
|
||||
} catch {
|
||||
console.log('Failed to remove test directories')
|
||||
}
|
||||
}, 100000)
|
||||
|
||||
it('Throws if invalid version', async () => {
|
||||
let thrown = false;
|
||||
try {
|
||||
await tdeps.setup('1000');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
});
|
||||
it('Throws if invalid version', async () => {
|
||||
let thrown = false
|
||||
try {
|
||||
await tdeps.setup('1000')
|
||||
} catch {
|
||||
thrown = true
|
||||
}
|
||||
expect(thrown).toBe(true)
|
||||
})
|
||||
|
||||
it('Install clojure tools deps with normal version', async () => {
|
||||
await tdeps.setup('1.10.1.469');
|
||||
const clojureDir = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
);
|
||||
it('Install clojure tools deps with normal version', async () => {
|
||||
await tdeps.setup('1.10.1.469')
|
||||
const clojureDir = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
)
|
||||
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'clojure'))).toBe(true);
|
||||
}, 100000);
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true)
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'clojure'))).toBe(true)
|
||||
}, 100000)
|
||||
|
||||
it('Install latest clojure tools deps', async () => {
|
||||
await tdeps.setup('latest');
|
||||
const clojureDir = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'latest.0.0',
|
||||
os.arch()
|
||||
);
|
||||
it('Install latest clojure tools deps', async () => {
|
||||
await tdeps.setup('latest')
|
||||
const clojureDir = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'latest.0.0',
|
||||
os.arch()
|
||||
)
|
||||
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'clojure'))).toBe(true);
|
||||
}, 100000);
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true)
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'clojure'))).toBe(true)
|
||||
}, 100000)
|
||||
|
||||
it('Uses version of clojure tools-deps installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
);
|
||||
await io.mkdirP(clojureDir);
|
||||
fs.writeFileSync(`${clojureDir}.complete`, 'hello');
|
||||
await tdeps.setup('1.10.1.469');
|
||||
return;
|
||||
});
|
||||
it('Uses version of clojure tools-deps installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
)
|
||||
await io.mkdirP(clojureDir)
|
||||
fs.writeFileSync(`${clojureDir}.complete`, 'hello')
|
||||
await tdeps.setup('1.10.1.469')
|
||||
return
|
||||
})
|
||||
|
||||
it('Doesnt use version of clojure that was only partially installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
);
|
||||
await io.mkdirP(clojureDir);
|
||||
let thrown = false;
|
||||
try {
|
||||
await tdeps.setup('1000');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
return;
|
||||
});
|
||||
});
|
||||
it('Doesnt use version of clojure that was only partially installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
)
|
||||
await io.mkdirP(clojureDir)
|
||||
let thrown = false
|
||||
try {
|
||||
await tdeps.setup('1000')
|
||||
} catch {
|
||||
thrown = true
|
||||
}
|
||||
expect(thrown).toBe(true)
|
||||
return
|
||||
})
|
||||
})
|
||||
|
@ -13,4 +13,4 @@ inputs:
|
||||
description: 'The tools deps version to make available on the path.'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'lib/setup-clojure.js'
|
||||
main: 'dist/index.js'
|
||||
|
5475
dist/index.js
vendored
Normal file
5475
dist/index.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
dist/index.js.map
vendored
Normal file
1
dist/index.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
3912
dist/sourcemap-register.js
vendored
Normal file
3912
dist/sourcemap-register.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -61,8 +61,8 @@ function setup(version) {
|
||||
core.info(`Boot found in cache ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
let bootBootstrapFile = yield tc.downloadTool(`https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh`);
|
||||
let tempDir = path.join(tempDirectory, 'temp_' + Math.floor(Math.random() * 2000000000));
|
||||
const bootBootstrapFile = yield tc.downloadTool(`https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh`);
|
||||
const tempDir = path.join(tempDirectory, `temp_${Math.floor(Math.random() * 2000000000)}`);
|
||||
const bootDir = yield installBoot(bootBootstrapFile, tempDir, version);
|
||||
core.debug(`Boot installed to ${bootDir}`);
|
||||
toolPath = yield tc.cacheDir(bootDir, 'Boot', utils.getCacheVersionString(version));
|
||||
@ -99,7 +99,7 @@ function installBoot(binScript, destinationFolder, version) {
|
||||
}
|
||||
yield exec.exec(`./boot ${version === 'latest' ? '-u' : '-V'}`, [], {
|
||||
cwd: path.join(destinationFolder, 'boot', 'bin'),
|
||||
env: env
|
||||
env
|
||||
});
|
||||
return path.join(destinationFolder, 'boot');
|
||||
}
|
||||
|
146
lib/installer.js
146
lib/installer.js
@ -1,146 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const exec = __importStar(require("@actions/exec"));
|
||||
const tc = __importStar(require("@actions/tool-cache"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const os = __importStar(require("os"));
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
if (IS_WINDOWS) {
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
}
|
||||
else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
let platform = '';
|
||||
if (IS_WINDOWS) {
|
||||
platform = 'windows';
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
platform = 'darwin';
|
||||
}
|
||||
else {
|
||||
platform = 'linux';
|
||||
}
|
||||
}
|
||||
function getGraalVM(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let toolPath = tc.find('GraalVM', getCacheVersionString(version), os.arch());
|
||||
let compressedFileExtension = '';
|
||||
if (toolPath) {
|
||||
core.debug(`GraalVM found in cache ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
core.debug('Downloading GraalVM from https://github.com/oracle/graal/releases');
|
||||
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
|
||||
let graalvmFile = yield tc.downloadTool(`https://github.com/oracle/graal/releases/download/vm-${version}/graalvm-ce-${platform}-amd64-${version}${compressedFileExtension}`);
|
||||
let tempDir = path.join(tempDirectory, 'temp_' + Math.floor(Math.random() * 2000000000));
|
||||
const graalvmDir = yield unzipGraalVMDownload(graalvmFile, compressedFileExtension, tempDir);
|
||||
core.debug(`graalvm extracted to ${graalvmDir}`);
|
||||
toolPath = yield tc.cacheDir(graalvmDir, 'GraalVM', getCacheVersionString(version));
|
||||
}
|
||||
let extendedJavaHome = 'JAVA_HOME_' + version;
|
||||
core.exportVariable('JAVA_HOME', toolPath);
|
||||
core.exportVariable(extendedJavaHome, toolPath);
|
||||
core.addPath(path.join(toolPath, 'bin'));
|
||||
});
|
||||
}
|
||||
exports.getGraalVM = getGraalVM;
|
||||
function getCacheVersionString(version) {
|
||||
const versionArray = version.split('.');
|
||||
const major = versionArray[0];
|
||||
const minor = versionArray.length > 1 ? versionArray[1] : '0';
|
||||
const patch = versionArray.length > 2 ? versionArray.slice(2).join('-') : '0';
|
||||
return `${major}.${minor}.${patch}`;
|
||||
}
|
||||
function extractFiles(file, fileEnding, destinationFolder) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const stats = fs.statSync(file);
|
||||
if (!stats) {
|
||||
throw new Error(`Failed to extract ${file} - it doesn't exist`);
|
||||
}
|
||||
else if (stats.isDirectory()) {
|
||||
throw new Error(`Failed to extract ${file} - it is a directory`);
|
||||
}
|
||||
if ('.tar.gz' === fileEnding) {
|
||||
yield tc.extractTar(file, destinationFolder);
|
||||
}
|
||||
else if ('.zip' === fileEnding) {
|
||||
yield tc.extractZip(file, destinationFolder);
|
||||
}
|
||||
});
|
||||
}
|
||||
function unpackJars(fsPath, javaBinPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (fs.existsSync(fsPath)) {
|
||||
if (fs.lstatSync(fsPath).isDirectory()) {
|
||||
for (const file in fs.readdirSync(fsPath)) {
|
||||
const curPath = path.join(fsPath, file);
|
||||
yield unpackJars(curPath, javaBinPath);
|
||||
}
|
||||
}
|
||||
else if (path.extname(fsPath).toLowerCase() === '.pack') {
|
||||
// Unpack the pack file synchonously
|
||||
const p = path.parse(fsPath);
|
||||
const toolName = IS_WINDOWS ? 'unpack200.exe' : 'unpack200';
|
||||
const args = IS_WINDOWS ? '-r -v -l ""' : '';
|
||||
const name = path.join(p.dir, p.name);
|
||||
yield exec.exec(`"${path.join(javaBinPath, toolName)}"`, [
|
||||
`${args} "${name}.pack" "${name}.jar"`
|
||||
]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function unzipGraalVMDownload(repoRoot, fileEnding, destinationFolder) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield io.mkdirP(destinationFolder);
|
||||
const graalvmFile = path.normalize(repoRoot);
|
||||
const stats = fs.statSync(graalvmFile);
|
||||
if (stats.isFile()) {
|
||||
yield extractFiles(graalvmFile, fileEnding, destinationFolder);
|
||||
const graalvmFolder = fs.readdirSync(destinationFolder)[0];
|
||||
if (process.platform === 'darwin') {
|
||||
for (const f of fs.readdirSync(path.join(destinationFolder, graalvmFolder, 'Contents', 'Home'))) {
|
||||
yield io.cp(path.join(destinationFolder, graalvmFolder, 'Contents', 'Home', f), path.join(destinationFolder, graalvmFolder, f), { recursive: true });
|
||||
}
|
||||
yield io.rmRF(path.join(destinationFolder, graalvmFolder, 'Contents'));
|
||||
}
|
||||
const graalvmDirectory = path.join(destinationFolder, graalvmFolder);
|
||||
yield unpackJars(graalvmDirectory, path.join(graalvmDirectory, 'bin'));
|
||||
return graalvmDirectory;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Jdk argument ${graalvmFile} is not a file`);
|
||||
}
|
||||
});
|
||||
}
|
@ -46,8 +46,8 @@ function setup(version) {
|
||||
core.info(`Leiningen found in cache ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
let leiningenFile = yield tc.downloadTool(`https://raw.githubusercontent.com/technomancy/leiningen/${version === 'latest' ? 'stable' : version}/bin/lein${IS_WINDOWS ? '.ps1' : ''}`);
|
||||
let tempDir = path.join(tempDirectory, 'temp_' + Math.floor(Math.random() * 2000000000));
|
||||
const leiningenFile = yield tc.downloadTool(`https://raw.githubusercontent.com/technomancy/leiningen/${version === 'latest' ? 'stable' : version}/bin/lein${IS_WINDOWS ? '.ps1' : ''}`);
|
||||
const tempDir = path.join(tempDirectory, `temp_${Math.floor(Math.random() * 2000000000)}`);
|
||||
const leiningenDir = yield installLeiningen(leiningenFile, tempDir);
|
||||
core.debug(`Leiningen installed to ${leiningenDir}`);
|
||||
toolPath = yield tc.cacheDir(leiningenDir, 'Leiningen', utils.getCacheVersionString(version));
|
||||
@ -72,7 +72,7 @@ function installLeiningen(binScript, destinationFolder) {
|
||||
yield exec.exec(`.${IS_WINDOWS ? '\\' : '/'}lein${IS_WINDOWS ? '.ps1' : ''} version`, [], {
|
||||
cwd: path.join(destinationFolder, 'leiningen', 'bin'),
|
||||
env: {
|
||||
'LEIN_HOME': path.join(destinationFolder, 'leiningen')
|
||||
LEIN_HOME: path.join(destinationFolder, 'leiningen')
|
||||
}
|
||||
});
|
||||
return path.join(destinationFolder, 'leiningen');
|
||||
|
20
lib/tdeps.js
20
lib/tdeps.js
@ -54,9 +54,9 @@ function setup(version) {
|
||||
core.info(`Clojure CLI found in cache ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
let clojureToolsFile = yield tc.downloadTool(`https://download.clojure.org/install/clojure-tools${version === 'latest' ? '' : '-' + version}.tar.gz`);
|
||||
let tempDir = path.join(tempDirectory, 'temp_' + Math.floor(Math.random() * 2000000000));
|
||||
const clojureToolsDir = yield installClojureToolsDeps(clojureToolsFile, tempDir, version);
|
||||
const clojureToolsFile = yield tc.downloadTool(`https://download.clojure.org/install/clojure-tools${version === 'latest' ? '' : `-${version}`}.tar.gz`);
|
||||
const tempDir = path.join(tempDirectory, `temp_${Math.floor(Math.random() * 2000000000)}`);
|
||||
const clojureToolsDir = yield installClojureToolsDeps(clojureToolsFile, tempDir);
|
||||
core.debug(`clojure tools deps installed to ${clojureToolsDir}`);
|
||||
toolPath = yield tc.cacheDir(clojureToolsDir, 'ClojureToolsDeps', utils.getCacheVersionString(version));
|
||||
}
|
||||
@ -66,7 +66,7 @@ function setup(version) {
|
||||
});
|
||||
}
|
||||
exports.setup = setup;
|
||||
function installClojureToolsDeps(installScript, destinationFolder, version) {
|
||||
function installClojureToolsDeps(installScript, destinationFolder) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield io.mkdirP(destinationFolder);
|
||||
const file = path.normalize(installScript);
|
||||
@ -84,7 +84,9 @@ function installClojureToolsDeps(installScript, destinationFolder, version) {
|
||||
yield io.mkdirP(clojureLibexecDir);
|
||||
yield io.mv(path.join(sourceDir, 'deps.edn'), clojureLibDir);
|
||||
yield io.mv(path.join(sourceDir, 'example-deps.edn'), clojureLibDir);
|
||||
let downloadedJar = fs.readdirSync(sourceDir).filter(file => file.endsWith('jar'))[0];
|
||||
const downloadedJar = fs
|
||||
.readdirSync(sourceDir)
|
||||
.filter(f => f.endsWith('jar'))[0];
|
||||
yield io.mv(path.join(sourceDir, downloadedJar), clojureLibexecDir);
|
||||
yield readWriteAsync(path.join(sourceDir, 'clojure'), '"$CLOJURE_INSTALL_DIR"');
|
||||
yield io.mv(path.join(sourceDir, 'clj'), binDir);
|
||||
@ -103,10 +105,10 @@ function readWriteAsync(file, replacement) {
|
||||
fs.readFile(file, 'utf-8', function (err, data) {
|
||||
if (err)
|
||||
throw err;
|
||||
var newValue = data.replace(/PREFIX/gim, replacement);
|
||||
fs.writeFile(file, newValue, 'utf-8', function (err) {
|
||||
if (err)
|
||||
throw err;
|
||||
const newValue = data.replace(/PREFIX/gim, replacement);
|
||||
fs.writeFile(file, newValue, 'utf-8', function (e) {
|
||||
if (e)
|
||||
throw e;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
12
node_modules/@actions/core/package.json
generated
vendored
12
node_modules/@actions/core/package.json
generated
vendored
@ -1,4 +1,10 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/core@1.2.4",
|
||||
"/Users/delaguardo/Projects/personal/setup-clojure"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/core@1.2.4",
|
||||
"_id": "@actions/core@1.2.4",
|
||||
"_inBundle": false,
|
||||
@ -17,19 +23,15 @@
|
||||
"fetchSpec": "1.2.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
|
||||
"_shasum": "96179dbf9f8d951dd74b40a0dbd5c22555d186ab",
|
||||
"_spec": "@actions/core@1.2.4",
|
||||
"_spec": "1.2.4",
|
||||
"_where": "/Users/delaguardo/Projects/personal/setup-clojure",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Actions core lib",
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
|
12
node_modules/@actions/exec/package.json
generated
vendored
12
node_modules/@actions/exec/package.json
generated
vendored
@ -1,4 +1,10 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/exec@1.0.4",
|
||||
"/Users/delaguardo/Projects/personal/setup-clojure"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/exec@1.0.4",
|
||||
"_id": "@actions/exec@1.0.4",
|
||||
"_inBundle": false,
|
||||
@ -17,22 +23,18 @@
|
||||
"fetchSpec": "1.0.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz",
|
||||
"_shasum": "99d75310e62e59fc37d2ee6dcff6d4bffadd3a5d",
|
||||
"_spec": "@actions/exec@1.0.4",
|
||||
"_spec": "1.0.4",
|
||||
"_where": "/Users/delaguardo/Projects/personal/setup-clojure",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@actions/io": "^1.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Actions exec lib",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
|
12
node_modules/@actions/io/package.json
generated
vendored
12
node_modules/@actions/io/package.json
generated
vendored
@ -1,4 +1,10 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/io@1.0.2",
|
||||
"/Users/delaguardo/Projects/personal/setup-clojure"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/io@1.0.2",
|
||||
"_id": "@actions/io@1.0.2",
|
||||
"_inBundle": false,
|
||||
@ -17,20 +23,16 @@
|
||||
"fetchSpec": "1.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/@actions/exec",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz",
|
||||
"_shasum": "2f614b6e69ce14d191180451eb38e6576a6e6b27",
|
||||
"_spec": "@actions/io@1.0.2",
|
||||
"_spec": "1.0.2",
|
||||
"_where": "/Users/delaguardo/Projects/personal/setup-clojure",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Actions io lib",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
|
12
node_modules/@actions/tool-cache/package.json
generated
vendored
12
node_modules/@actions/tool-cache/package.json
generated
vendored
@ -1,4 +1,10 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/tool-cache@1.6.0",
|
||||
"/Users/delaguardo/Projects/personal/setup-clojure"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/tool-cache@1.6.0",
|
||||
"_id": "@actions/tool-cache@1.6.0",
|
||||
"_inBundle": false,
|
||||
@ -17,17 +23,14 @@
|
||||
"fetchSpec": "1.6.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.6.0.tgz",
|
||||
"_shasum": "5b425db2d642df65dd0d6bcec0d84dcdbca3f80d",
|
||||
"_spec": "@actions/tool-cache@1.6.0",
|
||||
"_spec": "1.6.0",
|
||||
"_where": "/Users/delaguardo/Projects/personal/setup-clojure",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.3",
|
||||
"@actions/exec": "^1.0.0",
|
||||
@ -36,7 +39,6 @@
|
||||
"semver": "^6.1.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Actions tool-cache lib",
|
||||
"devDependencies": {
|
||||
"@types/nock": "^10.0.3",
|
||||
|
26
node_modules/semver/package.json
generated
vendored
26
node_modules/semver/package.json
generated
vendored
@ -1,37 +1,41 @@
|
||||
{
|
||||
"_from": "semver@^6.1.0",
|
||||
"_args": [
|
||||
[
|
||||
"semver@6.3.0",
|
||||
"/Users/delaguardo/Projects/personal/setup-clojure"
|
||||
]
|
||||
],
|
||||
"_from": "semver@6.3.0",
|
||||
"_id": "semver@6.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"_location": "/semver",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "semver@^6.1.0",
|
||||
"raw": "semver@6.3.0",
|
||||
"name": "semver",
|
||||
"escapedName": "semver",
|
||||
"rawSpec": "^6.1.0",
|
||||
"rawSpec": "6.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.1.0"
|
||||
"fetchSpec": "6.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@actions/tool-cache",
|
||||
"/istanbul-lib-instrument",
|
||||
"/jest-circus/istanbul-lib-instrument",
|
||||
"/jest-snapshot"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"_shasum": "ee0a64c8af5e8ceea67687b133761e1becbd1d3d",
|
||||
"_spec": "semver@^6.1.0",
|
||||
"_where": "/Users/delaguardo/Projects/personal/setup-clojure/node_modules/@actions/tool-cache",
|
||||
"_spec": "6.3.0",
|
||||
"_where": "/Users/delaguardo/Projects/personal/setup-clojure",
|
||||
"bin": {
|
||||
"semver": "./bin/semver.js"
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/node-semver/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"devDependencies": {
|
||||
"tap": "^14.3.1"
|
||||
|
13
node_modules/tunnel/package.json
generated
vendored
13
node_modules/tunnel/package.json
generated
vendored
@ -1,4 +1,10 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"tunnel@0.0.6",
|
||||
"/Users/delaguardo/Projects/personal/setup-clojure"
|
||||
]
|
||||
],
|
||||
"_from": "tunnel@0.0.6",
|
||||
"_id": "tunnel@0.0.6",
|
||||
"_inBundle": false,
|
||||
@ -19,9 +25,8 @@
|
||||
"/@actions/http-client"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||
"_shasum": "72f1314b34a5b192db012324df2cc587ca47f92c",
|
||||
"_spec": "tunnel@0.0.6",
|
||||
"_where": "/Users/delaguardo/Projects/personal/setup-clojure/node_modules/@actions/http-client",
|
||||
"_spec": "0.0.6",
|
||||
"_where": "/Users/delaguardo/Projects/personal/setup-clojure",
|
||||
"author": {
|
||||
"name": "Koichi Kobayashi",
|
||||
"email": "koichik@improvement.jp"
|
||||
@ -29,8 +34,6 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/koichik/node-tunnel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Node HTTP/HTTPS Agents for tunneling proxies",
|
||||
"devDependencies": {
|
||||
"mocha": "^5.2.0",
|
||||
|
26
node_modules/uuid/package.json
generated
vendored
26
node_modules/uuid/package.json
generated
vendored
@ -1,30 +1,36 @@
|
||||
{
|
||||
"_from": "uuid@^3.3.2",
|
||||
"_args": [
|
||||
[
|
||||
"uuid@3.3.3",
|
||||
"/Users/delaguardo/Projects/personal/setup-clojure"
|
||||
]
|
||||
],
|
||||
"_from": "uuid@3.3.3",
|
||||
"_id": "uuid@3.3.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==",
|
||||
"_location": "/uuid",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "uuid@^3.3.2",
|
||||
"raw": "uuid@3.3.3",
|
||||
"name": "uuid",
|
||||
"escapedName": "uuid",
|
||||
"rawSpec": "^3.3.2",
|
||||
"rawSpec": "3.3.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.3.2"
|
||||
"fetchSpec": "3.3.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@actions/tool-cache",
|
||||
"/jest-circus/request",
|
||||
"/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"_shasum": "4568f0216e78760ee1dbf3a4d2cf53e224112866",
|
||||
"_spec": "uuid@^3.3.2",
|
||||
"_where": "/Users/delaguardo/Projects/personal/setup-clojure/node_modules/@actions/tool-cache",
|
||||
"_spec": "3.3.3",
|
||||
"_where": "/Users/delaguardo/Projects/personal/setup-clojure",
|
||||
"bin": {
|
||||
"uuid": "./bin/uuid"
|
||||
"uuid": "bin/uuid"
|
||||
},
|
||||
"browser": {
|
||||
"./lib/rng.js": "./lib/rng-browser.js",
|
||||
@ -34,7 +40,6 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/kelektiv/node-uuid/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
@ -62,7 +67,6 @@
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "RFC4122 (v1, v4, and v5) UUIDs",
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "8.1.0",
|
||||
|
4320
package-lock.json
generated
4320
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@ -6,7 +6,12 @@
|
||||
"main": "lib/setup-clojure.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"test": "jest"
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"lint": "eslint src/**/*.ts",
|
||||
"package": "ncc build --source-map",
|
||||
"test": "jest",
|
||||
"all": "npm run build && npm run format && npm run lint && npm run package && npm test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -27,12 +32,18 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arkweid/lefthook": "^0.6.7",
|
||||
"@types/jest": "^24.9.1",
|
||||
"@types/node": "^12.12.54",
|
||||
"@types/jest": "^26.0.7",
|
||||
"@types/node": "^14.0.25",
|
||||
"@typescript-eslint/parser": "^3.7.0",
|
||||
"@zeit/ncc": "^0.22.3",
|
||||
"@types/semver": "^6.2.1",
|
||||
"jest": "^24.8.0",
|
||||
"jest-circus": "^24.7.1",
|
||||
"prettier": "^1.19.1",
|
||||
"eslint": "^7.5.0",
|
||||
"eslint-plugin-github": "^4.1.1",
|
||||
"eslint-plugin-jest": "^23.18.0",
|
||||
"jest": "^24.9.0",
|
||||
"jest-circus": "^26.1.0",
|
||||
"js-yaml": "^3.14.0",
|
||||
"prettier": "2.0.5",
|
||||
"ts-jest": "^24.3.0",
|
||||
"typescript": "^3.9.7"
|
||||
}
|
||||
|
162
src/boot.ts
162
src/boot.ts
@ -1,106 +1,98 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as io from '@actions/io';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
import * as utils from './utils';
|
||||
import * as core from '@actions/core'
|
||||
import * as io from '@actions/io'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import * as exec from '@actions/exec'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import * as os from 'os'
|
||||
import * as utils from './utils'
|
||||
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || ''
|
||||
const IS_WINDOWS = process.platform === 'win32'
|
||||
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
if (IS_WINDOWS) {
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
let baseLocation
|
||||
if (IS_WINDOWS) {
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\'
|
||||
} else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users'
|
||||
} else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
} else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
baseLocation = '/home'
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp')
|
||||
}
|
||||
|
||||
export async function setup(version: string): Promise<void> {
|
||||
let toolPath = tc.find(
|
||||
'Boot',
|
||||
utils.getCacheVersionString(version),
|
||||
os.arch()
|
||||
);
|
||||
let toolPath = tc.find(
|
||||
'Boot',
|
||||
utils.getCacheVersionString(version),
|
||||
os.arch()
|
||||
)
|
||||
|
||||
if (toolPath && version !== 'latest') {
|
||||
core.info(`Boot found in cache ${toolPath}`);
|
||||
} else {
|
||||
let bootBootstrapFile = await tc.downloadTool(
|
||||
`https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh`
|
||||
);
|
||||
let tempDir: string = path.join(
|
||||
tempDirectory,
|
||||
'temp_' + Math.floor(Math.random() * 2000000000)
|
||||
);
|
||||
const bootDir = await installBoot(
|
||||
bootBootstrapFile,
|
||||
tempDir,
|
||||
version
|
||||
);
|
||||
core.debug(`Boot installed to ${bootDir}`);
|
||||
toolPath = await tc.cacheDir(
|
||||
bootDir,
|
||||
'Boot',
|
||||
utils.getCacheVersionString(version)
|
||||
);
|
||||
}
|
||||
if (toolPath && version !== 'latest') {
|
||||
core.info(`Boot found in cache ${toolPath}`)
|
||||
} else {
|
||||
const bootBootstrapFile = await tc.downloadTool(
|
||||
`https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh`
|
||||
)
|
||||
const tempDir: string = path.join(
|
||||
tempDirectory,
|
||||
`temp_${Math.floor(Math.random() * 2000000000)}`
|
||||
)
|
||||
const bootDir = await installBoot(bootBootstrapFile, tempDir, version)
|
||||
core.debug(`Boot installed to ${bootDir}`)
|
||||
toolPath = await tc.cacheDir(
|
||||
bootDir,
|
||||
'Boot',
|
||||
utils.getCacheVersionString(version)
|
||||
)
|
||||
}
|
||||
|
||||
core.exportVariable('BOOT_HOME', toolPath);
|
||||
if (version !== 'latest') {
|
||||
core.exportVariable('BOOT_VERSION', version);
|
||||
}
|
||||
core.addPath(path.join(toolPath, 'bin'));
|
||||
core.exportVariable('BOOT_HOME', toolPath)
|
||||
if (version !== 'latest') {
|
||||
core.exportVariable('BOOT_VERSION', version)
|
||||
}
|
||||
core.addPath(path.join(toolPath, 'bin'))
|
||||
}
|
||||
|
||||
async function installBoot(
|
||||
binScript: string,
|
||||
destinationFolder: string,
|
||||
version: string
|
||||
binScript: string,
|
||||
destinationFolder: string,
|
||||
version: string
|
||||
): Promise<string> {
|
||||
await io.mkdirP(destinationFolder);
|
||||
await io.mkdirP(destinationFolder)
|
||||
|
||||
const bin = path.normalize(binScript);
|
||||
const binStats = fs.statSync(bin);
|
||||
if (binStats.isFile()) {
|
||||
const binDir = path.join(destinationFolder, 'boot', 'bin');
|
||||
const bin = path.normalize(binScript)
|
||||
const binStats = fs.statSync(bin)
|
||||
if (binStats.isFile()) {
|
||||
const binDir = path.join(destinationFolder, 'boot', 'bin')
|
||||
|
||||
await io.mkdirP(binDir);
|
||||
await io.mkdirP(binDir)
|
||||
|
||||
await io.mv(bin, path.join(binDir, `boot`));
|
||||
fs.chmodSync(path.join(binDir, `boot`), '0755');
|
||||
await io.mv(bin, path.join(binDir, `boot`))
|
||||
fs.chmodSync(path.join(binDir, `boot`), '0755')
|
||||
|
||||
let env = {};
|
||||
if (version === 'latest') {
|
||||
env = {
|
||||
BOOT_HOME: path.join(destinationFolder, 'boot')
|
||||
};
|
||||
} else {
|
||||
env = {
|
||||
BOOT_HOME: path.join(destinationFolder, 'boot'),
|
||||
BOOT_VERSION: version
|
||||
}
|
||||
}
|
||||
|
||||
await exec.exec(
|
||||
`./boot ${version === 'latest' ? '-u' : '-V'}`,
|
||||
[],
|
||||
{
|
||||
cwd: path.join(destinationFolder, 'boot', 'bin'),
|
||||
env: env
|
||||
}
|
||||
);
|
||||
|
||||
return path.join(destinationFolder, 'boot');
|
||||
let env = {}
|
||||
if (version === 'latest') {
|
||||
env = {
|
||||
BOOT_HOME: path.join(destinationFolder, 'boot')
|
||||
}
|
||||
} else {
|
||||
throw new Error('Not a file');
|
||||
env = {
|
||||
BOOT_HOME: path.join(destinationFolder, 'boot'),
|
||||
BOOT_VERSION: version
|
||||
}
|
||||
}
|
||||
|
||||
await exec.exec(`./boot ${version === 'latest' ? '-u' : '-V'}`, [], {
|
||||
cwd: path.join(destinationFolder, 'boot', 'bin'),
|
||||
env
|
||||
})
|
||||
|
||||
return path.join(destinationFolder, 'boot')
|
||||
} else {
|
||||
throw new Error('Not a file')
|
||||
}
|
||||
}
|
||||
|
129
src/leiningen.ts
129
src/leiningen.ts
@ -1,80 +1,79 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as io from '@actions/io';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
import * as utils from './utils';
|
||||
import * as core from '@actions/core'
|
||||
import * as io from '@actions/io'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import * as exec from '@actions/exec'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import * as os from 'os'
|
||||
import * as utils from './utils'
|
||||
|
||||
const tempDirectory = utils.getTempDir();
|
||||
const IS_WINDOWS = utils.isWindows();
|
||||
const tempDirectory = utils.getTempDir()
|
||||
const IS_WINDOWS = utils.isWindows()
|
||||
|
||||
export async function setup(version: string): Promise<void> {
|
||||
let toolPath = tc.find(
|
||||
'Leiningen',
|
||||
utils.getCacheVersionString(version),
|
||||
os.arch()
|
||||
);
|
||||
let toolPath = tc.find(
|
||||
'Leiningen',
|
||||
utils.getCacheVersionString(version),
|
||||
os.arch()
|
||||
)
|
||||
|
||||
if (toolPath && version !== 'latest') {
|
||||
core.info(`Leiningen found in cache ${toolPath}`);
|
||||
} else {
|
||||
let leiningenFile = await tc.downloadTool(
|
||||
`https://raw.githubusercontent.com/technomancy/leiningen/${version === 'latest' ? 'stable' : version}/bin/lein${IS_WINDOWS ? '.ps1' : ''}`
|
||||
);
|
||||
let tempDir: string = path.join(
|
||||
tempDirectory,
|
||||
'temp_' + Math.floor(Math.random() * 2000000000)
|
||||
);
|
||||
const leiningenDir = await installLeiningen(
|
||||
leiningenFile,
|
||||
tempDir
|
||||
);
|
||||
core.debug(`Leiningen installed to ${leiningenDir}`);
|
||||
toolPath = await tc.cacheDir(
|
||||
leiningenDir,
|
||||
'Leiningen',
|
||||
utils.getCacheVersionString(version)
|
||||
);
|
||||
}
|
||||
if (toolPath && version !== 'latest') {
|
||||
core.info(`Leiningen found in cache ${toolPath}`)
|
||||
} else {
|
||||
const leiningenFile = await tc.downloadTool(
|
||||
`https://raw.githubusercontent.com/technomancy/leiningen/${
|
||||
version === 'latest' ? 'stable' : version
|
||||
}/bin/lein${IS_WINDOWS ? '.ps1' : ''}`
|
||||
)
|
||||
const tempDir: string = path.join(
|
||||
tempDirectory,
|
||||
`temp_${Math.floor(Math.random() * 2000000000)}`
|
||||
)
|
||||
const leiningenDir = await installLeiningen(leiningenFile, tempDir)
|
||||
core.debug(`Leiningen installed to ${leiningenDir}`)
|
||||
toolPath = await tc.cacheDir(
|
||||
leiningenDir,
|
||||
'Leiningen',
|
||||
utils.getCacheVersionString(version)
|
||||
)
|
||||
}
|
||||
|
||||
core.exportVariable('LEIN_HOME', toolPath);
|
||||
core.addPath(path.join(toolPath, 'bin'));
|
||||
core.exportVariable('LEIN_HOME', toolPath)
|
||||
core.addPath(path.join(toolPath, 'bin'))
|
||||
}
|
||||
|
||||
async function installLeiningen(
|
||||
binScript: string,
|
||||
destinationFolder: string
|
||||
binScript: string,
|
||||
destinationFolder: string
|
||||
): Promise<string> {
|
||||
await io.mkdirP(destinationFolder);
|
||||
await io.mkdirP(destinationFolder)
|
||||
|
||||
const bin = path.normalize(binScript);
|
||||
const binStats = fs.statSync(bin);
|
||||
if (binStats.isFile()) {
|
||||
const binDir = path.join(destinationFolder, 'leiningen', 'bin');
|
||||
const bin = path.normalize(binScript)
|
||||
const binStats = fs.statSync(bin)
|
||||
if (binStats.isFile()) {
|
||||
const binDir = path.join(destinationFolder, 'leiningen', 'bin')
|
||||
|
||||
await io.mkdirP(binDir);
|
||||
await io.mkdirP(binDir)
|
||||
|
||||
await io.mv(bin, path.join(binDir, `lein${IS_WINDOWS ? '.ps1' : ''}`));
|
||||
await io.mv(bin, path.join(binDir, `lein${IS_WINDOWS ? '.ps1' : ''}`))
|
||||
|
||||
if (!IS_WINDOWS) {
|
||||
fs.chmodSync(path.join(binDir, `lein`), '0755');
|
||||
}
|
||||
|
||||
await exec.exec(
|
||||
`.${IS_WINDOWS ? '\\' : '/'}lein${IS_WINDOWS ? '.ps1' : ''} version`,
|
||||
[],
|
||||
{
|
||||
cwd: path.join(destinationFolder, 'leiningen', 'bin'),
|
||||
env: {
|
||||
'LEIN_HOME': path.join(destinationFolder, 'leiningen')
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return path.join(destinationFolder, 'leiningen');
|
||||
} else {
|
||||
throw new Error('Not a file');
|
||||
if (!IS_WINDOWS) {
|
||||
fs.chmodSync(path.join(binDir, `lein`), '0755')
|
||||
}
|
||||
|
||||
await exec.exec(
|
||||
`.${IS_WINDOWS ? '\\' : '/'}lein${IS_WINDOWS ? '.ps1' : ''} version`,
|
||||
[],
|
||||
{
|
||||
cwd: path.join(destinationFolder, 'leiningen', 'bin'),
|
||||
env: {
|
||||
LEIN_HOME: path.join(destinationFolder, 'leiningen')
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return path.join(destinationFolder, 'leiningen')
|
||||
} else {
|
||||
throw new Error('Not a file')
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +1,32 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as lein from './leiningen';
|
||||
import * as boot from './boot';
|
||||
import * as tdeps from './tdeps';
|
||||
import * as core from '@actions/core'
|
||||
import * as lein from './leiningen'
|
||||
import * as boot from './boot'
|
||||
import * as tdeps from './tdeps'
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const Lein = core.getInput('lein');
|
||||
const Boot = core.getInput('boot');
|
||||
const Tdeps = core.getInput('tools-deps');
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
const Lein = core.getInput('lein')
|
||||
const Boot = core.getInput('boot')
|
||||
const Tdeps = core.getInput('tools-deps')
|
||||
|
||||
if (Lein) {
|
||||
lein.setup(Lein);
|
||||
}
|
||||
|
||||
if (Boot) {
|
||||
boot.setup(Boot);
|
||||
}
|
||||
|
||||
if (Tdeps) {
|
||||
tdeps.setup(Tdeps);
|
||||
}
|
||||
|
||||
if (!Boot && !Lein && !Tdeps) {
|
||||
throw new Error('You must specify at least one clojure tool.');
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
if (Lein) {
|
||||
lein.setup(Lein)
|
||||
}
|
||||
|
||||
if (Boot) {
|
||||
boot.setup(Boot)
|
||||
}
|
||||
|
||||
if (Tdeps) {
|
||||
tdeps.setup(Tdeps)
|
||||
}
|
||||
|
||||
if (!Boot && !Lein && !Tdeps) {
|
||||
throw new Error('You must specify at least one clojure tool.')
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
run()
|
||||
|
191
src/tdeps.ts
191
src/tdeps.ts
@ -1,122 +1,121 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as io from '@actions/io';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
import * as utils from './utils';
|
||||
import * as core from '@actions/core'
|
||||
import * as io from '@actions/io'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import * as os from 'os'
|
||||
import * as utils from './utils'
|
||||
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || ''
|
||||
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
let baseLocation
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
} else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users'
|
||||
} else {
|
||||
baseLocation = '/home'
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp')
|
||||
}
|
||||
|
||||
export async function setup(version: string): Promise<void> {
|
||||
let toolPath = tc.find(
|
||||
'ClojureToolsDeps',
|
||||
utils.getCacheVersionString(version),
|
||||
os.arch()
|
||||
);
|
||||
let toolPath = tc.find(
|
||||
'ClojureToolsDeps',
|
||||
utils.getCacheVersionString(version),
|
||||
os.arch()
|
||||
)
|
||||
|
||||
if (toolPath && version !== 'latest') {
|
||||
core.info(`Clojure CLI found in cache ${toolPath}`);
|
||||
} else {
|
||||
let clojureToolsFile = await tc.downloadTool(
|
||||
`https://download.clojure.org/install/clojure-tools${version === 'latest' ? '' : '-' + version}.tar.gz`
|
||||
);
|
||||
let tempDir: string = path.join(
|
||||
tempDirectory,
|
||||
'temp_' + Math.floor(Math.random() * 2000000000)
|
||||
);
|
||||
const clojureToolsDir = await installClojureToolsDeps(
|
||||
clojureToolsFile,
|
||||
tempDir,
|
||||
version
|
||||
);
|
||||
core.debug(`clojure tools deps installed to ${clojureToolsDir}`);
|
||||
toolPath = await tc.cacheDir(
|
||||
clojureToolsDir,
|
||||
'ClojureToolsDeps',
|
||||
utils.getCacheVersionString(version)
|
||||
);
|
||||
}
|
||||
if (toolPath && version !== 'latest') {
|
||||
core.info(`Clojure CLI found in cache ${toolPath}`)
|
||||
} else {
|
||||
const clojureToolsFile = await tc.downloadTool(
|
||||
`https://download.clojure.org/install/clojure-tools${
|
||||
version === 'latest' ? '' : `-${version}`
|
||||
}.tar.gz`
|
||||
)
|
||||
const tempDir: string = path.join(
|
||||
tempDirectory,
|
||||
`temp_${Math.floor(Math.random() * 2000000000)}`
|
||||
)
|
||||
const clojureToolsDir = await installClojureToolsDeps(
|
||||
clojureToolsFile,
|
||||
tempDir
|
||||
)
|
||||
core.debug(`clojure tools deps installed to ${clojureToolsDir}`)
|
||||
toolPath = await tc.cacheDir(
|
||||
clojureToolsDir,
|
||||
'ClojureToolsDeps',
|
||||
utils.getCacheVersionString(version)
|
||||
)
|
||||
}
|
||||
|
||||
const installDir = path.join(toolPath, 'lib', 'clojure');
|
||||
core.exportVariable('CLOJURE_INSTALL_DIR', installDir);
|
||||
core.addPath(path.join(toolPath, 'bin'));
|
||||
const installDir = path.join(toolPath, 'lib', 'clojure')
|
||||
core.exportVariable('CLOJURE_INSTALL_DIR', installDir)
|
||||
core.addPath(path.join(toolPath, 'bin'))
|
||||
}
|
||||
|
||||
async function installClojureToolsDeps(
|
||||
installScript: string,
|
||||
destinationFolder: string,
|
||||
version: string
|
||||
installScript: string,
|
||||
destinationFolder: string
|
||||
): Promise<string> {
|
||||
await io.mkdirP(destinationFolder);
|
||||
await io.mkdirP(destinationFolder)
|
||||
|
||||
const file = path.normalize(installScript);
|
||||
const stats = fs.statSync(file);
|
||||
if (stats.isFile()) {
|
||||
const binDir = path.join(destinationFolder, 'clojure', 'bin');
|
||||
const libDir = path.join(destinationFolder, 'clojure', 'lib');
|
||||
const manDir = path.join(
|
||||
destinationFolder,
|
||||
'clojure',
|
||||
'share',
|
||||
'man',
|
||||
'man1'
|
||||
);
|
||||
const clojureLibDir = path.join(libDir, 'clojure');
|
||||
const clojureLibexecDir = path.join(clojureLibDir, 'libexec');
|
||||
const file = path.normalize(installScript)
|
||||
const stats = fs.statSync(file)
|
||||
if (stats.isFile()) {
|
||||
const binDir = path.join(destinationFolder, 'clojure', 'bin')
|
||||
const libDir = path.join(destinationFolder, 'clojure', 'lib')
|
||||
const manDir = path.join(
|
||||
destinationFolder,
|
||||
'clojure',
|
||||
'share',
|
||||
'man',
|
||||
'man1'
|
||||
)
|
||||
const clojureLibDir = path.join(libDir, 'clojure')
|
||||
const clojureLibexecDir = path.join(clojureLibDir, 'libexec')
|
||||
|
||||
await tc.extractTar(file, destinationFolder);
|
||||
await tc.extractTar(file, destinationFolder)
|
||||
|
||||
const sourceDir = path.join(destinationFolder, 'clojure-tools');
|
||||
const sourceDir = path.join(destinationFolder, 'clojure-tools')
|
||||
|
||||
await io.mkdirP(binDir);
|
||||
await io.mkdirP(manDir);
|
||||
await io.mkdirP(clojureLibexecDir);
|
||||
await io.mkdirP(binDir)
|
||||
await io.mkdirP(manDir)
|
||||
await io.mkdirP(clojureLibexecDir)
|
||||
|
||||
await io.mv(path.join(sourceDir, 'deps.edn'), clojureLibDir);
|
||||
await io.mv(path.join(sourceDir, 'example-deps.edn'), clojureLibDir);
|
||||
let downloadedJar: string = fs.readdirSync(sourceDir).filter(file => file.endsWith('jar'))[0];
|
||||
await io.mv(
|
||||
path.join(sourceDir, downloadedJar),
|
||||
clojureLibexecDir
|
||||
);
|
||||
await readWriteAsync(
|
||||
path.join(sourceDir, 'clojure'),
|
||||
'"$CLOJURE_INSTALL_DIR"'
|
||||
);
|
||||
await io.mv(path.join(sourceDir, 'clj'), binDir);
|
||||
await io.mv(path.join(sourceDir, 'clojure'), binDir);
|
||||
await io.mv(path.join(sourceDir, 'clojure.1'), manDir);
|
||||
await io.mv(path.join(sourceDir, 'clj.1'), manDir);
|
||||
await io.mv(path.join(sourceDir, 'deps.edn'), clojureLibDir)
|
||||
await io.mv(path.join(sourceDir, 'example-deps.edn'), clojureLibDir)
|
||||
const downloadedJar: string = fs
|
||||
.readdirSync(sourceDir)
|
||||
.filter(f => f.endsWith('jar'))[0]
|
||||
await io.mv(path.join(sourceDir, downloadedJar), clojureLibexecDir)
|
||||
await readWriteAsync(
|
||||
path.join(sourceDir, 'clojure'),
|
||||
'"$CLOJURE_INSTALL_DIR"'
|
||||
)
|
||||
await io.mv(path.join(sourceDir, 'clj'), binDir)
|
||||
await io.mv(path.join(sourceDir, 'clojure'), binDir)
|
||||
await io.mv(path.join(sourceDir, 'clojure.1'), manDir)
|
||||
await io.mv(path.join(sourceDir, 'clj.1'), manDir)
|
||||
|
||||
return path.join(destinationFolder, 'clojure');
|
||||
} else {
|
||||
throw new Error(`Not a file`);
|
||||
}
|
||||
return path.join(destinationFolder, 'clojure')
|
||||
} else {
|
||||
throw new Error(`Not a file`)
|
||||
}
|
||||
}
|
||||
|
||||
async function readWriteAsync(
|
||||
file: string,
|
||||
replacement: string
|
||||
file: string,
|
||||
replacement: string
|
||||
): Promise<void> {
|
||||
fs.readFile(file, 'utf-8', function(err, data) {
|
||||
if (err) throw err;
|
||||
fs.readFile(file, 'utf-8', function (err, data) {
|
||||
if (err) throw err
|
||||
|
||||
var newValue = data.replace(/PREFIX/gim, replacement);
|
||||
const newValue = data.replace(/PREFIX/gim, replacement)
|
||||
|
||||
fs.writeFile(file, newValue, 'utf-8', function(err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
fs.writeFile(file, newValue, 'utf-8', function (e) {
|
||||
if (e) throw e
|
||||
})
|
||||
})
|
||||
}
|
||||
|
34
src/utils.ts
34
src/utils.ts
@ -1,34 +1,34 @@
|
||||
import * as path from 'path';
|
||||
import * as path from 'path'
|
||||
|
||||
export function getCacheVersionString(version: string) {
|
||||
const versionArray = version.split('.');
|
||||
const major = versionArray[0];
|
||||
const minor = versionArray.length > 1 ? versionArray[1] : '0';
|
||||
const patch = versionArray.length > 2 ? versionArray.slice(2).join('-') : '0';
|
||||
return `${major}.${minor}.${patch}`;
|
||||
export function getCacheVersionString(version: string): string {
|
||||
const versionArray = version.split('.')
|
||||
const major = versionArray[0]
|
||||
const minor = versionArray.length > 1 ? versionArray[1] : '0'
|
||||
const patch = versionArray.length > 2 ? versionArray.slice(2).join('-') : '0'
|
||||
return `${major}.${minor}.${patch}`
|
||||
}
|
||||
|
||||
export function getTempDir() {
|
||||
let tempDirectory = process.env.RUNNER_TEMP;
|
||||
export function getTempDir(): string {
|
||||
let tempDirectory = process.env.RUNNER_TEMP
|
||||
if (tempDirectory === undefined) {
|
||||
let baseLocation;
|
||||
let baseLocation
|
||||
if (isWindows()) {
|
||||
// On windows use the USERPROFILE env variable
|
||||
baseLocation = process.env['USERPROFILE']
|
||||
? process.env['USERPROFILE']
|
||||
: 'C:\\';
|
||||
: 'C:\\'
|
||||
} else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
baseLocation = '/Users'
|
||||
} else {
|
||||
baseLocation = '/home';
|
||||
baseLocation = '/home'
|
||||
}
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp')
|
||||
}
|
||||
return tempDirectory;
|
||||
return tempDirectory
|
||||
}
|
||||
|
||||
export function isWindows() {
|
||||
return process.platform === 'win32';
|
||||
export function isWindows(): boolean {
|
||||
return process.platform === 'win32'
|
||||
}
|
||||
|
@ -1,63 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Basic Options */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
// "composite": true, /* Enable project compilation */
|
||||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
||||
// "removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||
|
||||
/* Additional Checks */
|
||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
|
||||
/* Module Resolution Options */
|
||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
|
||||
/* Source Map Options */
|
||||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.test.ts"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user