Compare commits

...

39 Commits

Author SHA1 Message Date
Bryan MacFarlane 2ae9264901 back to master 2020-05-04 12:44:15 -04:00
Bryan MacFarlane 2a0fbec10d output info 2020-05-03 19:18:32 -04:00
Bryan MacFarlane 0a9e8b1d0f output info 2020-05-03 19:17:04 -04:00
Bryan MacFarlane a875da2574 output info 2020-05-03 19:14:57 -04:00
Bryan MacFarlane a80a170798 no proxy fix 2020-05-03 18:40:24 -04:00
Bryan MacFarlane 5e7b076d00 dbg 2020-05-03 18:37:13 -04:00
Bryan MacFarlane 8e221092f3 dbg 2020-05-03 18:34:17 -04:00
Bryan MacFarlane 6a1b66a606 dbg 2020-05-03 18:30:29 -04:00
Bryan MacFarlane 9fcef3fcea testing 7z alt 2020-05-03 18:23:27 -04:00
Bryan MacFarlane beb2155295 testing 7z alt 2020-05-03 18:22:18 -04:00
Bryan MacFarlane 11f920585c no proxy issue 2020-05-03 18:12:05 -04:00
Bryan MacFarlane dd6f5ab66c only node binary issue 2020-05-03 18:09:05 -04:00
Bryan MacFarlane f7c5caf605 dbg 2020-05-03 16:37:13 -04:00
Bryan MacFarlane a4145577de dbg 2020-05-03 16:34:20 -04:00
Bryan MacFarlane 42746a4f3c dbg 2020-05-03 16:18:09 -04:00
Bryan MacFarlane c8617ac6ae win change 2020-05-03 16:13:11 -04:00
Bryan MacFarlane 1b2d431484 win change 2020-05-03 15:44:03 -04:00
Bryan MacFarlane 5e5ef8fd55 update 2020-05-03 10:12:44 -04:00
Bryan MacFarlane 2fb08c4f31 update workflows 2020-05-03 09:49:04 -04:00
Bryan MacFarlane e3ad114cc4 dist 2020-05-02 16:39:25 -04:00
Bryan MacFarlane 501fd29d66 Merge branch 'master' into node-versions 2020-05-02 16:34:40 -04:00
Bryan MacFarlane 2bdb2ab1c9 strip 1 on fallback extract 2020-05-02 16:26:50 -04:00
Bryan MacFarlane a47b2f66c6 Merge pull request #108 from nschonni/patch-2
chore: Swap EOL 8 in example for 12
2020-05-02 11:47:58 -04:00
Bryan MacFarlane 89ea387bde Merge pull request #141 from fishcharlie/patch-1
Changing node-version default to be latest LTS (12.x)
2020-05-02 11:45:15 -04:00
Bryan MacFarlane ed3a918d25 Merge pull request #153 from actions/start-v2
updated tests
2020-05-02 11:41:20 -04:00
Josh Gross 44c9c18728 Merge pull request #142 from actions/joshmgross/run-tests-on-windows
Run test job on windows-latest
2020-04-21 16:16:40 -04:00
Josh Gross e715d9a456 Merge pull request #137 from actions/joshmgross/log-node-version
Log node and npm versions
2020-04-21 15:45:36 -04:00
Josh Gross b1f2e78536 Use matrix for workflow 2020-04-21 14:43:21 -04:00
Josh Gross 55897e37f3 Run test job on windows-latest 2020-04-21 14:39:51 -04:00
Josh Gross 46903d1fb1 Await exec calls to ensure proper version ordering 2020-04-21 14:17:29 -04:00
Josh Gross 28505ad4d3 Move version to args 2020-04-21 14:13:03 -04:00
Josh Gross 2d53d29868 Use actions/exec for getting version 2020-04-21 14:03:26 -04:00
Josh Gross 1e163ded31 Quote exec parameters 2020-04-21 11:40:45 -04:00
Josh Gross ffde538781 Only include npm version if npm exists 2020-04-21 11:23:19 -04:00
Charlie Fish 0cc027b656 Changing node-version default to be latest LTS (12.x) 2020-04-20 17:36:56 -06:00
Josh Gross e99a7e62b2 Add dist changes 2020-04-16 11:47:45 -04:00
Josh Gross 0dc69b3a71 Remove extra version logging 2020-04-16 10:56:07 -04:00
Josh Gross 52eb8a7524 Log node and npm version 2020-04-16 10:45:55 -04:00
Nick Schonning 6b7f6c9fa6 chore: Swap EOL 8 in example for 12 2020-01-31 02:12:22 -05:00
10 changed files with 220 additions and 117 deletions
+32
View File
@@ -0,0 +1,32 @@
name: build-test
on:
pull_request:
paths-ignore:
- '**.md'
push:
branches:
- master
- releases/*
paths-ignore:
- '**.md'
jobs:
build:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Setup node 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm ci
- run: npm run build
- run: npm run format-check
- run: npm test
- name: Verify no unstaged changes
if: runner.os != 'windows'
run: __tests__/verify-no-unstaged-changes.sh
+56
View File
@@ -0,0 +1,56 @@
name: proxy
on:
pull_request:
paths-ignore:
- '**.md'
push:
branches:
- master
- releases/*
paths-ignore:
- '**.md'
jobs:
test-proxy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
container:
image: ubuntu:latest
options: --dns 127.0.0.1
services:
squid-proxy:
image: datadog/squid:latest
ports:
- 3128:3128
env:
https_proxy: http://squid-proxy:3128
steps:
- uses: actions/checkout@v2
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 10
uses: ./
with:
node-version: 10.x
- name: Verify node and npm
run: __tests__/verify-node.sh 10
test-bypass-proxy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
env:
https_proxy: http://no-such-proxy:3128
no_proxy: api.github.com,github.com,nodejs.org,registry.npmjs.org,*.s3.amazonaws.com,s3.amazonaws.com
steps:
- uses: actions/checkout@v2
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 11
uses: ./
with:
node-version: 11
- name: Verify node and npm
run: __tests__/verify-node.sh 11
+47
View File
@@ -0,0 +1,47 @@
name: versions
on:
pull_request:
paths-ignore:
- '**.md'
push:
branches:
- master
- releases/*
paths-ignore:
- '**.md'
jobs:
versions:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
# test version that falls through to node dist
- name: Setup node 11 from dist
uses: ./
with:
node-version: 11
- name: Verify node and npm
run: __tests__/verify-node.sh 11
# test old versions which didn't have npm and layout different
- name: Setup node 0.12.18 from dist
uses: ./
with:
node-version: 0.12.18
- name: Verify node
shell: bash
run: __tests__/verify-node.sh 0.12.18 SKIP_NPM
# test version from node manifest
- name: Setup node 12.16.2 from manifest
uses: ./
with:
node-version: 12.16.2
- name: Verify node and npm
run: __tests__/verify-node.sh 12
-94
View File
@@ -1,94 +0,0 @@
name: Main workflow
on:
pull_request:
push:
branches:
- master
- releases/*
jobs:
build:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Setup node 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm ci
- run: npm run build
- run: npm run format-check
- run: npm test
- name: Verify no unstaged changes
if: runner.os != 'windows'
run: __tests__/verify-no-unstaged-changes.sh
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 10
uses: ./
with:
node-version: 10.x
- name: Verify node and npm
run: __tests__/verify-node.sh 10
test-fallback:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Clear tool cache
run: mv "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
- name: Setup node 0.12.18 # For non LTS versions of Node, the zip is not always available
uses: ./ # and falls back to downloading node.exe and node.lib
with:
node-version: 0.12.18
- name: Verify node
shell: bash
run: __tests__/verify-node.sh 0.12.18 SKIP_NPM
test-proxy:
runs-on: ubuntu-latest
container:
image: ubuntu:latest
options: --dns 127.0.0.1
services:
squid-proxy:
image: datadog/squid:latest
ports:
- 3128:3128
env:
https_proxy: http://squid-proxy:3128
steps:
- uses: actions/checkout@v2
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 10
uses: ./
with:
node-version: 10.x
- name: Verify node and npm
run: __tests__/verify-node.sh 10
test-bypass-proxy:
runs-on: ubuntu-latest
env:
https_proxy: http://no-such-proxy:3128
no_proxy: github.com,nodejs.org,registry.npmjs.org
steps:
- uses: actions/checkout@v2
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 10
uses: ./
with:
node-version: 10.x
- name: Verify node and npm
run: __tests__/verify-node.sh 10
+1 -1
View File
@@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-16.04
strategy:
matrix:
node: [ '10', '8' ]
node: [ '10', '12' ]
name: Node ${{ matrix.node }} sample
steps:
- uses: actions/checkout@v2
+54 -11
View File
@@ -563,13 +563,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
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 });
const os = __webpack_require__(87);
const events = __webpack_require__(614);
const child = __webpack_require__(129);
const path = __webpack_require__(622);
const io = __webpack_require__(1);
const ioUtil = __webpack_require__(672);
const os = __importStar(__webpack_require__(87));
const events = __importStar(__webpack_require__(614));
const child = __importStar(__webpack_require__(129));
const path = __importStar(__webpack_require__(622));
const io = __importStar(__webpack_require__(1));
const ioUtil = __importStar(__webpack_require__(672));
/* eslint-disable @typescript-eslint/unbound-method */
const IS_WINDOWS = process.platform === 'win32';
/*
@@ -1013,6 +1020,12 @@ class ToolRunner extends events.EventEmitter {
resolve(exitCode);
}
});
if (this.options.input) {
if (!cp.stdin) {
throw new Error('child process missing stdin');
}
cp.stdin.end(this.options.input);
}
});
});
}
@@ -11076,7 +11089,13 @@ function extractTar(file, dest, flags = 'xz') {
core.debug(versionOutput.trim());
const isGnuTar = versionOutput.toUpperCase().includes('GNU TAR');
// Initialize args
const args = [flags];
let args;
if (flags instanceof Array) {
args = flags;
}
else {
args = [flags];
}
let destArg = dest;
let fileArg = file;
if (IS_WINDOWS && isGnuTar) {
@@ -12956,6 +12975,7 @@ const io = __importStar(__webpack_require__(1));
const tc = __importStar(__webpack_require__(533));
const path = __importStar(__webpack_require__(622));
const semver = __importStar(__webpack_require__(280));
const fs = __webpack_require__(747);
function getNode(versionSpec, stable, token) {
return __awaiter(this, void 0, void 0, function* () {
let osPlat = os.platform();
@@ -12985,25 +13005,38 @@ function getNode(versionSpec, stable, token) {
}
catch (err) {
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
return yield acquireNodeFromFallbackLocation(info.resolvedVersion);
yield acquireNodeFromFallbackLocation(info.resolvedVersion);
return;
}
throw err;
}
//
// Extract
//
console.log('Extracting ...');
let extPath;
if (osPlat == 'win32') {
let _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe');
extPath = yield tc.extract7z(downloadPath, undefined, _7zPath);
// 7z extracts to folder matching file name
let nestedPath = path.join(extPath, path.basename(info.fileName, '.7z'));
if (fs.existsSync(nestedPath)) {
extPath = nestedPath;
}
}
else {
extPath = yield tc.extractTar(downloadPath);
extPath = yield tc.extractTar(downloadPath, undefined, [
'xz',
'--strip',
'1'
]);
}
//
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
//
console.log('Adding to the cache ...');
toolPath = yield tc.cacheDir(extPath, 'node', info.resolvedVersion);
console.log('Done');
}
//
// a tool installer initimately knows details about the layout of that tool
@@ -13158,6 +13191,7 @@ function acquireNodeFromFallbackLocation(version) {
try {
exeUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.exe`;
libUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.lib`;
console.log(`Downloading only node binary from ${exeUrl}`);
const exePath = yield tc.downloadTool(exeUrl);
yield io.cp(exePath, path.join(tempDir, 'node.exe'));
const libPath = yield tc.downloadTool(libUrl);
@@ -13176,7 +13210,9 @@ function acquireNodeFromFallbackLocation(version) {
throw err;
}
}
return yield tc.cacheDir(tempDir, 'node', version);
let toolPath = yield tc.cacheDir(tempDir, 'node', version);
core.addPath(toolPath);
return toolPath;
});
}
// os.arch does not always match the relative download url, e.g.
@@ -16735,8 +16771,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
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 });
const tr = __webpack_require__(9);
const tr = __importStar(__webpack_require__(9));
/**
* Exec a command.
* Output will be streamed to the live console.
+6 -6
View File
@@ -10,9 +10,9 @@
"integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg=="
},
"@actions/exec": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.3.tgz",
"integrity": "sha512-TogJGnueOmM7ntCi0ASTUj4LapRRtDfj57Ja4IhPmg2fls28uVOPbAn8N+JifaOumN2UG3oEO/Ixek2A4NcYSA==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz",
"integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==",
"requires": {
"@actions/io": "^1.0.1"
}
@@ -40,9 +40,9 @@
"integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg=="
},
"@actions/tool-cache": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.5.2.tgz",
"integrity": "sha512-40A1St0GEo+QvHV1YRjStEoQcKKMaip+zNXPgGHcjYXCdZ7cl1LGlwOpsVVqwk+6ue/shFTS76KC1A02mVVCQA==",
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.5.3.tgz",
"integrity": "sha512-G6OMdGvKVkApJv+nRURpi1nZUKonqWq37fqK8rdJLJr5PuWAEo/cqD/ibano7Da/LRx1yYFEMwO6RXkB2VaIqQ==",
"requires": {
"@actions/core": "^1.2.0",
"@actions/exec": "^1.0.0",
+2 -1
View File
@@ -24,10 +24,11 @@
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.2",
"@actions/exec": "^1.0.3",
"@actions/github": "^1.1.0",
"@actions/http-client": "^1.0.6",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^1.5.2",
"@actions/tool-cache": "^1.5.3",
"semver": "^6.1.1"
},
"devDependencies": {
+21 -3
View File
@@ -7,6 +7,7 @@ import * as tc from '@actions/tool-cache';
import * as path from 'path';
import * as semver from 'semver';
import {Url} from 'url';
import fs = require('fs');
//
// Node versions interface
@@ -63,7 +64,8 @@ export async function getNode(
downloadPath = await tc.downloadTool(info.downloadUrl, undefined, token);
} catch (err) {
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
return await acquireNodeFromFallbackLocation(info.resolvedVersion);
await acquireNodeFromFallbackLocation(info.resolvedVersion);
return;
}
throw err;
@@ -72,18 +74,30 @@ export async function getNode(
//
// Extract
//
console.log('Extracting ...');
let extPath: string;
if (osPlat == 'win32') {
let _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe');
extPath = await tc.extract7z(downloadPath, undefined, _7zPath);
// 7z extracts to folder matching file name
let nestedPath = path.join(extPath, path.basename(info.fileName, '.7z'));
if (fs.existsSync(nestedPath)) {
extPath = nestedPath;
}
} else {
extPath = await tc.extractTar(downloadPath);
extPath = await tc.extractTar(downloadPath, undefined, [
'xz',
'--strip',
'1'
]);
}
//
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
//
console.log('Adding to the cache ...');
toolPath = await tc.cacheDir(extPath, 'node', info.resolvedVersion);
console.log('Done');
}
//
@@ -262,6 +276,8 @@ async function acquireNodeFromFallbackLocation(
exeUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.exe`;
libUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.lib`;
console.log(`Downloading only node binary from ${exeUrl}`);
const exePath = await tc.downloadTool(exeUrl);
await io.cp(exePath, path.join(tempDir, 'node.exe'));
const libPath = await tc.downloadTool(libUrl);
@@ -279,7 +295,9 @@ async function acquireNodeFromFallbackLocation(
throw err;
}
}
return await tc.cacheDir(tempDir, 'node', version);
let toolPath = await tc.cacheDir(tempDir, 'node', version);
core.addPath(toolPath);
return toolPath;
}
// os.arch does not always match the relative download url, e.g.
+1 -1
View File
@@ -13,7 +13,7 @@ rm -rf ./node
export RUNNER_TOOL_CACHE=$(pwd)
export RUNNER_TEMP="${RUNNER_TOOL_CACHE}/temp"
export INPUT_STABLE=true
export INPUT_VERSION="12.x"
export INPUT_VERSION="12" #"0.12.7" #"12" #"11.15.0"
# export your PAT with repo scope before running
export INPUT_TOKEN=$GITHUB_TOKEN