Compare commits

..

14 Commits

14 changed files with 161 additions and 264 deletions
-2
View File
@@ -28,8 +28,6 @@ jobs:
- name: 'check for uncommitted changes' - name: 'check for uncommitted changes'
# Ensure no changes # Ensure no changes
run: | run: |
pnpm --version
node --version
git add . git add .
if ! git diff --cached --color=always --exit-code -- . ':!node_modules'; then if ! git diff --cached --color=always --exit-code -- . ':!node_modules'; then
echo "::error::Found changed files after build. Please run 'pnpm release' and check in all changes." echo "::error::Found changed files after build. Please run 'pnpm release' and check in all changes."
+8 -27
View File
@@ -11,47 +11,28 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest, windows-11-arm, macOS-latest] os: [macOS-latest, macos-14, macos-13]
version: [latest, branch@master, branch@dev] version: [branch@test]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: xmake-io/github-action-setup-xmake@master - uses: xmake-io/github-action-setup-xmake@test
with: with:
xmake-version: ${{ matrix.version }} xmake-version: ${{ matrix.version }}
actions-cache-folder: '.xmake-cache' actions-cache-folder: '.xmake-cache'
actions-cache-key: ${{ matrix.version }}-relative actions-cache-key: ${{ matrix.version }}
build-cache: true build-cache: true
build-cache-key: ${{ matrix.version }}-relative build-cache-key: ${{ matrix.version }}
package-cache: true package-cache: true
package-cache-key: ${{ matrix.version }}-relative package-cache-key: ${{ matrix.version }}
project-path: 'tests/sample' project-path: 'tests/sample'
- name: Run tests with relative cache path - name: Run tests
run: | run: |
sw_vers -productVersion
xmake --version xmake --version
cd tests/sample cd tests/sample
xmake -y -vD xmake -y -vD
xmake run xmake run
xmake clean
- uses: xmake-io/github-action-setup-xmake@master
with:
xmake-version: ${{ matrix.version }}
actions-cache-folder: '${{ runner.temp }}/xmake-cache'
actions-cache-key: ${{ matrix.version }}-absolute
build-cache: true
build-cache-key: ${{ matrix.version }}-absolute
package-cache: true
package-cache-key: ${{ matrix.version }}-absolute
project-path: 'tests/sample'
- name: Run tests with absolute cache path
run: |
xmake --version
cd tests/sample
xmake -y -vD
xmake run
xmake clean
+1 -1
View File
@@ -142,6 +142,6 @@ git branch test
git checkout test git checkout test
pnpm build pnpm build
pnpm release pnpm release
git commit -a -m "..." git-commit -a -m "..."
git push origin test git push origin test
``` ```
+68 -113
View File
@@ -70512,9 +70512,9 @@ const core = __nccwpck_require__(7484);
const exec_1 = __nccwpck_require__(5236); const exec_1 = __nccwpck_require__(5236);
const io = __nccwpck_require__(4994); const io = __nccwpck_require__(4994);
const cache = __nccwpck_require__(5116); const cache = __nccwpck_require__(5116);
const os = __nccwpck_require__(857);
const path = __nccwpck_require__(6928); const path = __nccwpck_require__(6928);
const fsutils = __nccwpck_require__(7999); const fsutils = __nccwpck_require__(7999);
const system_1 = __nccwpck_require__(7666);
function getBuildTime(hours) { function getBuildTime(hours) {
let key = 'BuildTime'; let key = 'BuildTime';
if (hours && hours !== '') { if (hours && hours !== '') {
@@ -70545,7 +70545,8 @@ function getProjectRootPath() {
} }
return projectRootPath; return projectRootPath;
} }
async function getBuildCacheKey(buildCacheTime) { function getBuildCacheKey(buildCacheTime) {
var _a;
let buildCacheKey = core.getInput('build-cache-key'); let buildCacheKey = core.getInput('build-cache-key');
if (!buildCacheKey) { if (!buildCacheKey) {
buildCacheKey = ''; buildCacheKey = '';
@@ -70553,8 +70554,7 @@ async function getBuildCacheKey(buildCacheTime) {
if (!buildCacheTime || buildCacheTime === '') { if (!buildCacheTime || buildCacheTime === '') {
buildCacheTime = getBuildTime(); buildCacheTime = getBuildTime();
} }
const platformIdentifier = await (0, system_1.getPlatformIdentifier)(); return `xmake-build-cache-${buildCacheKey}-${buildCacheTime}-${os.arch()}-${os.platform()}-${(_a = process.env.RUNNER_OS) !== null && _a !== void 0 ? _a : 'unknown'}`;
return `xmake-build-cache-${buildCacheKey}-${buildCacheTime}-${platformIdentifier}`;
} }
async function getBuildCachePath() { async function getBuildCachePath() {
let buildCachePath = core.getInput('build-cache-path'); let buildCachePath = core.getInput('build-cache-path');
@@ -70611,7 +70611,7 @@ async function loadBuildCache() {
if (hours < 0) { if (hours < 0) {
break; break;
} }
const buildCacheKey = await getBuildCacheKey(getBuildTime(String(hours).padStart(2, '0'))); const buildCacheKey = getBuildCacheKey(getBuildTime(String(hours).padStart(2, '0')));
if (!fsutils.isFile(filepath)) { if (!fsutils.isFile(filepath)) {
core.info(`Restore build cache path: ${fullCachePath} to ${buildCachePath}, key: ${buildCacheKey}`); core.info(`Restore build cache path: ${fullCachePath} to ${buildCachePath}, key: ${buildCacheKey}`);
await cache.restoreCache([buildCacheFolder], buildCacheKey); await cache.restoreCache([buildCacheFolder], buildCacheKey);
@@ -70644,7 +70644,7 @@ async function saveBuildCache() {
return; return;
} }
const buildCacheFolder = getBuildCacheFolder(); const buildCacheFolder = getBuildCacheFolder();
const buildCacheKey = await getBuildCacheKey(); const buildCacheKey = getBuildCacheKey();
const buildCachePath = await getBuildCachePath(); const buildCachePath = await getBuildCachePath();
const hitBuildCache = !!core.getState('hitBuildCache'); const hitBuildCache = !!core.getState('hitBuildCache');
if (!hitBuildCache && buildCacheFolder && process.env.GITHUB_WORKSPACE && fsutils.isDir(buildCachePath)) { if (!hitBuildCache && buildCacheFolder && process.env.GITHUB_WORKSPACE && fsutils.isDir(buildCachePath)) {
@@ -70713,7 +70713,6 @@ const exec_1 = __nccwpck_require__(5236);
const io = __nccwpck_require__(4994); const io = __nccwpck_require__(4994);
const os = __nccwpck_require__(857); const os = __nccwpck_require__(857);
const path = __nccwpck_require__(6928); const path = __nccwpck_require__(6928);
const semver_1 = __nccwpck_require__(2088);
function makeOpt(ref) { function makeOpt(ref) {
return { cwd: path.join(os.tmpdir(), `xmake-git-${ref}`) }; return { cwd: path.join(os.tmpdir(), `xmake-git-${ref}`) };
} }
@@ -70728,38 +70727,25 @@ async function lsRemote(repo) {
}); });
const data = { heads: {}, tags: {}, pull: {} }; const data = { heads: {}, tags: {}, pull: {} };
out.split('\n').forEach((line) => { out.split('\n').forEach((line) => {
const [ref, path] = line.trim().split('\t'); const [ref, tag] = line.trim().split('\t');
if (ref && (path === null || path === void 0 ? void 0 : path.startsWith('refs/'))) { if (ref && (tag === null || tag === void 0 ? void 0 : tag.startsWith('refs/'))) {
const tagPath = path.split('/').splice(1); const tagPath = tag.split('/').splice(1);
switch (tagPath[0]) { // eslint-disable-next-line @typescript-eslint/no-explicit-any
case 'heads': { let ldata = data; // eslint-disable-line @typescript-eslint/no-unsafe-assignment
// refs/heads/copilot/fix-6807 for (let i = 0; i < tagPath.length - 1; i++) {
const head = tagPath.slice(1).join('/'); const seg = tagPath[i];
data.heads[head] = ref; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
break; if (typeof ldata[seg] === 'object') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ldata = ldata[seg]; // eslint-disable-line @typescript-eslint/no-unsafe-assignment
} }
case 'pull': { else {
// refs/pull/11/head // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
// refs/pull/11/merge ldata = ldata[seg] = {};
const pr = Number(tagPath[1]);
if (!data.pull[pr]) {
data.pull[pr] = {};
} }
data.pull[pr][tagPath[2]] = ref;
break;
}
case 'tags': {
// refs/tags/preview
// refs/tags/v3.0.3
const tag = tagPath.slice(1).join('/');
if ((0, semver_1.valid)(tag)) {
data.tags[tag] = ref;
}
break;
}
default:
break;
} }
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ldata[tagPath[tagPath.length - 1]] = ref;
} }
}); });
return data; return data;
@@ -70798,7 +70784,8 @@ const unix_install_1 = __nccwpck_require__(9095);
async function installXmake() { async function installXmake() {
const version = await (0, versions_1.selectVersion)(); const version = await (0, versions_1.selectVersion)();
if (os.platform() === 'win32' || os.platform() === 'cygwin') { if (os.platform() === 'win32' || os.platform() === 'cygwin') {
await (0, win_install_1.winInstall)(version); const latest = await (0, versions_1.selectVersion)('latest');
await (0, win_install_1.winInstall)(version, latest);
} }
else { else {
await (0, unix_install_1.unixInstall)(version); await (0, unix_install_1.unixInstall)(version);
@@ -70845,9 +70832,9 @@ const core = __nccwpck_require__(7484);
const exec_1 = __nccwpck_require__(5236); const exec_1 = __nccwpck_require__(5236);
const io = __nccwpck_require__(4994); const io = __nccwpck_require__(4994);
const cache = __nccwpck_require__(5116); const cache = __nccwpck_require__(5116);
const os = __nccwpck_require__(857);
const path = __nccwpck_require__(6928); const path = __nccwpck_require__(6928);
const fsutils = __nccwpck_require__(7999); const fsutils = __nccwpck_require__(7999);
const system_1 = __nccwpck_require__(7666);
function getProjectRootPath() { function getProjectRootPath() {
let projectRootPath = core.getInput('project-path'); let projectRootPath = core.getInput('project-path');
if (!projectRootPath) { if (!projectRootPath) {
@@ -70860,6 +70847,7 @@ function getProjectRootPath() {
return projectRootPath; return projectRootPath;
} }
async function getPackageCacheKey() { async function getPackageCacheKey() {
var _a;
let packageCacheKey = core.getInput('package-cache-key'); let packageCacheKey = core.getInput('package-cache-key');
if (!packageCacheKey) { if (!packageCacheKey) {
packageCacheKey = ''; packageCacheKey = '';
@@ -70882,8 +70870,7 @@ async function getPackageCacheKey() {
await (0, exec_1.exec)('xmake', ['l', 'utils.ci.packageskey'], options); await (0, exec_1.exec)('xmake', ['l', 'utils.ci.packageskey'], options);
packageCacheHash = packageCacheHash.trim(); packageCacheHash = packageCacheHash.trim();
} }
const platformIdentifier = await (0, system_1.getPlatformIdentifier)(); return `xmake-package-cache-${packageCacheKey}-${packageCacheHash}-${os.arch()}-${os.platform()}-${(_a = process.env.RUNNER_OS) !== null && _a !== void 0 ? _a : 'unknown'}`;
return `xmake-package-cache-${packageCacheKey}-${packageCacheHash}-${platformIdentifier}`;
} }
async function getPackageCachePath() { async function getPackageCachePath() {
let packageCachePath = ''; let packageCachePath = '';
@@ -70989,16 +70976,23 @@ if (!exports.IsPost) {
/***/ }), /***/ }),
/***/ 7666: /***/ 9095:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getPlatformIdentifier = getPlatformIdentifier; exports.unixInstall = unixInstall;
const core = __nccwpck_require__(7484); const core = __nccwpck_require__(7484);
const exec_1 = __nccwpck_require__(5236); const exec_1 = __nccwpck_require__(5236);
const io = __nccwpck_require__(4994);
const toolCache = __nccwpck_require__(3472);
const cache = __nccwpck_require__(5116);
const os = __nccwpck_require__(857); const os = __nccwpck_require__(857);
const fs = __nccwpck_require__(9896);
const path = __nccwpck_require__(6928);
const semver = __nccwpck_require__(2088);
const git = __nccwpck_require__(1243);
async function getPlatformIdentifier() { async function getPlatformIdentifier() {
var _a; var _a;
let identifier = `${os.platform()}-${os.arch()}-${(_a = process.env.RUNNER_OS) !== null && _a !== void 0 ? _a : 'unknown'}`; let identifier = `${os.platform()}-${os.arch()}-${(_a = process.env.RUNNER_OS) !== null && _a !== void 0 ? _a : 'unknown'}`;
@@ -71023,32 +71017,10 @@ async function getPlatformIdentifier() {
} }
return identifier; return identifier;
} }
/***/ }),
/***/ 9095:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.unixInstall = unixInstall;
const core = __nccwpck_require__(7484);
const exec_1 = __nccwpck_require__(5236);
const io = __nccwpck_require__(4994);
const toolCache = __nccwpck_require__(3472);
const cache = __nccwpck_require__(5116);
const os = __nccwpck_require__(857);
const fs = __nccwpck_require__(9896);
const path = __nccwpck_require__(6928);
const semver = __nccwpck_require__(2088);
const git = __nccwpck_require__(1243);
const system_1 = __nccwpck_require__(7666);
async function install(sourceDir, binDir) { async function install(sourceDir, binDir) {
if (fs.existsSync(path.join(sourceDir, 'configure'))) { if (fs.existsSync(path.join(sourceDir, 'configure'))) {
await (0, exec_1.exec)('sh', ['./configure'], { cwd: sourceDir }); await (0, exec_1.exec)('sh', ['./configure'], { cwd: sourceDir });
await (0, exec_1.exec)('make', ['-j6'], { cwd: sourceDir }); await (0, exec_1.exec)('make', ['-j6', 'VERBOSE=1'], { cwd: sourceDir });
await (0, exec_1.exec)('make', ['install', `PREFIX=${binDir}`], { cwd: sourceDir }); await (0, exec_1.exec)('make', ['install', `PREFIX=${binDir}`], { cwd: sourceDir });
} }
else { else {
@@ -71066,10 +71038,10 @@ async function unixInstall(version) {
if (version.type !== 'local') { if (version.type !== 'local') {
const ver = version.version; const ver = version.version;
const sha = version.sha; const sha = version.sha;
const platformIdentifier = await (0, system_1.getPlatformIdentifier)(); const platformIdentifier = await getPlatformIdentifier();
const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${platformIdentifier}`; const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${platformIdentifier}`;
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) { if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
const fullCachePath = path.resolve(process.env.GITHUB_WORKSPACE, actionsCacheFolder); const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder);
try { try {
try { try {
fs.accessSync(path.join(fullCachePath, 'bin', 'xmake'), fs.constants.X_OK); fs.accessSync(path.join(fullCachePath, 'bin', 'xmake'), fs.constants.X_OK);
@@ -71096,7 +71068,7 @@ async function unixInstall(version) {
await install(sourceDir, binDir); await install(sourceDir, binDir);
let cacheDir = ''; let cacheDir = '';
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) { if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
cacheDir = path.resolve(process.env.GITHUB_WORKSPACE, actionsCacheFolder); cacheDir = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder);
await io.cp(binDir, cacheDir, { await io.cp(binDir, cacheDir, {
recursive: true, recursive: true,
}); });
@@ -71126,6 +71098,8 @@ async function unixInstall(version) {
else { else {
core.addPath(path.join(toolDir, 'share', 'xmake')); // only for <= 2.3.1 core.addPath(path.join(toolDir, 'share', 'xmake')); // only for <= 2.3.1
} }
// xmake l utils.binary.deplibs /Users/ruki/.local/bin/xmake
await (0, exec_1.exec)(`xmake l --root utils.binary.deplibs ${path.join(toolDir, 'bin', 'xmake')}`);
} }
@@ -71239,9 +71213,9 @@ async function selectSha(repo, sha) {
return selectPr(repo, Number.parseInt(pr)); return selectPr(repo, Number.parseInt(pr));
} }
} }
return Promise.resolve(new GitVersionImpl(repo, `sha#${shaValue}`, shaValue, 'sha', `commit ${shaValue.substring(0, 8)}`)); return Promise.resolve(new GitVersionImpl(repo, `sha#${shaValue}`, shaValue, 'sha', `commit ${shaValue.substr(0, 8)}`));
} }
async function selectVersion(version, _fallback = false) { async function selectVersion(version) {
// get version string // get version string
version = (version !== null && version !== void 0 ? version : core.getInput('xmake-version')) || 'latest'; version = (version !== null && version !== void 0 ? version : core.getInput('xmake-version')) || 'latest';
if (version.toLowerCase() === 'latest') if (version.toLowerCase() === 'latest')
@@ -71262,20 +71236,20 @@ async function selectVersion(version, _fallback = false) {
} }
// select branch // select branch
if (version.startsWith('branch@')) { if (version.startsWith('branch@')) {
const branch = version.substring('branch@'.length); const branch = version.substr('branch@'.length);
ret = await selectBranch(repo, branch); ret = await selectBranch(repo, branch);
} }
// select pr // select pr
if (version.startsWith('pr@')) { if (version.startsWith('pr@')) {
const pr = Number.parseInt(version.substring('pr@'.length)); const pr = Number.parseInt(version.substr('pr@'.length));
if (Number.isNaN(pr) || pr <= 0) { if (Number.isNaN(pr) || pr <= 0) {
throw new Error(`Invalid pull requrest ${version.substring('pr@'.length)}, should be a positive integer`); throw new Error(`Invalid pull requrest ${version.substr('pr@'.length)}, should be a positive integer`);
} }
ret = await selectPr(repo, pr); ret = await selectPr(repo, pr);
} }
// select sha // select sha
if (version.startsWith('sha@')) { if (version.startsWith('sha@')) {
const sha = version.substring('sha@'.length); const sha = version.substr('sha@'.length);
ret = await selectSha(repo, sha); ret = await selectSha(repo, sha);
} }
// select version // select version
@@ -71288,8 +71262,8 @@ async function selectVersion(version, _fallback = false) {
if (ret.type === 'local') { if (ret.type === 'local') {
core.info(`Use local xmake at '${ret.path}'`); core.info(`Use local xmake at '${ret.path}'`);
} }
else if (!_fallback) { else {
core.info(`Selected xmake ${String(ret)} (commit: ${ret.sha.substring(0, 8)})` + core.info(`Selected xmake ${String(ret)} (commit: ${ret.sha.substr(0, 8)})` +
(repo !== DEFAULT_REPO ? ` of ${repo}` : '')); (repo !== DEFAULT_REPO ? ` of ${repo}` : ''));
} }
return ret; return ret;
@@ -71315,21 +71289,16 @@ const fs = __nccwpck_require__(9896);
const path = __nccwpck_require__(6928); const path = __nccwpck_require__(6928);
const semver = __nccwpck_require__(2088); const semver = __nccwpck_require__(2088);
const git = __nccwpck_require__(1243); const git = __nccwpck_require__(1243);
const versions_1 = __nccwpck_require__(7902); function getInstallerUrl(version, latest) {
const system_1 = __nccwpck_require__(7666); let ver = version.version;
async function getInstallerUrl(version, _fallback = false) {
const latest = (await (0, versions_1.selectVersion)('latest', _fallback));
const latestVers = latest.version;
let vers = version.version;
let finalUrl;
switch (version.type) { switch (version.type) {
case 'heads': { case 'heads': {
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32'; const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
if (vers !== 'dev' && vers !== 'master') { const latestver = latest.version;
vers = latestVers; if (ver !== 'dev' && ver !== 'master') {
ver = latestver;
} }
finalUrl = `https://github.com/xmake-io/xmake/releases/download/${latestVers}/xmake-${vers}.${arch}.exe`; return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
break;
} }
case 'pull': { case 'pull': {
throw new Error('PR builds for windows is not supported'); throw new Error('PR builds for windows is not supported');
@@ -71339,10 +71308,9 @@ async function getInstallerUrl(version, _fallback = false) {
} }
case 'tags': { case 'tags': {
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32'; const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
finalUrl = semver.gt(vers, '2.2.6') return semver.gt(ver, '2.2.6')
? `https://github.com/xmake-io/xmake/releases/download/${vers}/xmake-${vers}.${arch}.exe` ? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
: `https://github.com/xmake-io/xmake/releases/download/${vers}/xmake-${vers}.exe`; : `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
break;
} }
default: { default: {
// check that we have tested all types // check that we have tested all types
@@ -71350,26 +71318,14 @@ async function getInstallerUrl(version, _fallback = false) {
throw new Error('Unknown version type'); throw new Error('Unknown version type');
} }
} }
// check if the URL returns 404. If so, xmake may have just released a
// new version, causing some binaries to be temporarily unavailable, so
// we need to fallback to the previous version.
if (!_fallback) {
const head = await fetch(finalUrl, { method: 'HEAD' });
if (head.status === 404) {
const currentVers = latestVers || vers;
const previousVersion = (await (0, versions_1.selectVersion)('<' + currentVers));
core.warning(`The requested version ${currentVers} (${finalUrl}) resource is temporarily unavailable, trying to fallback to the previous version...`);
return await getInstallerUrl(previousVersion, true);
}
}
return finalUrl;
} }
async function installFromSource(xmakeBin, sourceDir, binDir) { async function installFromSource(xmakeBin, sourceDir, binDir) {
await (0, exec_1.exec)(xmakeBin, ['-y'], { cwd: sourceDir }); await (0, exec_1.exec)(xmakeBin, ['-y'], { cwd: sourceDir });
await (0, exec_1.exec)(xmakeBin, ['install', '-o', binDir, 'cli'], { cwd: sourceDir }); await (0, exec_1.exec)(xmakeBin, ['install', '-o', binDir, 'cli'], { cwd: sourceDir });
} }
async function winInstall(version) { async function winInstall(version, latest) {
if (version.type === 'local') { var _a;
if (version.type === 'local' || latest.type === 'local') {
throw new Error('Local builds for windows is not supported'); throw new Error('Local builds for windows is not supported');
} }
const actionsCacheFolder = core.getInput('actions-cache-folder'); const actionsCacheFolder = core.getInput('actions-cache-folder');
@@ -71379,23 +71335,22 @@ async function winInstall(version) {
} }
const ver = version.version; const ver = version.version;
const sha = version.sha; const sha = version.sha;
const platformIdentifier = await (0, system_1.getPlatformIdentifier)(); const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${os.arch()}-${os.platform()}-${(_a = process.env.RUNNER_OS) !== null && _a !== void 0 ? _a : 'unknown'}`;
const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${platformIdentifier}`;
let toolDir = ''; let toolDir = '';
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) { if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
const fullCachePath = path.resolve(process.env.GITHUB_WORKSPACE, actionsCacheFolder); const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder);
try { try {
try { try {
fs.accessSync(path.join(fullCachePath, 'xmake.exe'), fs.constants.X_OK); fs.accessSync(path.join(fullCachePath, 'xmake.exe'), fs.constants.X_OK);
} }
catch (_a) { catch (_b) {
await cache.restoreCache([actionsCacheFolder], cacheKey); await cache.restoreCache([actionsCacheFolder], cacheKey);
} }
fs.accessSync(path.join(fullCachePath, 'xmake.exe'), fs.constants.X_OK); fs.accessSync(path.join(fullCachePath, 'xmake.exe'), fs.constants.X_OK);
toolDir = fullCachePath; toolDir = fullCachePath;
core.info(`cache path: ${toolDir}, key: ${cacheKey}`); core.info(`cache path: ${toolDir}, key: ${cacheKey}`);
} }
catch (_b) { catch (_c) {
core.warning(`No cached files found at path "${fullCachePath}".`); core.warning(`No cached files found at path "${fullCachePath}".`);
await io.rmRF(fullCachePath); await io.rmRF(fullCachePath);
} }
@@ -71405,7 +71360,7 @@ async function winInstall(version) {
} }
if (!toolDir) { if (!toolDir) {
const installer = await core.group(`download xmake ${String(version)}`, async () => { const installer = await core.group(`download xmake ${String(version)}`, async () => {
const url = await getInstallerUrl(version); const url = getInstallerUrl(version, latest);
core.info(`downloading from ${url}`); core.info(`downloading from ${url}`);
const file = await toolCache.downloadTool(url); const file = await toolCache.downloadTool(url);
const exe = path.format({ const exe = path.format({
@@ -71442,7 +71397,7 @@ async function winInstall(version) {
if (toolDir) { if (toolDir) {
let cacheDir = ''; let cacheDir = '';
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) { if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
cacheDir = path.resolve(process.env.GITHUB_WORKSPACE, actionsCacheFolder); cacheDir = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder);
await io.cp(toolDir, cacheDir, { await io.cp(toolDir, cacheDir, {
recursive: true, recursive: true,
}); });
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "github-action-setup-xmake", "name": "github-action-setup-xmake",
"version": "1.2.4", "version": "1.2.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "github-action-setup-xmake", "name": "github-action-setup-xmake",
"version": "1.2.4", "version": "1.2.1",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"dependencies": { "dependencies": {
"@actions/cache": "^4.0.3", "@actions/cache": "^4.0.3",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "github-action-setup-xmake", "name": "github-action-setup-xmake",
"version": "1.2.4", "version": "1.2.1",
"description": "Set up your GitHub Actions workflow with a specific version of xmake", "description": "Set up your GitHub Actions workflow with a specific version of xmake",
"main": "dist/index.js", "main": "dist/index.js",
"author": "OpportunityLiu", "author": "OpportunityLiu",
+5 -6
View File
@@ -2,9 +2,9 @@ import * as core from '@actions/core';
import { exec, ExecOptions } from '@actions/exec'; import { exec, ExecOptions } from '@actions/exec';
import * as io from '@actions/io'; import * as io from '@actions/io';
import * as cache from '@actions/cache'; import * as cache from '@actions/cache';
import * as os from 'os';
import * as path from 'path'; import * as path from 'path';
import * as fsutils from './fsutils'; import * as fsutils from './fsutils';
import { getPlatformIdentifier } from './system';
function getBuildTime(hours?: string): string { function getBuildTime(hours?: string): string {
let key = 'BuildTime'; let key = 'BuildTime';
@@ -38,7 +38,7 @@ function getProjectRootPath(): string {
return projectRootPath; return projectRootPath;
} }
async function getBuildCacheKey(buildCacheTime?: string): Promise<string> { function getBuildCacheKey(buildCacheTime?: string): string {
let buildCacheKey = core.getInput('build-cache-key'); let buildCacheKey = core.getInput('build-cache-key');
if (!buildCacheKey) { if (!buildCacheKey) {
buildCacheKey = ''; buildCacheKey = '';
@@ -46,8 +46,7 @@ async function getBuildCacheKey(buildCacheTime?: string): Promise<string> {
if (!buildCacheTime || buildCacheTime === '') { if (!buildCacheTime || buildCacheTime === '') {
buildCacheTime = getBuildTime(); buildCacheTime = getBuildTime();
} }
const platformIdentifier = await getPlatformIdentifier(); return `xmake-build-cache-${buildCacheKey}-${buildCacheTime}-${os.arch()}-${os.platform()}-${process.env.RUNNER_OS ?? 'unknown'}`;
return `xmake-build-cache-${buildCacheKey}-${buildCacheTime}-${platformIdentifier}`;
} }
async function getBuildCachePath(): Promise<string> { async function getBuildCachePath(): Promise<string> {
@@ -113,7 +112,7 @@ export async function loadBuildCache(): Promise<void> {
if (hours < 0) { if (hours < 0) {
break; break;
} }
const buildCacheKey = await getBuildCacheKey(getBuildTime(String(hours).padStart(2, '0'))); const buildCacheKey = getBuildCacheKey(getBuildTime(String(hours).padStart(2, '0')));
if (!fsutils.isFile(filepath)) { if (!fsutils.isFile(filepath)) {
core.info(`Restore build cache path: ${fullCachePath} to ${buildCachePath}, key: ${buildCacheKey}`); core.info(`Restore build cache path: ${fullCachePath} to ${buildCachePath}, key: ${buildCacheKey}`);
await cache.restoreCache([buildCacheFolder], buildCacheKey); await cache.restoreCache([buildCacheFolder], buildCacheKey);
@@ -148,7 +147,7 @@ export async function saveBuildCache(): Promise<void> {
} }
const buildCacheFolder = getBuildCacheFolder(); const buildCacheFolder = getBuildCacheFolder();
const buildCacheKey = await getBuildCacheKey(); const buildCacheKey = getBuildCacheKey();
const buildCachePath = await getBuildCachePath(); const buildCachePath = await getBuildCachePath();
const hitBuildCache = !!core.getState('hitBuildCache'); const hitBuildCache = !!core.getState('hitBuildCache');
+16 -31
View File
@@ -3,7 +3,6 @@ import * as io from '@actions/io';
import * as os from 'os'; import * as os from 'os';
import * as path from 'path'; import * as path from 'path';
import { Sha, RefDic, Repo } from './interfaces'; import { Sha, RefDic, Repo } from './interfaces';
import { valid as isValidSemver } from 'semver';
function makeOpt(ref: Sha): { cwd: string } { function makeOpt(ref: Sha): { cwd: string } {
return { cwd: path.join(os.tmpdir(), `xmake-git-${ref}`) }; return { cwd: path.join(os.tmpdir(), `xmake-git-${ref}`) };
@@ -21,38 +20,24 @@ export async function lsRemote(repo: Repo): Promise<RefDic> {
}); });
const data: RefDic = { heads: {}, tags: {}, pull: {} }; const data: RefDic = { heads: {}, tags: {}, pull: {} };
out.split('\n').forEach((line) => { out.split('\n').forEach((line) => {
const [ref, path] = line.trim().split('\t') as [Sha, string]; const [ref, tag] = line.trim().split('\t');
if (ref && path?.startsWith('refs/')) { if (ref && tag?.startsWith('refs/')) {
const tagPath = path.split('/').splice(1); const tagPath = tag.split('/').splice(1);
switch (tagPath[0]) { // eslint-disable-next-line @typescript-eslint/no-explicit-any
case 'heads': { let ldata = data as any; // eslint-disable-line @typescript-eslint/no-unsafe-assignment
// refs/heads/copilot/fix-6807 for (let i = 0; i < tagPath.length - 1; i++) {
const head = tagPath.slice(1).join('/'); const seg = tagPath[i];
data.heads[head] = ref; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
break; if (typeof ldata[seg] === 'object') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ldata = ldata[seg]; // eslint-disable-line @typescript-eslint/no-unsafe-assignment
} else {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ldata = ldata[seg] = {};
} }
case 'pull': {
// refs/pull/11/head
// refs/pull/11/merge
const pr = Number(tagPath[1]);
if (!data.pull[pr]) {
data.pull[pr] = {} as RefDic['pull'][number];
}
data.pull[pr][tagPath[2] as 'head' | 'merge'] = ref;
break;
}
case 'tags': {
// refs/tags/preview
// refs/tags/v3.0.3
const tag = tagPath.slice(1).join('/');
if (isValidSemver(tag)) {
data.tags[tag] = ref;
}
break;
}
default:
break;
} }
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ldata[tagPath[tagPath.length - 1]] = ref;
} }
}); });
return data; return data;
+2 -1
View File
@@ -7,7 +7,8 @@ import { unixInstall } from './unix-install';
export async function installXmake(): Promise<void> { export async function installXmake(): Promise<void> {
const version = await selectVersion(); const version = await selectVersion();
if (os.platform() === 'win32' || os.platform() === 'cygwin') { if (os.platform() === 'win32' || os.platform() === 'cygwin') {
await winInstall(version); const latest = await selectVersion('latest');
await winInstall(version, latest);
} else { } else {
await unixInstall(version); await unixInstall(version);
} }
+2 -3
View File
@@ -2,9 +2,9 @@ import * as core from '@actions/core';
import { exec, ExecOptions } from '@actions/exec'; import { exec, ExecOptions } from '@actions/exec';
import * as io from '@actions/io'; import * as io from '@actions/io';
import * as cache from '@actions/cache'; import * as cache from '@actions/cache';
import * as os from 'os';
import * as path from 'path'; import * as path from 'path';
import * as fsutils from './fsutils'; import * as fsutils from './fsutils';
import { getPlatformIdentifier } from './system';
function getProjectRootPath(): string { function getProjectRootPath(): string {
let projectRootPath = core.getInput('project-path'); let projectRootPath = core.getInput('project-path');
@@ -41,8 +41,7 @@ async function getPackageCacheKey(): Promise<string> {
await exec('xmake', ['l', 'utils.ci.packageskey'], options); await exec('xmake', ['l', 'utils.ci.packageskey'], options);
packageCacheHash = packageCacheHash.trim(); packageCacheHash = packageCacheHash.trim();
} }
const platformIdentifier = await getPlatformIdentifier(); return `xmake-package-cache-${packageCacheKey}-${packageCacheHash}-${os.arch()}-${os.platform()}-${process.env.RUNNER_OS ?? 'unknown'}`;
return `xmake-package-cache-${packageCacheKey}-${packageCacheHash}-${platformIdentifier}`;
} }
async function getPackageCachePath(): Promise<string> { async function getPackageCachePath(): Promise<string> {
-28
View File
@@ -1,28 +0,0 @@
import * as core from '@actions/core';
import { exec } from '@actions/exec';
import * as os from 'os';
export async function getPlatformIdentifier(): Promise<string> {
let identifier = `${os.platform()}-${os.arch()}-${process.env.RUNNER_OS ?? 'unknown'}`;
if (os.platform() === 'darwin') {
let productVersion = '';
try {
await exec('sw_vers', ['-productVersion'], {
silent: true,
listeners: {
stdout: (data: Buffer) => {
productVersion = data.toString().trim();
},
},
});
if (productVersion) {
identifier += `-${productVersion}`;
}
} catch (error: unknown) {
core.warning(
`Failed to get macOS product version: ${error instanceof Error ? error.message : String(error)}`,
);
}
}
return identifier;
}
+31 -4
View File
@@ -9,12 +9,36 @@ import * as path from 'path';
import * as semver from 'semver'; import * as semver from 'semver';
import * as git from './git'; import * as git from './git';
import { Version } from './interfaces'; import { Version } from './interfaces';
import { getPlatformIdentifier } from './system';
async function getPlatformIdentifier(): Promise<string> {
let identifier = `${os.platform()}-${os.arch()}-${process.env.RUNNER_OS ?? 'unknown'}`;
if (os.platform() === 'darwin') {
let productVersion = '';
try {
await exec('sw_vers', ['-productVersion'], {
silent: true,
listeners: {
stdout: (data: Buffer) => {
productVersion = data.toString().trim();
},
},
});
if (productVersion) {
identifier += `-${productVersion}`;
}
} catch (error: unknown) {
core.warning(
`Failed to get macOS product version: ${error instanceof Error ? error.message : String(error)}`,
);
}
}
return identifier;
}
async function install(sourceDir: string, binDir: string): Promise<void> { async function install(sourceDir: string, binDir: string): Promise<void> {
if (fs.existsSync(path.join(sourceDir, 'configure'))) { if (fs.existsSync(path.join(sourceDir, 'configure'))) {
await exec('sh', ['./configure'], { cwd: sourceDir }); await exec('sh', ['./configure'], { cwd: sourceDir });
await exec('make', ['-j6'], { cwd: sourceDir }); await exec('make', ['-j6', 'VERBOSE=1'], { cwd: sourceDir });
await exec('make', ['install', `PREFIX=${binDir}`], { cwd: sourceDir }); await exec('make', ['install', `PREFIX=${binDir}`], { cwd: sourceDir });
} else { } else {
await exec('make', ['-j6'], { cwd: sourceDir }); await exec('make', ['-j6'], { cwd: sourceDir });
@@ -37,7 +61,7 @@ export async function unixInstall(version: Version): Promise<void> {
const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${platformIdentifier}`; const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${platformIdentifier}`;
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) { if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
const fullCachePath = path.resolve(process.env.GITHUB_WORKSPACE, actionsCacheFolder); const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder);
try { try {
try { try {
fs.accessSync(path.join(fullCachePath, 'bin', 'xmake'), fs.constants.X_OK); fs.accessSync(path.join(fullCachePath, 'bin', 'xmake'), fs.constants.X_OK);
@@ -65,7 +89,7 @@ export async function unixInstall(version: Version): Promise<void> {
let cacheDir = ''; let cacheDir = '';
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) { if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
cacheDir = path.resolve(process.env.GITHUB_WORKSPACE, actionsCacheFolder); cacheDir = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder);
await io.cp(binDir, cacheDir, { await io.cp(binDir, cacheDir, {
recursive: true, recursive: true,
}); });
@@ -92,4 +116,7 @@ export async function unixInstall(version: Version): Promise<void> {
} else { } else {
core.addPath(path.join(toolDir, 'share', 'xmake')); // only for <= 2.3.1 core.addPath(path.join(toolDir, 'share', 'xmake')); // only for <= 2.3.1
} }
// xmake l utils.binary.deplibs /Users/ruki/.local/bin/xmake
await exec(`xmake l --root utils.binary.deplibs ${path.join(toolDir, 'bin', 'xmake')}`);
} }
+8 -8
View File
@@ -96,11 +96,11 @@ async function selectSha(repo: Repo, sha: string): Promise<Version> {
} }
} }
return Promise.resolve( return Promise.resolve(
new GitVersionImpl(repo, `sha#${shaValue}`, shaValue, 'sha', `commit ${shaValue.substring(0, 8)}`), new GitVersionImpl(repo, `sha#${shaValue}`, shaValue, 'sha', `commit ${shaValue.substr(0, 8)}`),
); );
} }
export async function selectVersion(version?: string, _fallback: boolean = false): Promise<Version> { export async function selectVersion(version?: string): Promise<Version> {
// get version string // get version string
version = (version ?? core.getInput('xmake-version')) || 'latest'; version = (version ?? core.getInput('xmake-version')) || 'latest';
if (version.toLowerCase() === 'latest') version = ''; if (version.toLowerCase() === 'latest') version = '';
@@ -123,20 +123,20 @@ export async function selectVersion(version?: string, _fallback: boolean = false
// select branch // select branch
if (version.startsWith('branch@')) { if (version.startsWith('branch@')) {
const branch = version.substring('branch@'.length); const branch = version.substr('branch@'.length);
ret = await selectBranch(repo, branch); ret = await selectBranch(repo, branch);
} }
// select pr // select pr
if (version.startsWith('pr@')) { if (version.startsWith('pr@')) {
const pr = Number.parseInt(version.substring('pr@'.length)); const pr = Number.parseInt(version.substr('pr@'.length));
if (Number.isNaN(pr) || pr <= 0) { if (Number.isNaN(pr) || pr <= 0) {
throw new Error(`Invalid pull requrest ${version.substring('pr@'.length)}, should be a positive integer`); throw new Error(`Invalid pull requrest ${version.substr('pr@'.length)}, should be a positive integer`);
} }
ret = await selectPr(repo, pr); ret = await selectPr(repo, pr);
} }
// select sha // select sha
if (version.startsWith('sha@')) { if (version.startsWith('sha@')) {
const sha = version.substring('sha@'.length); const sha = version.substr('sha@'.length);
ret = await selectSha(repo, sha); ret = await selectSha(repo, sha);
} }
// select version // select version
@@ -148,9 +148,9 @@ export async function selectVersion(version?: string, _fallback: boolean = false
} }
if (ret.type === 'local') { if (ret.type === 'local') {
core.info(`Use local xmake at '${ret.path}'`); core.info(`Use local xmake at '${ret.path}'`);
} else if (!_fallback) { } else {
core.info( core.info(
`Selected xmake ${String(ret)} (commit: ${ret.sha.substring(0, 8)})` + `Selected xmake ${String(ret)} (commit: ${ret.sha.substr(0, 8)})` +
(repo !== DEFAULT_REPO ? ` of ${repo}` : ''), (repo !== DEFAULT_REPO ? ` of ${repo}` : ''),
); );
} }
+17 -37
View File
@@ -9,22 +9,17 @@ import * as path from 'path';
import * as semver from 'semver'; import * as semver from 'semver';
import * as git from './git'; import * as git from './git';
import { Version, GitVersion } from './interfaces'; import { Version, GitVersion } from './interfaces';
import { selectVersion } from './versions';
import { getPlatformIdentifier } from './system';
async function getInstallerUrl(version: GitVersion, _fallback: boolean = false): Promise<string> { function getInstallerUrl(version: GitVersion, latest: GitVersion): string {
const latest = (await selectVersion('latest', _fallback)) as GitVersion; let ver = version.version;
const latestVers = latest.version;
let vers = version.version;
let finalUrl: string;
switch (version.type) { switch (version.type) {
case 'heads': { case 'heads': {
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32'; const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
if (vers !== 'dev' && vers !== 'master') { const latestver = latest.version;
vers = latestVers; if (ver !== 'dev' && ver !== 'master') {
ver = latestver;
} }
finalUrl = `https://github.com/xmake-io/xmake/releases/download/${latestVers}/xmake-${vers}.${arch}.exe`; return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
break;
} }
case 'pull': { case 'pull': {
throw new Error('PR builds for windows is not supported'); throw new Error('PR builds for windows is not supported');
@@ -34,10 +29,9 @@ async function getInstallerUrl(version: GitVersion, _fallback: boolean = false):
} }
case 'tags': { case 'tags': {
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32'; const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
finalUrl = semver.gt(vers, '2.2.6') return semver.gt(ver, '2.2.6')
? `https://github.com/xmake-io/xmake/releases/download/${vers}/xmake-${vers}.${arch}.exe` ? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
: `https://github.com/xmake-io/xmake/releases/download/${vers}/xmake-${vers}.exe`; : `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
break;
} }
default: { default: {
// check that we have tested all types // check that we have tested all types
@@ -45,21 +39,6 @@ async function getInstallerUrl(version: GitVersion, _fallback: boolean = false):
throw new Error('Unknown version type'); throw new Error('Unknown version type');
} }
} }
// check if the URL returns 404. If so, xmake may have just released a
// new version, causing some binaries to be temporarily unavailable, so
// we need to fallback to the previous version.
if (!_fallback) {
const head = await fetch(finalUrl, { method: 'HEAD' });
if (head.status === 404) {
const currentVers = latestVers || vers;
const previousVersion = (await selectVersion('<' + currentVers)) as GitVersion;
core.warning(
`The requested version ${currentVers} (${finalUrl}) resource is temporarily unavailable, trying to fallback to the previous version...`,
);
return await getInstallerUrl(previousVersion, true);
}
}
return finalUrl;
} }
async function installFromSource(xmakeBin: string, sourceDir: string, binDir: string): Promise<void> { async function installFromSource(xmakeBin: string, sourceDir: string, binDir: string): Promise<void> {
@@ -67,8 +46,8 @@ async function installFromSource(xmakeBin: string, sourceDir: string, binDir: st
await exec(xmakeBin, ['install', '-o', binDir, 'cli'], { cwd: sourceDir }); await exec(xmakeBin, ['install', '-o', binDir, 'cli'], { cwd: sourceDir });
} }
export async function winInstall(version: Version): Promise<void> { export async function winInstall(version: Version, latest: Version): Promise<void> {
if (version.type === 'local') { if (version.type === 'local' || latest.type === 'local') {
throw new Error('Local builds for windows is not supported'); throw new Error('Local builds for windows is not supported');
} }
@@ -80,12 +59,13 @@ export async function winInstall(version: Version): Promise<void> {
const ver = version.version; const ver = version.version;
const sha = version.sha; const sha = version.sha;
const platformIdentifier = await getPlatformIdentifier(); const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${os.arch()}-${os.platform()}-${
const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${platformIdentifier}`; process.env.RUNNER_OS ?? 'unknown'
}`;
let toolDir = ''; let toolDir = '';
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) { if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
const fullCachePath = path.resolve(process.env.GITHUB_WORKSPACE, actionsCacheFolder); const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder);
try { try {
try { try {
fs.accessSync(path.join(fullCachePath, 'xmake.exe'), fs.constants.X_OK); fs.accessSync(path.join(fullCachePath, 'xmake.exe'), fs.constants.X_OK);
@@ -105,7 +85,7 @@ export async function winInstall(version: Version): Promise<void> {
if (!toolDir) { if (!toolDir) {
const installer = await core.group(`download xmake ${String(version)}`, async () => { const installer = await core.group(`download xmake ${String(version)}`, async () => {
const url = await getInstallerUrl(version); const url = getInstallerUrl(version, latest);
core.info(`downloading from ${url}`); core.info(`downloading from ${url}`);
const file = await toolCache.downloadTool(url); const file = await toolCache.downloadTool(url);
const exe = path.format({ const exe = path.format({
@@ -146,7 +126,7 @@ export async function winInstall(version: Version): Promise<void> {
if (toolDir) { if (toolDir) {
let cacheDir = ''; let cacheDir = '';
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) { if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
cacheDir = path.resolve(process.env.GITHUB_WORKSPACE, actionsCacheFolder); cacheDir = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder);
await io.cp(toolDir, cacheDir, { await io.cp(toolDir, cacheDir, {
recursive: true, recursive: true,
}); });