Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f6fcee330 | ||
|
|
d6e58394ed | ||
|
|
24b4fa76d2 | ||
|
|
ae4917dae5 | ||
|
|
e336b852d5 | ||
|
|
3342d62b16 | ||
|
|
fe821292b0 | ||
|
|
0611362f9b | ||
|
|
633a4406d7 |
+92
-2
@@ -1,2 +1,92 @@
|
|||||||
!node_modules/
|
# Explicitly not ignoring node_modules so that they are included in package downloaded by runner
|
||||||
__tests__/runner/*
|
!node_modules/
|
||||||
|
__tests__/runner/*
|
||||||
|
|
||||||
|
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|||||||
+10
-10
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"printWidth": 80,
|
"printWidth": 80,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"useTabs": false,
|
"useTabs": false,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"bracketSpacing": false,
|
"bracketSpacing": false,
|
||||||
"arrowParens": "avoid",
|
"arrowParens": "avoid",
|
||||||
"parser": "typescript"
|
"parser": "typescript"
|
||||||
}
|
}
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2018 GitHub, Inc. and contributors
|
Copyright (c) 2018 GitHub, Inc. and contributors
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
furnished to do so, subject to the following conditions:
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
@@ -1,47 +1,52 @@
|
|||||||
# setup-python
|
# setup-python
|
||||||
|
|
||||||
This action sets up a python environment for use in actions by:
|
<p align="left">
|
||||||
|
<a href="https://github.com/actions/setup-python"><img alt="GitHub Actions status" src="https://github.com/actions/setup-python/workflows/Main%20workflow/badge.svg"></a>
|
||||||
- optionally installing a version of python and adding to PATH. Note that this action only uses versions of Python already installed in the cache. The action will fail if no matching versions are found.
|
</p>
|
||||||
- registering problem matchers for error output
|
|
||||||
|
This action sets up a python environment for use in actions by:
|
||||||
# Usage
|
|
||||||
|
- optionally installing a version of python and adding to PATH. Note that this action only uses versions of Python already installed in the cache. The action will fail if no matching versions are found.
|
||||||
See [action.yml](action.yml)
|
- registering problem matchers for error output
|
||||||
|
|
||||||
Basic:
|
# Usage
|
||||||
```yaml
|
|
||||||
steps:
|
See [action.yml](action.yml)
|
||||||
- uses: actions/checkout@master
|
|
||||||
- uses: actions/setup-python@v1
|
Basic:
|
||||||
with:
|
```yaml
|
||||||
version: 3.x // Version range or exact version of a Python version to use, using semvers version range syntax.
|
steps:
|
||||||
architecture: x64 // (x64 or x86)
|
- uses: actions/checkout@master
|
||||||
- run: python my_script.py
|
- uses: actions/setup-python@v1
|
||||||
```
|
with:
|
||||||
|
python-version: '3.x' # Version range or exact version of a Python version to use, using semvers version range syntax.
|
||||||
Matrix Testing:
|
architecture: 'x64' # (x64 or x86)
|
||||||
```yaml
|
- run: python my_script.py
|
||||||
jobs:
|
```
|
||||||
build:
|
|
||||||
strategy:
|
Matrix Testing:
|
||||||
matrix:
|
```yaml
|
||||||
python: [ 2.x, 3.x, pypy3 ]
|
jobs:
|
||||||
name: Python ${{ matrix.python }} sample
|
build:
|
||||||
steps:
|
runs-on: ubuntu-16.04
|
||||||
- uses: actions/checkout@master
|
strategy:
|
||||||
- name: Setup python
|
matrix:
|
||||||
uses: actions/setup-python@v1
|
python: [ '2.x', '3.x', 'pypy3' ]
|
||||||
with:
|
name: Python ${{ matrix.python }} sample
|
||||||
version: ${{ matrix.python }}
|
steps:
|
||||||
architecture: x64
|
- uses: actions/checkout@master
|
||||||
- run: python my_script.py
|
- name: Setup python
|
||||||
```
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
# License
|
python-version: ${{ matrix.python }}
|
||||||
|
architecture: x64
|
||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
- run: python my_script.py
|
||||||
|
```
|
||||||
# Contributions
|
|
||||||
|
# License
|
||||||
Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
|
|
||||||
|
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
||||||
|
|
||||||
|
# Contributions
|
||||||
|
|
||||||
|
Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
|
||||||
|
|||||||
+58
-58
@@ -1,58 +1,58 @@
|
|||||||
import io = require('@actions/io');
|
import io = require('@actions/io');
|
||||||
import fs = require('fs');
|
import fs = require('fs');
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
|
|
||||||
const toolDir = path.join(
|
const toolDir = path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
'runner',
|
'runner',
|
||||||
path.join(
|
path.join(
|
||||||
Math.random()
|
Math.random()
|
||||||
.toString(36)
|
.toString(36)
|
||||||
.substring(7)
|
.substring(7)
|
||||||
),
|
),
|
||||||
'tools'
|
'tools'
|
||||||
);
|
);
|
||||||
const tempDir = path.join(
|
const tempDir = path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
'runner',
|
'runner',
|
||||||
path.join(
|
path.join(
|
||||||
Math.random()
|
Math.random()
|
||||||
.toString(36)
|
.toString(36)
|
||||||
.substring(7)
|
.substring(7)
|
||||||
),
|
),
|
||||||
'temp'
|
'temp'
|
||||||
);
|
);
|
||||||
|
|
||||||
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
||||||
process.env['RUNNER_TEMP'] = tempDir;
|
process.env['RUNNER_TEMP'] = tempDir;
|
||||||
|
|
||||||
import * as finder from '../src/find-python';
|
import * as finder from '../src/find-python';
|
||||||
|
|
||||||
describe('Finder tests', () => {
|
describe('Finder tests', () => {
|
||||||
it('Finds Python if it is installed', async () => {
|
it('Finds Python if it is installed', async () => {
|
||||||
const pythonDir: string = path.join(toolDir, 'Python', '3.0.0', 'x64');
|
const pythonDir: string = path.join(toolDir, 'Python', '3.0.0', 'x64');
|
||||||
await io.mkdirP(pythonDir);
|
await io.mkdirP(pythonDir);
|
||||||
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
||||||
// This will throw if it doesn't find it in the cache (because no such version exists)
|
// This will throw if it doesn't find it in the cache (because no such version exists)
|
||||||
await finder.findPythonVersion('3.x', 'x64');
|
await finder.findPythonVersion('3.x', 'x64');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Errors if Python is not installed', async () => {
|
it('Errors if Python is not installed', async () => {
|
||||||
// This will throw if it doesn't find it in the cache (because no such version exists)
|
// This will throw if it doesn't find it in the cache (because no such version exists)
|
||||||
let thrown = false;
|
let thrown = false;
|
||||||
try {
|
try {
|
||||||
await finder.findPythonVersion('3.300000', 'x64');
|
await finder.findPythonVersion('3.300000', 'x64');
|
||||||
} catch {
|
} catch {
|
||||||
thrown = true;
|
thrown = true;
|
||||||
}
|
}
|
||||||
expect(thrown).toBeTruthy();
|
expect(thrown).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Finds PyPy if it is installed', async () => {
|
it('Finds PyPy if it is installed', async () => {
|
||||||
const pythonDir: string = path.join(toolDir, 'PyPy', '2.0.0', 'x64');
|
const pythonDir: string = path.join(toolDir, 'PyPy', '2.0.0', 'x64');
|
||||||
await io.mkdirP(pythonDir);
|
await io.mkdirP(pythonDir);
|
||||||
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
||||||
// This will throw if it doesn't find it in the cache (because no such version exists)
|
// This will throw if it doesn't find it in the cache (because no such version exists)
|
||||||
await finder.findPythonVersion('pypy2', 'x64');
|
await finder.findPythonVersion('pypy2', 'x64');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+17
-13
@@ -1,13 +1,17 @@
|
|||||||
name: 'Setup Node.js for use with actions'
|
name: 'Setup Python environment'
|
||||||
description: 'Setup a Node.js environment and add it to the PATH, additionally providing proxy support'
|
description: 'Setup a Python environment and add it to the PATH, additionally providing proxy support'
|
||||||
author: 'GitHub'
|
author: 'GitHub'
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
python-version:
|
||||||
description: 'Version range or exact version of a Python version to use, using semvers version range syntax.'
|
description: 'Version range or exact version of a Python version to use, using semvers version range syntax.'
|
||||||
default: '3.x'
|
default: '3.x'
|
||||||
architecture:
|
architecture:
|
||||||
description: 'The target architecture (x86, x64) of the Python interpreter.'
|
description: 'The target architecture (x86, x64) of the Python interpreter.'
|
||||||
default: 'x64'
|
default: 'x64'
|
||||||
runs:
|
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
||||||
using: 'node12'
|
version:
|
||||||
main: 'lib/setup-python.js'
|
description: 'Deprecated. Use python-version instead. Will not be supported after October 1, 2019'
|
||||||
|
deprecationMessage: 'The version property will not be supported after October 1, 2019. Use python-version instead'
|
||||||
|
runs:
|
||||||
|
using: 'node12'
|
||||||
|
main: 'lib/setup-python.js'
|
||||||
|
|||||||
+21
-21
@@ -1,22 +1,22 @@
|
|||||||
# Contributors
|
# Contributors
|
||||||
|
|
||||||
### Checkin
|
### Checkin
|
||||||
|
|
||||||
- Do checkin source (src)
|
- Do checkin source (src)
|
||||||
- Do checkin build output (lib)
|
- Do checkin build output (lib)
|
||||||
- Do checkin runtime node_modules
|
- Do checkin runtime node_modules
|
||||||
- Do not checkin devDependency node_modules (husky can help see below)
|
- Do not checkin devDependency node_modules (husky can help see below)
|
||||||
|
|
||||||
### devDependencies
|
### devDependencies
|
||||||
|
|
||||||
In order to handle correctly checking in node_modules without devDependencies, we run [Husky](https://github.com/typicode/husky) before each commit.
|
In order to handle correctly checking in node_modules without devDependencies, we run [Husky](https://github.com/typicode/husky) before each commit.
|
||||||
This step ensures that formatting and checkin rules are followed and that devDependencies are excluded. To make sure Husky runs correctly, please use the following workflow:
|
This step ensures that formatting and checkin rules are followed and that devDependencies are excluded. To make sure Husky runs correctly, please use the following workflow:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install # installs all devDependencies including Husky
|
npm install # installs all devDependencies including Husky
|
||||||
git add abc.ext # Add the files you've changed. This should include files in src, lib, and node_modules (see above)
|
git add abc.ext # Add the files you've changed. This should include files in src, lib, and node_modules (see above)
|
||||||
git commit -m "Informative commit message" # Commit. This will run Husky
|
git commit -m "Informative commit message" # Commit. This will run Husky
|
||||||
```
|
```
|
||||||
|
|
||||||
During the commit step, Husky will take care of formatting all files with [Prettier](https://github.com/prettier/prettier) as well as pruning out devDependencies using `npm prune --production`.
|
During the commit step, Husky will take care of formatting all files with [Prettier](https://github.com/prettier/prettier) as well as pruning out devDependencies using `npm prune --production`.
|
||||||
It will also make sure these changes are appropriately included in your commit (no further work is needed)
|
It will also make sure these changes are appropriately included in your commit (no further work is needed)
|
||||||
+10
-10
@@ -1,11 +1,11 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
moduleFileExtensions: ['js', 'ts'],
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
testMatch: ['**/*.test.ts'],
|
testMatch: ['**/*.test.ts'],
|
||||||
testRunner: 'jest-circus/runner',
|
testRunner: 'jest-circus/runner',
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': 'ts-jest'
|
||||||
},
|
},
|
||||||
verbose: true
|
verbose: true
|
||||||
}
|
}
|
||||||
+159
-159
@@ -1,159 +1,159 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
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 rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const semver = __importStar(require("semver"));
|
const semver = __importStar(require("semver"));
|
||||||
let cacheDirectory = process.env['RUNNER_TOOLSDIRECTORY'] || '';
|
let cacheDirectory = process.env['RUNNER_TOOLSDIRECTORY'] || '';
|
||||||
if (!cacheDirectory) {
|
if (!cacheDirectory) {
|
||||||
let baseLocation;
|
let baseLocation;
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
// On windows use the USERPROFILE env variable
|
// On windows use the USERPROFILE env variable
|
||||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
baseLocation = '/Users';
|
baseLocation = '/Users';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
baseLocation = '/home';
|
baseLocation = '/home';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cacheDirectory = path.join(baseLocation, 'actions', 'cache');
|
cacheDirectory = path.join(baseLocation, 'actions', 'cache');
|
||||||
}
|
}
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const tc = __importStar(require("@actions/tool-cache"));
|
const tc = __importStar(require("@actions/tool-cache"));
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
// Python has "scripts" or "bin" directories where command-line tools that come with packages are installed.
|
// Python has "scripts" or "bin" directories where command-line tools that come with packages are installed.
|
||||||
// This is where pip is, along with anything that pip installs.
|
// This is where pip is, along with anything that pip installs.
|
||||||
// There is a seperate directory for `pip install --user`.
|
// There is a seperate directory for `pip install --user`.
|
||||||
//
|
//
|
||||||
// For reference, these directories are as follows:
|
// For reference, these directories are as follows:
|
||||||
// macOS / Linux:
|
// macOS / Linux:
|
||||||
// <sys.prefix>/bin (by default /usr/local/bin, but not on hosted agents -- see the `else`)
|
// <sys.prefix>/bin (by default /usr/local/bin, but not on hosted agents -- see the `else`)
|
||||||
// (--user) ~/.local/bin
|
// (--user) ~/.local/bin
|
||||||
// Windows:
|
// Windows:
|
||||||
// <Python installation dir>\Scripts
|
// <Python installation dir>\Scripts
|
||||||
// (--user) %APPDATA%\Python\PythonXY\Scripts
|
// (--user) %APPDATA%\Python\PythonXY\Scripts
|
||||||
// See https://docs.python.org/3/library/sysconfig.html
|
// See https://docs.python.org/3/library/sysconfig.html
|
||||||
function binDir(installDir) {
|
function binDir(installDir) {
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
return path.join(installDir, 'Scripts');
|
return path.join(installDir, 'Scripts');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return path.join(installDir, 'bin');
|
return path.join(installDir, 'bin');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Note on the tool cache layout for PyPy:
|
// Note on the tool cache layout for PyPy:
|
||||||
// PyPy has its own versioning scheme that doesn't follow the Python versioning scheme.
|
// PyPy has its own versioning scheme that doesn't follow the Python versioning scheme.
|
||||||
// A particular version of PyPy may contain one or more versions of the Python interpreter.
|
// A particular version of PyPy may contain one or more versions of the Python interpreter.
|
||||||
// For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha.
|
// For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha.
|
||||||
// We only care about the Python version, so we don't use the PyPy version for the tool cache.
|
// We only care about the Python version, so we don't use the PyPy version for the tool cache.
|
||||||
function usePyPy(majorVersion, architecture) {
|
function usePyPy(majorVersion, architecture) {
|
||||||
const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion.toString());
|
const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion.toString());
|
||||||
let installDir = findPyPy(architecture);
|
let installDir = findPyPy(architecture);
|
||||||
if (!installDir && IS_WINDOWS) {
|
if (!installDir && IS_WINDOWS) {
|
||||||
// PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64.
|
// PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64.
|
||||||
// On Hosted VS2017, we only install an x86 version.
|
// On Hosted VS2017, we only install an x86 version.
|
||||||
// Fall back to x86.
|
// Fall back to x86.
|
||||||
installDir = findPyPy('x86');
|
installDir = findPyPy('x86');
|
||||||
}
|
}
|
||||||
if (!installDir) {
|
if (!installDir) {
|
||||||
// PyPy not installed in $(Agent.ToolsDirectory)
|
// PyPy not installed in $(Agent.ToolsDirectory)
|
||||||
throw new Error(`PyPy ${majorVersion} not found`);
|
throw new Error(`PyPy ${majorVersion} not found`);
|
||||||
}
|
}
|
||||||
// For PyPy, Windows uses 'bin', not 'Scripts'.
|
// For PyPy, Windows uses 'bin', not 'Scripts'.
|
||||||
const _binDir = path.join(installDir, 'bin');
|
const _binDir = path.join(installDir, 'bin');
|
||||||
// On Linux and macOS, the Python interpreter is in 'bin'.
|
// On Linux and macOS, the Python interpreter is in 'bin'.
|
||||||
// On Windows, it is in the installation root.
|
// On Windows, it is in the installation root.
|
||||||
const pythonLocation = IS_WINDOWS ? installDir : _binDir;
|
const pythonLocation = IS_WINDOWS ? installDir : _binDir;
|
||||||
core.exportVariable('pythonLocation', pythonLocation);
|
core.exportVariable('pythonLocation', pythonLocation);
|
||||||
core.addPath(installDir);
|
core.addPath(installDir);
|
||||||
core.addPath(_binDir);
|
core.addPath(_binDir);
|
||||||
}
|
}
|
||||||
function useCpythonVersion(version, architecture) {
|
function useCpythonVersion(version, architecture) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const desugaredVersionSpec = desugarDevVersion(version);
|
const desugaredVersionSpec = desugarDevVersion(version);
|
||||||
const semanticVersionSpec = pythonVersionToSemantic(desugaredVersionSpec);
|
const semanticVersionSpec = pythonVersionToSemantic(desugaredVersionSpec);
|
||||||
core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`);
|
core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`);
|
||||||
const installDir = tc.find('Python', semanticVersionSpec, architecture);
|
const installDir = tc.find('Python', semanticVersionSpec, architecture);
|
||||||
if (!installDir) {
|
if (!installDir) {
|
||||||
// Fail and list available versions
|
// Fail and list available versions
|
||||||
const x86Versions = tc
|
const x86Versions = tc
|
||||||
.findAllVersions('Python', 'x86')
|
.findAllVersions('Python', 'x86')
|
||||||
.map(s => `${s} (x86)`)
|
.map(s => `${s} (x86)`)
|
||||||
.join(os.EOL);
|
.join(os.EOL);
|
||||||
const x64Versions = tc
|
const x64Versions = tc
|
||||||
.findAllVersions('Python', 'x64')
|
.findAllVersions('Python', 'x64')
|
||||||
.map(s => `${s} (x64)`)
|
.map(s => `${s} (x64)`)
|
||||||
.join(os.EOL);
|
.join(os.EOL);
|
||||||
throw new Error([
|
throw new Error([
|
||||||
`Version ${version} with arch ${architecture} not found`,
|
`Version ${version} with arch ${architecture} not found`,
|
||||||
'Available versions:',
|
'Available versions:',
|
||||||
x86Versions,
|
x86Versions,
|
||||||
x64Versions
|
x64Versions
|
||||||
].join(os.EOL));
|
].join(os.EOL));
|
||||||
}
|
}
|
||||||
core.exportVariable('pythonLocation', installDir);
|
core.exportVariable('pythonLocation', installDir);
|
||||||
core.addPath(installDir);
|
core.addPath(installDir);
|
||||||
core.addPath(binDir(installDir));
|
core.addPath(binDir(installDir));
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
// Add --user directory
|
// Add --user directory
|
||||||
// `installDir` from tool cache should look like $AGENT_TOOLSDIRECTORY/Python/<semantic version>/x64/
|
// `installDir` from tool cache should look like $AGENT_TOOLSDIRECTORY/Python/<semantic version>/x64/
|
||||||
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
|
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
|
||||||
const version = path.basename(path.dirname(installDir));
|
const version = path.basename(path.dirname(installDir));
|
||||||
const major = semver.major(version);
|
const major = semver.major(version);
|
||||||
const minor = semver.minor(version);
|
const minor = semver.minor(version);
|
||||||
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
|
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
|
||||||
core.addPath(userScriptsDir);
|
core.addPath(userScriptsDir);
|
||||||
}
|
}
|
||||||
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
|
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/** Convert versions like `3.8-dev` to a version like `>= 3.8.0-a0`. */
|
/** Convert versions like `3.8-dev` to a version like `>= 3.8.0-a0`. */
|
||||||
function desugarDevVersion(versionSpec) {
|
function desugarDevVersion(versionSpec) {
|
||||||
if (versionSpec.endsWith('-dev')) {
|
if (versionSpec.endsWith('-dev')) {
|
||||||
const versionRoot = versionSpec.slice(0, -'-dev'.length);
|
const versionRoot = versionSpec.slice(0, -'-dev'.length);
|
||||||
return `>= ${versionRoot}.0-a0`;
|
return `>= ${versionRoot}.0-a0`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return versionSpec;
|
return versionSpec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Python's prelease versions look like `3.7.0b2`.
|
* Python's prelease versions look like `3.7.0b2`.
|
||||||
* This is the one part of Python versioning that does not look like semantic versioning, which specifies `3.7.0-b2`.
|
* This is the one part of Python versioning that does not look like semantic versioning, which specifies `3.7.0-b2`.
|
||||||
* If the version spec contains prerelease versions, we need to convert them to the semantic version equivalent.
|
* If the version spec contains prerelease versions, we need to convert them to the semantic version equivalent.
|
||||||
*/
|
*/
|
||||||
function pythonVersionToSemantic(versionSpec) {
|
function pythonVersionToSemantic(versionSpec) {
|
||||||
const prereleaseVersion = /(\d+\.\d+\.\d+)((?:a|b|rc)\d*)/g;
|
const prereleaseVersion = /(\d+\.\d+\.\d+)((?:a|b|rc)\d*)/g;
|
||||||
return versionSpec.replace(prereleaseVersion, '$1-$2');
|
return versionSpec.replace(prereleaseVersion, '$1-$2');
|
||||||
}
|
}
|
||||||
exports.pythonVersionToSemantic = pythonVersionToSemantic;
|
exports.pythonVersionToSemantic = pythonVersionToSemantic;
|
||||||
function findPythonVersion(version, architecture) {
|
function findPythonVersion(version, architecture) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
switch (version.toUpperCase()) {
|
switch (version.toUpperCase()) {
|
||||||
case 'PYPY2':
|
case 'PYPY2':
|
||||||
return usePyPy(2, architecture);
|
return usePyPy(2, architecture);
|
||||||
case 'PYPY3':
|
case 'PYPY3':
|
||||||
return usePyPy(3, architecture);
|
return usePyPy(3, architecture);
|
||||||
default:
|
default:
|
||||||
return yield useCpythonVersion(version, architecture);
|
return yield useCpythonVersion(version, architecture);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.findPythonVersion = findPythonVersion;
|
exports.findPythonVersion = findPythonVersion;
|
||||||
|
|||||||
+40
-37
@@ -1,37 +1,40 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
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 rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const finder = __importStar(require("./find-python"));
|
const finder = __importStar(require("./find-python"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const version = core.getInput('version');
|
let version = core.getInput('version');
|
||||||
if (version) {
|
if (!version) {
|
||||||
const arch = core.getInput('architecture', { required: true });
|
version = core.getInput('python-version');
|
||||||
yield finder.findPythonVersion(version, arch);
|
}
|
||||||
}
|
if (version) {
|
||||||
const matchersPath = path.join(__dirname, '..', '.github');
|
const arch = core.getInput('architecture', { required: true });
|
||||||
console.log(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
yield finder.findPythonVersion(version, arch);
|
||||||
}
|
}
|
||||||
catch (err) {
|
const matchersPath = path.join(__dirname, '..', '.github');
|
||||||
core.setFailed(err.message);
|
console.log(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
||||||
}
|
}
|
||||||
});
|
catch (err) {
|
||||||
}
|
core.setFailed(err.message);
|
||||||
run();
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
run();
|
||||||
|
|||||||
+6
-6
@@ -1,7 +1,7 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver.js" %*
|
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver.js" %*
|
||||||
) ELSE (
|
) ELSE (
|
||||||
@SETLOCAL
|
@SETLOCAL
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
node "%~dp0\..\semver\bin\semver.js" %*
|
node "%~dp0\..\semver\bin\semver.js" %*
|
||||||
)
|
)
|
||||||
+6
-6
@@ -1,7 +1,7 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
"%~dp0\node.exe" "%~dp0\..\uuid\bin\uuid" %*
|
"%~dp0\node.exe" "%~dp0\..\uuid\bin\uuid" %*
|
||||||
) ELSE (
|
) ELSE (
|
||||||
@SETLOCAL
|
@SETLOCAL
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
node "%~dp0\..\uuid\bin\uuid" %*
|
node "%~dp0\..\uuid\bin\uuid" %*
|
||||||
)
|
)
|
||||||
+81
-7
@@ -1,7 +1,81 @@
|
|||||||
# `@actions/core`
|
# `@actions/core`
|
||||||
|
|
||||||
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
See [src/core.ts](src/core.ts).
|
#### Inputs/Outputs
|
||||||
|
|
||||||
|
You can use this library to get inputs or set outputs:
|
||||||
|
|
||||||
|
```
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
const myInput = core.getInput('inputName', { required: true });
|
||||||
|
|
||||||
|
// Do stuff
|
||||||
|
|
||||||
|
core.setOutput('outputKey', 'outputVal');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Exporting variables/secrets
|
||||||
|
|
||||||
|
You can also export variables and secrets for future steps. Variables get set in the environment automatically, while secrets must be scoped into the environment from a workflow using `{{ secret.FOO }}`. Secrets will also be masked from the logs:
|
||||||
|
|
||||||
|
```
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
// Do stuff
|
||||||
|
|
||||||
|
core.exportVariable('envVar', 'Val');
|
||||||
|
core.exportSecret('secretVar', variableWithSecretValue);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### PATH Manipulation
|
||||||
|
|
||||||
|
You can explicitly add items to the path for all remaining steps in a workflow:
|
||||||
|
|
||||||
|
```
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
core.addPath('pathToTool');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Exit codes
|
||||||
|
|
||||||
|
You should use this library to set the failing exit code for your action:
|
||||||
|
|
||||||
|
```
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Do stuff
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// setFailed logs the message and sets a failing exit code
|
||||||
|
core.setFailed(`Action failed with error ${err}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Logging
|
||||||
|
|
||||||
|
Finally, this library provides some utilities for logging:
|
||||||
|
|
||||||
|
```
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
const myInput = core.getInput('input');
|
||||||
|
try {
|
||||||
|
core.debug('Inside try block');
|
||||||
|
|
||||||
|
if (!myInput) {
|
||||||
|
core.warning('myInput wasnt set');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do stuff
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.error('Error ${err}, action may still succeed though');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
+16
-16
@@ -1,16 +1,16 @@
|
|||||||
interface CommandProperties {
|
interface CommandProperties {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
* Command Format:
|
* Command Format:
|
||||||
* ##[name key=value;key=value]message
|
* ##[name key=value;key=value]message
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* ##[warning]This is the user warning message
|
* ##[warning]This is the user warning message
|
||||||
* ##[set-secret name=mypassword]definatelyNotAPassword!
|
* ##[set-secret name=mypassword]definatelyNotAPassword!
|
||||||
*/
|
*/
|
||||||
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
|
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
|
||||||
export declare function issue(name: string, message: string): void;
|
export declare function issue(name: string, message: string): void;
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
+65
-65
@@ -1,66 +1,66 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = require("os");
|
const os = require("os");
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
* Command Format:
|
* Command Format:
|
||||||
* ##[name key=value;key=value]message
|
* ##[name key=value;key=value]message
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* ##[warning]This is the user warning message
|
* ##[warning]This is the user warning message
|
||||||
* ##[set-secret name=mypassword]definatelyNotAPassword!
|
* ##[set-secret name=mypassword]definatelyNotAPassword!
|
||||||
*/
|
*/
|
||||||
function issueCommand(command, properties, message) {
|
function issueCommand(command, properties, message) {
|
||||||
const cmd = new Command(command, properties, message);
|
const cmd = new Command(command, properties, message);
|
||||||
process.stdout.write(cmd.toString() + os.EOL);
|
process.stdout.write(cmd.toString() + os.EOL);
|
||||||
}
|
}
|
||||||
exports.issueCommand = issueCommand;
|
exports.issueCommand = issueCommand;
|
||||||
function issue(name, message) {
|
function issue(name, message) {
|
||||||
issueCommand(name, {}, message);
|
issueCommand(name, {}, message);
|
||||||
}
|
}
|
||||||
exports.issue = issue;
|
exports.issue = issue;
|
||||||
const CMD_PREFIX = '##[';
|
const CMD_PREFIX = '##[';
|
||||||
class Command {
|
class Command {
|
||||||
constructor(command, properties, message) {
|
constructor(command, properties, message) {
|
||||||
if (!command) {
|
if (!command) {
|
||||||
command = 'missing.command';
|
command = 'missing.command';
|
||||||
}
|
}
|
||||||
this.command = command;
|
this.command = command;
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
toString() {
|
toString() {
|
||||||
let cmdStr = CMD_PREFIX + this.command;
|
let cmdStr = CMD_PREFIX + this.command;
|
||||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||||
cmdStr += ' ';
|
cmdStr += ' ';
|
||||||
for (const key in this.properties) {
|
for (const key in this.properties) {
|
||||||
if (this.properties.hasOwnProperty(key)) {
|
if (this.properties.hasOwnProperty(key)) {
|
||||||
const val = this.properties[key];
|
const val = this.properties[key];
|
||||||
if (val) {
|
if (val) {
|
||||||
// safely append the val - avoid blowing up when attempting to
|
// safely append the val - avoid blowing up when attempting to
|
||||||
// call .replace() if message is not a string for some reason
|
// call .replace() if message is not a string for some reason
|
||||||
cmdStr += `${key}=${escape(`${val || ''}`)};`;
|
cmdStr += `${key}=${escape(`${val || ''}`)};`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmdStr += ']';
|
cmdStr += ']';
|
||||||
// safely append the message - avoid blowing up when attempting to
|
// safely append the message - avoid blowing up when attempting to
|
||||||
// call .replace() if message is not a string for some reason
|
// call .replace() if message is not a string for some reason
|
||||||
const message = `${this.message || ''}`;
|
const message = `${this.message || ''}`;
|
||||||
cmdStr += escapeData(message);
|
cmdStr += escapeData(message);
|
||||||
return cmdStr;
|
return cmdStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function escapeData(s) {
|
function escapeData(s) {
|
||||||
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
||||||
}
|
}
|
||||||
function escape(s) {
|
function escape(s) {
|
||||||
return s
|
return s
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A')
|
.replace(/\n/g, '%0A')
|
||||||
.replace(/]/g, '%5D')
|
.replace(/]/g, '%5D')
|
||||||
.replace(/;/g, '%3B');
|
.replace(/;/g, '%3B');
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=command.js.map
|
//# sourceMappingURL=command.js.map
|
||||||
+73
-57
@@ -1,57 +1,73 @@
|
|||||||
/**
|
/**
|
||||||
* Interface for getInput options
|
* Interface for getInput options
|
||||||
*/
|
*/
|
||||||
export interface InputOptions {
|
export interface InputOptions {
|
||||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* sets env variable for this action and future actions in the job
|
* The code to exit an action
|
||||||
* @param name the name of the variable to set
|
*/
|
||||||
* @param val the value of the variable
|
export declare enum ExitCode {
|
||||||
*/
|
/**
|
||||||
export declare function exportVariable(name: string, val: string): void;
|
* A code indicating that the action was successful
|
||||||
/**
|
*/
|
||||||
* exports the variable and registers a secret which will get masked from logs
|
Success = 0,
|
||||||
* @param name the name of the variable to set
|
/**
|
||||||
* @param val value of the secret
|
* A code indicating that the action was a failure
|
||||||
*/
|
*/
|
||||||
export declare function exportSecret(name: string, val: string): void;
|
Failure = 1
|
||||||
/**
|
}
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
/**
|
||||||
* @param inputPath
|
* sets env variable for this action and future actions in the job
|
||||||
*/
|
* @param name the name of the variable to set
|
||||||
export declare function addPath(inputPath: string): void;
|
* @param val the value of the variable
|
||||||
/**
|
*/
|
||||||
* Gets the value of an input. The value is also trimmed.
|
export declare function exportVariable(name: string, val: string): void;
|
||||||
*
|
/**
|
||||||
* @param name name of the input to get
|
* exports the variable and registers a secret which will get masked from logs
|
||||||
* @param options optional. See InputOptions.
|
* @param name the name of the variable to set
|
||||||
* @returns string
|
* @param val value of the secret
|
||||||
*/
|
*/
|
||||||
export declare function getInput(name: string, options?: InputOptions): string;
|
export declare function exportSecret(name: string, val: string): void;
|
||||||
/**
|
/**
|
||||||
* Sets the action status to neutral
|
* Prepends inputPath to the PATH (for this action and future actions)
|
||||||
*/
|
* @param inputPath
|
||||||
export declare function setNeutral(): void;
|
*/
|
||||||
/**
|
export declare function addPath(inputPath: string): void;
|
||||||
* Sets the action status to failed.
|
/**
|
||||||
* When the action exits it will be with an exit code of 1
|
* Gets the value of an input. The value is also trimmed.
|
||||||
* @param message add error issue message
|
*
|
||||||
*/
|
* @param name name of the input to get
|
||||||
export declare function setFailed(message: string): void;
|
* @param options optional. See InputOptions.
|
||||||
/**
|
* @returns string
|
||||||
* Writes debug message to user log
|
*/
|
||||||
* @param message debug message
|
export declare function getInput(name: string, options?: InputOptions): string;
|
||||||
*/
|
/**
|
||||||
export declare function debug(message: string): void;
|
* Sets the value of an output.
|
||||||
/**
|
*
|
||||||
* Adds an error issue
|
* @param name name of the output to set
|
||||||
* @param message error issue message
|
* @param value value to store
|
||||||
*/
|
*/
|
||||||
export declare function error(message: string): void;
|
export declare function setOutput(name: string, value: string): void;
|
||||||
/**
|
/**
|
||||||
* Adds an warning issue
|
* Sets the action status to failed.
|
||||||
* @param message warning issue message
|
* When the action exits it will be with an exit code of 1
|
||||||
*/
|
* @param message add error issue message
|
||||||
export declare function warning(message: string): void;
|
*/
|
||||||
|
export declare function setFailed(message: string): void;
|
||||||
|
/**
|
||||||
|
* Writes debug message to user log
|
||||||
|
* @param message debug message
|
||||||
|
*/
|
||||||
|
export declare function debug(message: string): void;
|
||||||
|
/**
|
||||||
|
* Adds an error issue
|
||||||
|
* @param message error issue message
|
||||||
|
*/
|
||||||
|
export declare function error(message: string): void;
|
||||||
|
/**
|
||||||
|
* Adds an warning issue
|
||||||
|
* @param message warning issue message
|
||||||
|
*/
|
||||||
|
export declare function warning(message: string): void;
|
||||||
|
|||||||
+115
-99
@@ -1,100 +1,116 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const exit_1 = require("@actions/exit");
|
const command_1 = require("./command");
|
||||||
const command_1 = require("./command");
|
const path = require("path");
|
||||||
const path = require("path");
|
/**
|
||||||
//-----------------------------------------------------------------------
|
* The code to exit an action
|
||||||
// Variables
|
*/
|
||||||
//-----------------------------------------------------------------------
|
var ExitCode;
|
||||||
/**
|
(function (ExitCode) {
|
||||||
* sets env variable for this action and future actions in the job
|
/**
|
||||||
* @param name the name of the variable to set
|
* A code indicating that the action was successful
|
||||||
* @param val the value of the variable
|
*/
|
||||||
*/
|
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||||||
function exportVariable(name, val) {
|
/**
|
||||||
process.env[name] = val;
|
* A code indicating that the action was a failure
|
||||||
command_1.issueCommand('set-env', { name }, val);
|
*/
|
||||||
}
|
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||||
exports.exportVariable = exportVariable;
|
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||||
/**
|
//-----------------------------------------------------------------------
|
||||||
* exports the variable and registers a secret which will get masked from logs
|
// Variables
|
||||||
* @param name the name of the variable to set
|
//-----------------------------------------------------------------------
|
||||||
* @param val value of the secret
|
/**
|
||||||
*/
|
* sets env variable for this action and future actions in the job
|
||||||
function exportSecret(name, val) {
|
* @param name the name of the variable to set
|
||||||
exportVariable(name, val);
|
* @param val the value of the variable
|
||||||
command_1.issueCommand('set-secret', {}, val);
|
*/
|
||||||
}
|
function exportVariable(name, val) {
|
||||||
exports.exportSecret = exportSecret;
|
process.env[name] = val;
|
||||||
/**
|
command_1.issueCommand('set-env', { name }, val);
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
}
|
||||||
* @param inputPath
|
exports.exportVariable = exportVariable;
|
||||||
*/
|
/**
|
||||||
function addPath(inputPath) {
|
* exports the variable and registers a secret which will get masked from logs
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
* @param name the name of the variable to set
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
* @param val value of the secret
|
||||||
}
|
*/
|
||||||
exports.addPath = addPath;
|
function exportSecret(name, val) {
|
||||||
/**
|
exportVariable(name, val);
|
||||||
* Gets the value of an input. The value is also trimmed.
|
command_1.issueCommand('set-secret', {}, val);
|
||||||
*
|
}
|
||||||
* @param name name of the input to get
|
exports.exportSecret = exportSecret;
|
||||||
* @param options optional. See InputOptions.
|
/**
|
||||||
* @returns string
|
* Prepends inputPath to the PATH (for this action and future actions)
|
||||||
*/
|
* @param inputPath
|
||||||
function getInput(name, options) {
|
*/
|
||||||
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || '';
|
function addPath(inputPath) {
|
||||||
if (options && options.required && !val) {
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
throw new Error(`Input required and not supplied: ${name}`);
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||||
}
|
}
|
||||||
return val.trim();
|
exports.addPath = addPath;
|
||||||
}
|
/**
|
||||||
exports.getInput = getInput;
|
* Gets the value of an input. The value is also trimmed.
|
||||||
//-----------------------------------------------------------------------
|
*
|
||||||
// Results
|
* @param name name of the input to get
|
||||||
//-----------------------------------------------------------------------
|
* @param options optional. See InputOptions.
|
||||||
/**
|
* @returns string
|
||||||
* Sets the action status to neutral
|
*/
|
||||||
*/
|
function getInput(name, options) {
|
||||||
function setNeutral() {
|
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || '';
|
||||||
process.exitCode = exit_1.ExitCode.Neutral;
|
if (options && options.required && !val) {
|
||||||
}
|
throw new Error(`Input required and not supplied: ${name}`);
|
||||||
exports.setNeutral = setNeutral;
|
}
|
||||||
/**
|
return val.trim();
|
||||||
* Sets the action status to failed.
|
}
|
||||||
* When the action exits it will be with an exit code of 1
|
exports.getInput = getInput;
|
||||||
* @param message add error issue message
|
/**
|
||||||
*/
|
* Sets the value of an output.
|
||||||
function setFailed(message) {
|
*
|
||||||
process.exitCode = exit_1.ExitCode.Failure;
|
* @param name name of the output to set
|
||||||
error(message);
|
* @param value value to store
|
||||||
}
|
*/
|
||||||
exports.setFailed = setFailed;
|
function setOutput(name, value) {
|
||||||
//-----------------------------------------------------------------------
|
command_1.issueCommand('set-output', { name }, value);
|
||||||
// Logging Commands
|
}
|
||||||
//-----------------------------------------------------------------------
|
exports.setOutput = setOutput;
|
||||||
/**
|
//-----------------------------------------------------------------------
|
||||||
* Writes debug message to user log
|
// Results
|
||||||
* @param message debug message
|
//-----------------------------------------------------------------------
|
||||||
*/
|
/**
|
||||||
function debug(message) {
|
* Sets the action status to failed.
|
||||||
command_1.issueCommand('debug', {}, message);
|
* When the action exits it will be with an exit code of 1
|
||||||
}
|
* @param message add error issue message
|
||||||
exports.debug = debug;
|
*/
|
||||||
/**
|
function setFailed(message) {
|
||||||
* Adds an error issue
|
process.exitCode = ExitCode.Failure;
|
||||||
* @param message error issue message
|
error(message);
|
||||||
*/
|
}
|
||||||
function error(message) {
|
exports.setFailed = setFailed;
|
||||||
command_1.issue('error', message);
|
//-----------------------------------------------------------------------
|
||||||
}
|
// Logging Commands
|
||||||
exports.error = error;
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Adds an warning issue
|
* Writes debug message to user log
|
||||||
* @param message warning issue message
|
* @param message debug message
|
||||||
*/
|
*/
|
||||||
function warning(message) {
|
function debug(message) {
|
||||||
command_1.issue('warning', message);
|
command_1.issueCommand('debug', {}, message);
|
||||||
}
|
}
|
||||||
exports.warning = warning;
|
exports.debug = debug;
|
||||||
|
/**
|
||||||
|
* Adds an error issue
|
||||||
|
* @param message error issue message
|
||||||
|
*/
|
||||||
|
function error(message) {
|
||||||
|
command_1.issue('error', message);
|
||||||
|
}
|
||||||
|
exports.error = error;
|
||||||
|
/**
|
||||||
|
* Adds an warning issue
|
||||||
|
* @param message warning issue message
|
||||||
|
*/
|
||||||
|
function warning(message) {
|
||||||
|
command_1.issue('warning', message);
|
||||||
|
}
|
||||||
|
exports.warning = warning;
|
||||||
//# sourceMappingURL=core.js.map
|
//# sourceMappingURL=core.js.map
|
||||||
+1
-1
File diff suppressed because one or more lines are too long
+15
-17
@@ -1,36 +1,33 @@
|
|||||||
{
|
{
|
||||||
"_from": "file:toolkit\\actions-core-0.0.0.tgz",
|
"_from": "@actions/core@^1.0.0",
|
||||||
"_id": "@actions/core@0.0.0",
|
"_id": "@actions/core@1.0.0",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-58ituSV1rzBMmmsWoFDnrnsT+Wm4kD/u9NgAGbPvZ7rQHWluYtD5bDbIsjDC6rKFuhqytkxDJPsF/TWBdgc/nA==",
|
"_integrity": "sha512-aMIlkx96XH4E/2YZtEOeyrYQfhlas9jIRkfGPqMwXD095Rdkzo4lB6ZmbxPQSzD+e1M+Xsm98ZhuSMYGv/AlqA==",
|
||||||
"_location": "/@actions/core",
|
"_location": "/@actions/core",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "file",
|
"type": "range",
|
||||||
"where": "E:\\github\\setup-python",
|
"registry": true,
|
||||||
"raw": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
|
"raw": "@actions/core@^1.0.0",
|
||||||
"name": "@actions/core",
|
"name": "@actions/core",
|
||||||
"escapedName": "@actions%2fcore",
|
"escapedName": "@actions%2fcore",
|
||||||
"scope": "@actions",
|
"scope": "@actions",
|
||||||
"rawSpec": "file:toolkit/actions-core-0.0.0.tgz",
|
"rawSpec": "^1.0.0",
|
||||||
"saveSpec": "file:toolkit\\actions-core-0.0.0.tgz",
|
"saveSpec": null,
|
||||||
"fetchSpec": "E:\\github\\setup-python\\toolkit\\actions-core-0.0.0.tgz"
|
"fetchSpec": "^1.0.0"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/",
|
"/",
|
||||||
"/@actions/tool-cache"
|
"/@actions/tool-cache"
|
||||||
],
|
],
|
||||||
"_resolved": "E:\\github\\setup-python\\toolkit\\actions-core-0.0.0.tgz",
|
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.0.0.tgz",
|
||||||
"_shasum": "346d90a534fa6c5021bc2e1b732574fd2c66fc35",
|
"_shasum": "4a090a2e958cc300b9ea802331034d5faf42d239",
|
||||||
"_spec": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
|
"_spec": "@actions/core@^1.0.0",
|
||||||
"_where": "E:\\github\\setup-python",
|
"_where": "C:\\Users\\damccorm\\Documents\\setup-python",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
"bundleDependencies": false,
|
"bundleDependencies": false,
|
||||||
"dependencies": {
|
|
||||||
"@actions/exit": "^0.0.0"
|
|
||||||
},
|
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"description": "Actions core lib",
|
"description": "Actions core lib",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -43,6 +40,7 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
|
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"core",
|
"core",
|
||||||
@@ -62,5 +60,5 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"version": "0.0.0"
|
"version": "1.0.0"
|
||||||
}
|
}
|
||||||
|
|||||||
+60
-7
@@ -1,7 +1,60 @@
|
|||||||
# `@actions/exec`
|
# `@actions/exec`
|
||||||
|
|
||||||
> Functions necessary for running tools on the command line
|
## Usage
|
||||||
|
|
||||||
## Usage
|
#### Basic
|
||||||
|
|
||||||
See [src/exec.ts](src/exec.ts).
|
You can use this package to execute your tools on the command line in a cross platform way:
|
||||||
|
|
||||||
|
```
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
|
||||||
|
await exec.exec('node index.js');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Args
|
||||||
|
|
||||||
|
You can also pass in arg arrays:
|
||||||
|
|
||||||
|
```
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
|
||||||
|
await exec.exec('node', ['index.js', 'foo=bar']);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Output/options
|
||||||
|
|
||||||
|
Capture output or specify [other options](https://github.com/actions/toolkit/blob/d9347d4ab99fd507c0b9104b2cf79fb44fcc827d/packages/exec/src/interfaces.ts#L5):
|
||||||
|
|
||||||
|
```
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
|
||||||
|
const myOutput = '';
|
||||||
|
const myError = '';
|
||||||
|
|
||||||
|
const options = {};
|
||||||
|
options.listeners = {
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
myOutput += data.toString();
|
||||||
|
},
|
||||||
|
stderr: (data: Buffer) => {
|
||||||
|
myError += data.toString();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
options.cwd = './lib';
|
||||||
|
|
||||||
|
await exec.exec('node', ['index.js', 'foo=bar'], options);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Exec tools not in the PATH
|
||||||
|
|
||||||
|
You can use it in conjunction with the `which` function from `@actions/io` to execute tools that are not in the PATH:
|
||||||
|
|
||||||
|
```
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
const io = require('@actions/io');
|
||||||
|
|
||||||
|
const pythonPath: string = await io.which('python', true)
|
||||||
|
|
||||||
|
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
||||||
|
```
|
||||||
|
|||||||
+12
-12
@@ -1,12 +1,12 @@
|
|||||||
import * as im from './interfaces';
|
import * as im from './interfaces';
|
||||||
/**
|
/**
|
||||||
* Exec a command.
|
* Exec a command.
|
||||||
* Output will be streamed to the live console.
|
* Output will be streamed to the live console.
|
||||||
* Returns promise with return code
|
* Returns promise with return code
|
||||||
*
|
*
|
||||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||||
* @param options optional exec options. See ExecOptions
|
* @param options optional exec options. See ExecOptions
|
||||||
* @returns Promise<number> exit code
|
* @returns Promise<number> exit code
|
||||||
*/
|
*/
|
||||||
export declare function exec(commandLine: string, args?: string[], options?: im.ExecOptions): Promise<number>;
|
export declare function exec(commandLine: string, args?: string[], options?: im.ExecOptions): Promise<number>;
|
||||||
|
|||||||
+35
-35
@@ -1,36 +1,36 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
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 rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const tr = require("./toolrunner");
|
const tr = require("./toolrunner");
|
||||||
/**
|
/**
|
||||||
* Exec a command.
|
* Exec a command.
|
||||||
* Output will be streamed to the live console.
|
* Output will be streamed to the live console.
|
||||||
* Returns promise with return code
|
* Returns promise with return code
|
||||||
*
|
*
|
||||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||||
* @param options optional exec options. See ExecOptions
|
* @param options optional exec options. See ExecOptions
|
||||||
* @returns Promise<number> exit code
|
* @returns Promise<number> exit code
|
||||||
*/
|
*/
|
||||||
function exec(commandLine, args, options) {
|
function exec(commandLine, args, options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const commandArgs = tr.argStringToArray(commandLine);
|
const commandArgs = tr.argStringToArray(commandLine);
|
||||||
if (commandArgs.length === 0) {
|
if (commandArgs.length === 0) {
|
||||||
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
||||||
}
|
}
|
||||||
// Path to tool to execute should be first arg
|
// Path to tool to execute should be first arg
|
||||||
const toolPath = commandArgs[0];
|
const toolPath = commandArgs[0];
|
||||||
args = commandArgs.slice(1).concat(args || []);
|
args = commandArgs.slice(1).concat(args || []);
|
||||||
const runner = new tr.ToolRunner(toolPath, args, options);
|
const runner = new tr.ToolRunner(toolPath, args, options);
|
||||||
return runner.exec();
|
return runner.exec();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.exec = exec;
|
exports.exec = exec;
|
||||||
//# sourceMappingURL=exec.js.map
|
//# sourceMappingURL=exec.js.map
|
||||||
+35
-35
@@ -1,35 +1,35 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import * as stream from 'stream';
|
import * as stream from 'stream';
|
||||||
/**
|
/**
|
||||||
* Interface for exec options
|
* Interface for exec options
|
||||||
*/
|
*/
|
||||||
export interface ExecOptions {
|
export interface ExecOptions {
|
||||||
/** optional working directory. defaults to current */
|
/** optional working directory. defaults to current */
|
||||||
cwd?: string;
|
cwd?: string;
|
||||||
/** optional envvar dictionary. defaults to current process's env */
|
/** optional envvar dictionary. defaults to current process's env */
|
||||||
env?: {
|
env?: {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
};
|
};
|
||||||
/** optional. defaults to false */
|
/** optional. defaults to false */
|
||||||
silent?: boolean;
|
silent?: boolean;
|
||||||
/** optional out stream to use. Defaults to process.stdout */
|
/** optional out stream to use. Defaults to process.stdout */
|
||||||
outStream?: stream.Writable;
|
outStream?: stream.Writable;
|
||||||
/** optional err stream to use. Defaults to process.stderr */
|
/** optional err stream to use. Defaults to process.stderr */
|
||||||
errStream?: stream.Writable;
|
errStream?: stream.Writable;
|
||||||
/** optional. whether to skip quoting/escaping arguments if needed. defaults to false. */
|
/** optional. whether to skip quoting/escaping arguments if needed. defaults to false. */
|
||||||
windowsVerbatimArguments?: boolean;
|
windowsVerbatimArguments?: boolean;
|
||||||
/** optional. whether to fail if output to stderr. defaults to false */
|
/** optional. whether to fail if output to stderr. defaults to false */
|
||||||
failOnStdErr?: boolean;
|
failOnStdErr?: boolean;
|
||||||
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
||||||
ignoreReturnCode?: boolean;
|
ignoreReturnCode?: boolean;
|
||||||
/** optional. How long in ms to wait for STDIO streams to close after the exit event of the process before terminating. defaults to 10000 */
|
/** optional. How long in ms to wait for STDIO streams to close after the exit event of the process before terminating. defaults to 10000 */
|
||||||
delay?: number;
|
delay?: number;
|
||||||
/** optional. Listeners for output. Callback functions that will be called on these events */
|
/** optional. Listeners for output. Callback functions that will be called on these events */
|
||||||
listeners?: {
|
listeners?: {
|
||||||
stdout?: (data: Buffer) => void;
|
stdout?: (data: Buffer) => void;
|
||||||
stderr?: (data: Buffer) => void;
|
stderr?: (data: Buffer) => void;
|
||||||
stdline?: (data: string) => void;
|
stdline?: (data: string) => void;
|
||||||
errline?: (data: string) => void;
|
errline?: (data: string) => void;
|
||||||
debug?: (data: string) => void;
|
debug?: (data: string) => void;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
//# sourceMappingURL=interfaces.js.map
|
//# sourceMappingURL=interfaces.js.map
|
||||||
+37
-37
@@ -1,37 +1,37 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
import * as events from 'events';
|
import * as events from 'events';
|
||||||
import * as im from './interfaces';
|
import * as im from './interfaces';
|
||||||
export declare class ToolRunner extends events.EventEmitter {
|
export declare class ToolRunner extends events.EventEmitter {
|
||||||
constructor(toolPath: string, args?: string[], options?: im.ExecOptions);
|
constructor(toolPath: string, args?: string[], options?: im.ExecOptions);
|
||||||
private toolPath;
|
private toolPath;
|
||||||
private args;
|
private args;
|
||||||
private options;
|
private options;
|
||||||
private _debug;
|
private _debug;
|
||||||
private _getCommandString;
|
private _getCommandString;
|
||||||
private _processLineBuffer;
|
private _processLineBuffer;
|
||||||
private _getSpawnFileName;
|
private _getSpawnFileName;
|
||||||
private _getSpawnArgs;
|
private _getSpawnArgs;
|
||||||
private _endsWith;
|
private _endsWith;
|
||||||
private _isCmdFile;
|
private _isCmdFile;
|
||||||
private _windowsQuoteCmdArg;
|
private _windowsQuoteCmdArg;
|
||||||
private _uvQuoteCmdArg;
|
private _uvQuoteCmdArg;
|
||||||
private _cloneExecOptions;
|
private _cloneExecOptions;
|
||||||
private _getSpawnOptions;
|
private _getSpawnOptions;
|
||||||
/**
|
/**
|
||||||
* Exec a tool.
|
* Exec a tool.
|
||||||
* Output will be streamed to the live console.
|
* Output will be streamed to the live console.
|
||||||
* Returns promise with return code
|
* Returns promise with return code
|
||||||
*
|
*
|
||||||
* @param tool path to tool to exec
|
* @param tool path to tool to exec
|
||||||
* @param options optional exec options. See ExecOptions
|
* @param options optional exec options. See ExecOptions
|
||||||
* @returns number
|
* @returns number
|
||||||
*/
|
*/
|
||||||
exec(): Promise<number>;
|
exec(): Promise<number>;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Convert an arg string to an array of args. Handles escaping
|
* Convert an arg string to an array of args. Handles escaping
|
||||||
*
|
*
|
||||||
* @param argString string of arguments
|
* @param argString string of arguments
|
||||||
* @returns string[] array of arguments
|
* @returns string[] array of arguments
|
||||||
*/
|
*/
|
||||||
export declare function argStringToArray(argString: string): string[];
|
export declare function argStringToArray(argString: string): string[];
|
||||||
|
|||||||
+572
-572
File diff suppressed because it is too large
Load Diff
+16
-16
@@ -1,29 +1,28 @@
|
|||||||
{
|
{
|
||||||
"_from": "file:toolkit\\actions-exec-0.0.0.tgz",
|
"_from": "@actions/exec@^1.0.0",
|
||||||
"_id": "@actions/exec@0.0.0",
|
"_id": "@actions/exec@1.0.0",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-HHObusC4p1RElxIlrrN0sY/cweBYl+jKm3J/XWHPQZMipgJXB/dkVhUfl4KqH3Vim7oM2KjCGSfn+vTYrqVH3A==",
|
"_integrity": "sha512-nquH0+XKng+Ll7rZfCojN7NWSbnGh+ltwUJhzfbLkmOJgxocGX2/yXcZLMyT9fa7+tByEow/NSTrBExNlEj9fw==",
|
||||||
"_location": "/@actions/exec",
|
"_location": "/@actions/exec",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "file",
|
"type": "range",
|
||||||
"where": "E:\\github\\setup-python",
|
"registry": true,
|
||||||
"raw": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
"raw": "@actions/exec@^1.0.0",
|
||||||
"name": "@actions/exec",
|
"name": "@actions/exec",
|
||||||
"escapedName": "@actions%2fexec",
|
"escapedName": "@actions%2fexec",
|
||||||
"scope": "@actions",
|
"scope": "@actions",
|
||||||
"rawSpec": "file:toolkit/actions-exec-0.0.0.tgz",
|
"rawSpec": "^1.0.0",
|
||||||
"saveSpec": "file:toolkit\\actions-exec-0.0.0.tgz",
|
"saveSpec": null,
|
||||||
"fetchSpec": "E:\\github\\setup-python\\toolkit\\actions-exec-0.0.0.tgz"
|
"fetchSpec": "^1.0.0"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/",
|
|
||||||
"/@actions/tool-cache"
|
"/@actions/tool-cache"
|
||||||
],
|
],
|
||||||
"_resolved": "E:\\github\\setup-python\\toolkit\\actions-exec-0.0.0.tgz",
|
"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.0.tgz",
|
||||||
"_shasum": "341d868fe6c4123ded20db9c2106b7b8c16e1d73",
|
"_shasum": "70c8b698c9baa02965c07da5f0b185ca56f0a955",
|
||||||
"_spec": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
"_spec": "@actions/exec@^1.0.0",
|
||||||
"_where": "E:\\github\\setup-python",
|
"_where": "C:\\Users\\damccorm\\Documents\\setup-python\\node_modules\\@actions\\tool-cache",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
@@ -31,7 +30,7 @@
|
|||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"description": "Actions exec lib",
|
"description": "Actions exec lib",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@actions/io": "^0.0.0"
|
"@actions/io": "^1.0.0"
|
||||||
},
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"lib": "lib",
|
"lib": "lib",
|
||||||
@@ -40,6 +39,7 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
|
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"exec",
|
"exec",
|
||||||
@@ -59,5 +59,5 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"version": "0.0.0"
|
"version": "1.0.0"
|
||||||
}
|
}
|
||||||
|
|||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
# `@actions/exit`
|
|
||||||
|
|
||||||
> TODO: description
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
See [src/exit.ts](src/exit.ts).
|
|
||||||
-29
@@ -1,29 +0,0 @@
|
|||||||
/**
|
|
||||||
* The code to exit an action
|
|
||||||
*/
|
|
||||||
export declare enum ExitCode {
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was successful
|
|
||||||
*/
|
|
||||||
Success = 0,
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was a failure
|
|
||||||
*/
|
|
||||||
Failure = 1,
|
|
||||||
/**
|
|
||||||
* A code indicating that the action is complete, but neither succeeded nor failed
|
|
||||||
*/
|
|
||||||
Neutral = 78
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Exit the action as a success.
|
|
||||||
*/
|
|
||||||
export declare function success(): void;
|
|
||||||
/**
|
|
||||||
* Exit the action as a failure.
|
|
||||||
*/
|
|
||||||
export declare function failure(): void;
|
|
||||||
/**
|
|
||||||
* Exit the action neither a success or a failure
|
|
||||||
*/
|
|
||||||
export declare function neutral(): void;
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user