From f8a1f3f2ebed86d72f465d81489168e6dde59541 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 31 Mar 2020 13:48:12 +0800 Subject: [PATCH] update modules --- .github/workflows/test.yml | 5 +-- dist/index.js | 37 +++++++++++++------ dist/versions.js | 10 ++++- node_modules/.bin/semver | 16 +------- node_modules/.bin/semver.cmd | 7 ---- node_modules/.bin/uuid | 16 +------- node_modules/.bin/uuid.cmd | 7 ---- node_modules/.yarn-integrity | 6 +-- .../tool-cache/node_modules/.bin/semver | 16 +------- .../tool-cache/node_modules/.bin/semver.cmd | 7 ---- .../tool-cache/node_modules/.bin/uuid | 16 +------- .../tool-cache/node_modules/.bin/uuid.cmd | 7 ---- .../node_modules/semver/bin/semver.js | 0 node_modules/semver/bin/semver.js | 0 node_modules/uuid/bin/uuid | 0 15 files changed, 42 insertions(+), 108 deletions(-) mode change 100644 => 120000 node_modules/.bin/semver delete mode 100644 node_modules/.bin/semver.cmd mode change 100644 => 120000 node_modules/.bin/uuid delete mode 100644 node_modules/.bin/uuid.cmd mode change 100644 => 120000 node_modules/@actions/tool-cache/node_modules/.bin/semver delete mode 100644 node_modules/@actions/tool-cache/node_modules/.bin/semver.cmd mode change 100644 => 120000 node_modules/@actions/tool-cache/node_modules/.bin/uuid delete mode 100644 node_modules/@actions/tool-cache/node_modules/.bin/uuid.cmd mode change 100644 => 100755 node_modules/@actions/tool-cache/node_modules/semver/bin/semver.js mode change 100644 => 100755 node_modules/semver/bin/semver.js mode change 100644 => 100755 node_modules/uuid/bin/uuid diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a29c04c..3991f4b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,10 +7,7 @@ jobs: build: strategy: matrix: - os: - - ubuntu-latest - - windows-latest - - macOS-latest + os: [ubuntu-latest, windows-latest, macOS-latest] runs-on: ${{ matrix.os }} diff --git a/dist/index.js b/dist/index.js index 04fe902..a65ca3c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -9,14 +9,23 @@ const path = require("path"); const semver = require("semver"); const git = require("./git"); const versions_1 = require("./versions"); -async function winInstall(version) { +async function winInstall(version, sha) { let toolDir = toolCache.find('xmake', version); if (!toolDir) { - const installer = await core.group('download xmake', async () => { - const arch = os.arch() === 'x64' ? 'x64' : 'x86'; - const url = semver.gt(version, '2.2.6') - ? `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?tag=v${version}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}` - : `https://github.com/xmake-io/xmake/releases/download/v$v/xmake-v${version}.exe`; + const installer = await core.group(`download xmake ${version}`, async () => { + let url = ""; + if (version.startsWith("branch@")) { + // we only use appveyor ci artifacts for branch version + const arch = os.arch() === 'x64' ? 'x64' : 'x86'; + url = `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=${sha}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}`; + } + else { + // we cannot use appveyor ci artifacts, the old version links may be broken. + const arch = os.arch() === 'x64' ? 'win64' : 'win32'; + url = semver.gt(version, '2.2.6') + ? `https://github.com/xmake-io/xmake/releases/download/v${version}/xmake-v${version}.${arch}.exe` + : `https://github.com/xmake-io/xmake/releases/download/v${version}/xmake-v${version}.exe`; + } core.info(`downloading from ${url}`); const file = await toolCache.downloadTool(url); const exe = path.format({ ...path.parse(file), ext: '.exe', base: undefined }); @@ -24,7 +33,7 @@ async function winInstall(version) { core.info(`downloaded to ${exe}`); return exe; }); - toolDir = await core.group('install xmake', async () => { + toolDir = await core.group(`install xmake ${version}`, async () => { const binDir = path.join(os.tmpdir(), `xmake-${version}`); core.info(`installing to ${binDir}`); await exec_1.exec(`"${installer}" /NOADMIN /S /D=${binDir}`); @@ -40,8 +49,8 @@ async function winInstall(version) { async function unixInstall(version, sha) { let toolDir = toolCache.find('xmake', version); if (!toolDir) { - const sourceDir = await core.group('download xmake', () => git.create(sha)); - toolDir = await core.group('install xmake', async () => { + const sourceDir = await core.group(`download xmake ${version}`, () => git.create(sha)); + toolDir = await core.group(`install xmake ${version}`, async () => { await exec_1.exec('make', ['build'], { cwd: sourceDir }); const binDir = path.join(os.tmpdir(), `xmake-${version}-${sha}`); await exec_1.exec('make', ['install', `prefix=${binDir}`], { cwd: sourceDir }); @@ -51,13 +60,19 @@ async function unixInstall(version, sha) { return cacheDir; }); } - core.addPath(path.join(toolDir, 'share', 'xmake')); + // for versions 2.3.2 and above, xmake will be installed directly into the bin directory, and no script will be used to wrap it. + if (version.startsWith("branch@") || semver.gt(version, '2.3.1')) { + core.addPath(path.join(toolDir, 'bin')); + } + else { + core.addPath(path.join(toolDir, 'share', 'xmake')); // only for <= 2.3.1 + } } async function run() { try { const { version, sha } = await versions_1.selectVersion(); if (os.platform() === 'win32' || os.platform() === 'cygwin') - await winInstall(version); + await winInstall(version, sha); else await unixInstall(version, sha); await exec_1.exec('xmake --version'); diff --git a/dist/versions.js b/dist/versions.js index 6003cfa..70048a8 100644 --- a/dist/versions.js +++ b/dist/versions.js @@ -4,9 +4,17 @@ const core = require("@actions/core"); const semver = require("semver"); const git_1 = require("./git"); async function selectVersion(version) { + // get version string version = (version !== null && version !== void 0 ? version : core.getInput('xmake-version')) || 'latest'; if (version.toLowerCase() === 'latest') version = ''; + // select branch + if (version.startsWith('branch@')) { + const branch = version.substr(7); + core.info(`Selected xmake branch: ${branch}`); + return { version: version, sha: branch }; + } + // select version version = semver.validRange(version); if (!version) { throw new Error(`Invalid input xmake-version: ${core.getInput('xmake-version')}`); @@ -17,7 +25,7 @@ async function selectVersion(version) { throw new Error(`No matched releases of xmake-version: ${version}`); } const sha = versions[ver]; - core.info(`selected xmake v${ver} (commit: ${sha.substr(0, 8)})`); + core.info(`Selected xmake v${ver} (commit: ${sha.substr(0, 8)})`); return { version: ver, sha }; } exports.selectVersion = selectVersion; diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver deleted file mode 100644 index 6f6e6c7..0000000 --- a/node_modules/.bin/semver +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../semver/bin/semver.js" "$@" - ret=$? -else - node "$basedir/../semver/bin/semver.js" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver new file mode 120000 index 0000000..5aaadf4 --- /dev/null +++ b/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver.js \ No newline at end of file diff --git a/node_modules/.bin/semver.cmd b/node_modules/.bin/semver.cmd deleted file mode 100644 index 152bc92..0000000 --- a/node_modules/.bin/semver.cmd +++ /dev/null @@ -1,7 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\..\semver\bin\semver.js" %* -) ELSE ( - @SETLOCAL - @SET PATHEXT=%PATHEXT:;.JS;=;% - node "%~dp0\..\semver\bin\semver.js" %* -) \ No newline at end of file diff --git a/node_modules/.bin/uuid b/node_modules/.bin/uuid deleted file mode 100644 index f3bfcf4..0000000 --- a/node_modules/.bin/uuid +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../uuid/bin/uuid" "$@" - ret=$? -else - node "$basedir/../uuid/bin/uuid" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/.bin/uuid b/node_modules/.bin/uuid new file mode 120000 index 0000000..b3e45bc --- /dev/null +++ b/node_modules/.bin/uuid @@ -0,0 +1 @@ +../uuid/bin/uuid \ No newline at end of file diff --git a/node_modules/.bin/uuid.cmd b/node_modules/.bin/uuid.cmd deleted file mode 100644 index da52d68..0000000 --- a/node_modules/.bin/uuid.cmd +++ /dev/null @@ -1,7 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\..\uuid\bin\uuid" %* -) ELSE ( - @SETLOCAL - @SET PATHEXT=%PATHEXT:;.JS;=;% - node "%~dp0\..\uuid\bin\uuid" %* -) \ No newline at end of file diff --git a/node_modules/.yarn-integrity b/node_modules/.yarn-integrity index d54f89d..83ad8e6 100644 --- a/node_modules/.yarn-integrity +++ b/node_modules/.yarn-integrity @@ -1,11 +1,9 @@ { - "systemParams": "win32-x64-72", + "systemParams": "darwin-x64-72", "modulesFolders": [ "node_modules" ], - "flags": [ - "production" - ], + "flags": [], "linkedModules": [], "topLevelPatterns": [ "@actions/core@^1.1.3", diff --git a/node_modules/@actions/tool-cache/node_modules/.bin/semver b/node_modules/@actions/tool-cache/node_modules/.bin/semver deleted file mode 100644 index 6f6e6c7..0000000 --- a/node_modules/@actions/tool-cache/node_modules/.bin/semver +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../semver/bin/semver.js" "$@" - ret=$? -else - node "$basedir/../semver/bin/semver.js" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/@actions/tool-cache/node_modules/.bin/semver b/node_modules/@actions/tool-cache/node_modules/.bin/semver new file mode 120000 index 0000000..5aaadf4 --- /dev/null +++ b/node_modules/@actions/tool-cache/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver.js \ No newline at end of file diff --git a/node_modules/@actions/tool-cache/node_modules/.bin/semver.cmd b/node_modules/@actions/tool-cache/node_modules/.bin/semver.cmd deleted file mode 100644 index 152bc92..0000000 --- a/node_modules/@actions/tool-cache/node_modules/.bin/semver.cmd +++ /dev/null @@ -1,7 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\..\semver\bin\semver.js" %* -) ELSE ( - @SETLOCAL - @SET PATHEXT=%PATHEXT:;.JS;=;% - node "%~dp0\..\semver\bin\semver.js" %* -) \ No newline at end of file diff --git a/node_modules/@actions/tool-cache/node_modules/.bin/uuid b/node_modules/@actions/tool-cache/node_modules/.bin/uuid deleted file mode 100644 index 4481e8b..0000000 --- a/node_modules/@actions/tool-cache/node_modules/.bin/uuid +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../../../../uuid/bin/uuid" "$@" - ret=$? -else - node "$basedir/../../../../uuid/bin/uuid" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/@actions/tool-cache/node_modules/.bin/uuid b/node_modules/@actions/tool-cache/node_modules/.bin/uuid new file mode 120000 index 0000000..71fa0ca --- /dev/null +++ b/node_modules/@actions/tool-cache/node_modules/.bin/uuid @@ -0,0 +1 @@ +../../../../uuid/bin/uuid \ No newline at end of file diff --git a/node_modules/@actions/tool-cache/node_modules/.bin/uuid.cmd b/node_modules/@actions/tool-cache/node_modules/.bin/uuid.cmd deleted file mode 100644 index b9ac0d5..0000000 --- a/node_modules/@actions/tool-cache/node_modules/.bin/uuid.cmd +++ /dev/null @@ -1,7 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\..\..\..\..\uuid\bin\uuid" %* -) ELSE ( - @SETLOCAL - @SET PATHEXT=%PATHEXT:;.JS;=;% - node "%~dp0\..\..\..\..\uuid\bin\uuid" %* -) \ No newline at end of file diff --git a/node_modules/@actions/tool-cache/node_modules/semver/bin/semver.js b/node_modules/@actions/tool-cache/node_modules/semver/bin/semver.js old mode 100644 new mode 100755 diff --git a/node_modules/semver/bin/semver.js b/node_modules/semver/bin/semver.js old mode 100644 new mode 100755 diff --git a/node_modules/uuid/bin/uuid b/node_modules/uuid/bin/uuid old mode 100644 new mode 100755