Compare commits
41 Commits
@@ -11,21 +11,27 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
os: [ubuntu-latest, windows-latest, windows-11-arm, macOS-latest]
|
||||||
version: [latest, branch@master, branch@dev]
|
version: [latest, branch@master, branch@dev]
|
||||||
|
|
||||||
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@test
|
- uses: xmake-io/github-action-setup-xmake@master
|
||||||
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 }}
|
||||||
|
build-cache: true
|
||||||
|
build-cache-key: ${{ matrix.version }}
|
||||||
|
package-cache: true
|
||||||
|
package-cache-key: ${{ matrix.version }}
|
||||||
|
project-path: 'tests/sample'
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
xmake --version
|
xmake --version
|
||||||
xmake create -P test
|
cd tests/sample
|
||||||
xmake build -P test
|
xmake -y -vD
|
||||||
xmake run -P test
|
xmake run
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ See [action.yml](./action.yml).
|
|||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
Use latest version:
|
### Use latest version
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
uses: xmake-io/github-action-setup-xmake@v1
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
@@ -19,7 +19,7 @@ with:
|
|||||||
xmake-version: latest
|
xmake-version: latest
|
||||||
```
|
```
|
||||||
|
|
||||||
Use specified version:
|
### Use specified version
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
uses: xmake-io/github-action-setup-xmake@v1
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
@@ -27,7 +27,7 @@ with:
|
|||||||
xmake-version: '2.5.3'
|
xmake-version: '2.5.3'
|
||||||
```
|
```
|
||||||
|
|
||||||
Use specified branch:
|
### Use specified branch
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
uses: xmake-io/github-action-setup-xmake@v1
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
@@ -35,7 +35,7 @@ with:
|
|||||||
xmake-version: branch@master
|
xmake-version: branch@master
|
||||||
```
|
```
|
||||||
|
|
||||||
Use semver:
|
### Use semver
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
uses: xmake-io/github-action-setup-xmake@v1
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
@@ -43,25 +43,74 @@ with:
|
|||||||
xmake-version: '>=2.2.6 <=2.5.3'
|
xmake-version: '>=2.2.6 <=2.5.3'
|
||||||
```
|
```
|
||||||
|
|
||||||
Use action cache:
|
### Cache xmake
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
uses: xmake-io/github-action-setup-xmake@v1
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
with:
|
with:
|
||||||
xmake-version: '2.7.2'
|
xmake-version: '2.9.7'
|
||||||
actions-cache-folder: '.xmake-cache'
|
actions-cache-folder: '.xmake-cache'
|
||||||
```
|
```
|
||||||
|
|
||||||
Use action cache with cachekey:
|
### Cache xmake with cachekey
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
uses: xmake-io/github-action-setup-xmake@v1
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
with:
|
with:
|
||||||
xmake-version: '2.7.2'
|
xmake-version: '2.9.7'
|
||||||
actions-cache-folder: '.xmake-cache'
|
actions-cache-folder: '.xmake-cache'
|
||||||
actions-cache-key: 'archlinux-ci'
|
actions-cache-key: 'archlinux-ci'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Cache packages
|
||||||
|
|
||||||
|
```yml
|
||||||
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
|
with:
|
||||||
|
xmake-version: '2.9.7'
|
||||||
|
package-cache: true
|
||||||
|
package-cache-key: 'archlinux-ci'
|
||||||
|
project-path: 'myproject' # we need to compute packages hashkey for project
|
||||||
|
```
|
||||||
|
|
||||||
|
### Cache build
|
||||||
|
|
||||||
|
By default, xmake disables build cache when building on ci, so we need to enable it first.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ xmake f --policies=build.ccache:y
|
||||||
|
```
|
||||||
|
|
||||||
|
And xmake v2.9.8 will enable it by default if action/build-cache is enabled.
|
||||||
|
|
||||||
|
```yml
|
||||||
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
|
with:
|
||||||
|
xmake-version: '2.9.7'
|
||||||
|
build-cache: true
|
||||||
|
build-cache-key: 'archlinux-ci'
|
||||||
|
```
|
||||||
|
|
||||||
|
Cache build with the specific project path.
|
||||||
|
|
||||||
|
```yml
|
||||||
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
|
with:
|
||||||
|
xmake-version: '2.9.7'
|
||||||
|
build-cache: true
|
||||||
|
project-path: 'myproject' # we can get the build cache path from project.
|
||||||
|
```
|
||||||
|
|
||||||
|
Cache build with the specific build path.
|
||||||
|
|
||||||
|
```yml
|
||||||
|
uses: xmake-io/github-action-setup-xmake@v1
|
||||||
|
with:
|
||||||
|
xmake-version: '2.9.7'
|
||||||
|
build-cache: true
|
||||||
|
build-cache-path: 'build/.build_cache'
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
### Prepare development environment
|
### Prepare development environment
|
||||||
|
|||||||
+20
@@ -16,6 +16,26 @@ inputs:
|
|||||||
actions-cache-key:
|
actions-cache-key:
|
||||||
description: The actions cache key.
|
description: The actions cache key.
|
||||||
default: ''
|
default: ''
|
||||||
|
package-cache:
|
||||||
|
description: Enable package cache.
|
||||||
|
default: false
|
||||||
|
package-cache-key:
|
||||||
|
description: The packages cache key.
|
||||||
|
default: ''
|
||||||
|
project-path:
|
||||||
|
description: The project root path.
|
||||||
|
default: ''
|
||||||
|
build-cache:
|
||||||
|
description: Enable build cache.
|
||||||
|
default: false
|
||||||
|
build-cache-path:
|
||||||
|
description: The build cache path.
|
||||||
|
default: ''
|
||||||
|
build-cache-key:
|
||||||
|
description: The build cache key.
|
||||||
|
default: ''
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
post: 'dist/index.js'
|
||||||
|
|||||||
Vendored
+416
-18
@@ -82448,6 +82448,208 @@ try {
|
|||||||
} catch (er) {}
|
} catch (er) {}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 53:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.saveBuildCache = exports.loadBuildCache = void 0;
|
||||||
|
const core = __nccwpck_require__(9093);
|
||||||
|
const exec_1 = __nccwpck_require__(7775);
|
||||||
|
const io = __nccwpck_require__(2826);
|
||||||
|
const cache = __nccwpck_require__(6878);
|
||||||
|
const os = __nccwpck_require__(2037);
|
||||||
|
const path = __nccwpck_require__(1017);
|
||||||
|
const fsutils = __nccwpck_require__(4295);
|
||||||
|
function getBuildTime(hours) {
|
||||||
|
let key = 'BuildTime';
|
||||||
|
if (hours && hours !== '') {
|
||||||
|
key = key + hours;
|
||||||
|
}
|
||||||
|
let buildTime = core.getState(key);
|
||||||
|
if (!buildTime || buildTime === '') {
|
||||||
|
const now = new Date();
|
||||||
|
const year = now.getFullYear();
|
||||||
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(now.getDate()).padStart(2, '0');
|
||||||
|
if (!hours || hours === '') {
|
||||||
|
hours = String(now.getHours()).padStart(2, '0');
|
||||||
|
}
|
||||||
|
buildTime = `${year}${month}${day}_${hours}`;
|
||||||
|
core.saveState(key, buildTime);
|
||||||
|
}
|
||||||
|
return buildTime;
|
||||||
|
}
|
||||||
|
function getProjectRootPath() {
|
||||||
|
let projectRootPath = core.getInput('project-path');
|
||||||
|
if (!projectRootPath) {
|
||||||
|
projectRootPath = process.cwd();
|
||||||
|
}
|
||||||
|
projectRootPath = projectRootPath.trim();
|
||||||
|
if (projectRootPath && projectRootPath !== '' && !path.isAbsolute(projectRootPath)) {
|
||||||
|
projectRootPath = path.join(process.cwd(), projectRootPath);
|
||||||
|
}
|
||||||
|
return projectRootPath;
|
||||||
|
}
|
||||||
|
function getBuildCacheKey(buildCacheTime) {
|
||||||
|
var _a;
|
||||||
|
let buildCacheKey = core.getInput('build-cache-key');
|
||||||
|
if (!buildCacheKey) {
|
||||||
|
buildCacheKey = '';
|
||||||
|
}
|
||||||
|
if (!buildCacheTime || buildCacheTime === '') {
|
||||||
|
buildCacheTime = getBuildTime();
|
||||||
|
}
|
||||||
|
return `xmake-build-cache-${buildCacheKey}-${buildCacheTime}-${os.arch()}-${os.platform()}-${(_a = process.env.RUNNER_OS) !== null && _a !== void 0 ? _a : 'unknown'}`;
|
||||||
|
}
|
||||||
|
async function getBuildCachePath() {
|
||||||
|
let buildCachePath = core.getInput('build-cache-path');
|
||||||
|
if (!buildCachePath) {
|
||||||
|
buildCachePath = '';
|
||||||
|
const projectRootPath = getProjectRootPath();
|
||||||
|
if (projectRootPath && projectRootPath !== '' && fsutils.isDir(projectRootPath)) {
|
||||||
|
const options = {};
|
||||||
|
options.env = {
|
||||||
|
...process.env,
|
||||||
|
XMAKE_ROOT: 'y',
|
||||||
|
};
|
||||||
|
options.cwd = projectRootPath;
|
||||||
|
options.listeners = {
|
||||||
|
stdout: (data) => {
|
||||||
|
buildCachePath += data.toString();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await (0, exec_1.exec)('xmake', [
|
||||||
|
'l',
|
||||||
|
'-c',
|
||||||
|
'import("core.project.config"); import("private.cache.build_cache"); config.load(); print(build_cache.rootdir())',
|
||||||
|
], options);
|
||||||
|
buildCachePath = buildCachePath.trim();
|
||||||
|
if (buildCachePath !== '' && !path.isAbsolute(buildCachePath)) {
|
||||||
|
buildCachePath = path.join(projectRootPath, buildCachePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
buildCachePath = 'build/.build_cache';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buildCachePath;
|
||||||
|
}
|
||||||
|
function getBuildCacheFolder() {
|
||||||
|
return '.xmake-build-cache';
|
||||||
|
}
|
||||||
|
async function loadBuildCache() {
|
||||||
|
const buildCache = core.getBooleanInput('build-cache');
|
||||||
|
if (!buildCache) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// export $XMAKE_ACTION_BUILD_CACHE, xmake will check it and enable build cache by default on ci.
|
||||||
|
core.exportVariable('XMAKE_ACTION_BUILD_CACHE', 'true');
|
||||||
|
const buildCacheFolder = getBuildCacheFolder();
|
||||||
|
const buildCachePath = await getBuildCachePath();
|
||||||
|
if (buildCacheFolder && process.env.GITHUB_WORKSPACE) {
|
||||||
|
const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, buildCacheFolder);
|
||||||
|
const filepath = path.join(fullCachePath, 'build_cache_saved.txt');
|
||||||
|
// Since action/cache cannot overwrite updates, we try to restore the cache from the last 24 hours.
|
||||||
|
const now = new Date();
|
||||||
|
for (let i = 0; i < 24; i++) {
|
||||||
|
const hours = now.getHours() - i;
|
||||||
|
if (hours < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const buildCacheKey = getBuildCacheKey(getBuildTime(String(hours).padStart(2, '0')));
|
||||||
|
if (!fsutils.isFile(filepath)) {
|
||||||
|
core.info(`Restore build cache path: ${fullCachePath} to ${buildCachePath}, key: ${buildCacheKey}`);
|
||||||
|
await cache.restoreCache([buildCacheFolder], buildCacheKey);
|
||||||
|
}
|
||||||
|
if (fsutils.isFile(filepath)) {
|
||||||
|
if (fsutils.isDir(buildCachePath)) {
|
||||||
|
await io.rmRF(buildCachePath);
|
||||||
|
}
|
||||||
|
await io.cp(fullCachePath, buildCachePath, {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
|
/* Even if the historical cache is hit, we need to update to the latest cache
|
||||||
|
* Therefore, only when the latest cache is hit, it is a real hit, and we no longer need to update the cache.
|
||||||
|
*/
|
||||||
|
if (i === 0) {
|
||||||
|
core.saveState('hitBuildCache', 'true');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!fsutils.isFile(filepath)) {
|
||||||
|
core.warning(`No cached files found at path "${fullCachePath}".`);
|
||||||
|
await io.rmRF(fullCachePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.loadBuildCache = loadBuildCache;
|
||||||
|
async function saveBuildCache() {
|
||||||
|
const buildCache = core.getBooleanInput('build-cache');
|
||||||
|
if (!buildCache) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const buildCacheFolder = getBuildCacheFolder();
|
||||||
|
const buildCacheKey = getBuildCacheKey();
|
||||||
|
const buildCachePath = await getBuildCachePath();
|
||||||
|
const hitBuildCache = !!core.getState('hitBuildCache');
|
||||||
|
if (!hitBuildCache && buildCacheFolder && process.env.GITHUB_WORKSPACE && fsutils.isDir(buildCachePath)) {
|
||||||
|
const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, buildCacheFolder);
|
||||||
|
core.info(`Save build cache path: ${buildCachePath} to ${fullCachePath}, key: ${buildCacheKey}`);
|
||||||
|
await io.cp(buildCachePath, fullCachePath, {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
|
const options = {};
|
||||||
|
options.env = {
|
||||||
|
...process.env,
|
||||||
|
XMAKE_ROOT: 'y',
|
||||||
|
};
|
||||||
|
await (0, exec_1.exec)('xmake', ['l', 'os.touch', path.join(fullCachePath, 'build_cache_saved.txt')], options);
|
||||||
|
await cache.saveCache([buildCacheFolder], buildCacheKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.saveBuildCache = saveBuildCache;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 4295:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.isDir = exports.isFile = void 0;
|
||||||
|
const fs = __nccwpck_require__(7147);
|
||||||
|
function isFile(filepath) {
|
||||||
|
try {
|
||||||
|
fs.accessSync(filepath, fs.constants.F_OK);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.isFile = isFile;
|
||||||
|
function isDir(filepath) {
|
||||||
|
try {
|
||||||
|
const stats = fs.statSync(filepath);
|
||||||
|
if (stats.isDirectory()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.isDir = isDir;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 3555:
|
/***/ 3555:
|
||||||
@@ -82518,6 +82720,34 @@ async function cleanup(ref) {
|
|||||||
exports.cleanup = cleanup;
|
exports.cleanup = cleanup;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 6633:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.installXmake = void 0;
|
||||||
|
const exec_1 = __nccwpck_require__(7775);
|
||||||
|
const os = __nccwpck_require__(2037);
|
||||||
|
const versions_1 = __nccwpck_require__(406);
|
||||||
|
const win_install_1 = __nccwpck_require__(1612);
|
||||||
|
const unix_install_1 = __nccwpck_require__(6689);
|
||||||
|
async function installXmake() {
|
||||||
|
const version = await (0, versions_1.selectVersion)();
|
||||||
|
if (os.platform() === 'win32' || os.platform() === 'cygwin') {
|
||||||
|
const latest = await (0, versions_1.selectVersion)('latest');
|
||||||
|
await (0, win_install_1.winInstall)(version, latest);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await (0, unix_install_1.unixInstall)(version);
|
||||||
|
}
|
||||||
|
await (0, exec_1.exec)('xmake --root --version');
|
||||||
|
}
|
||||||
|
exports.installXmake = installXmake;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 841:
|
/***/ 841:
|
||||||
@@ -82543,6 +82773,163 @@ function Repo(repo) {
|
|||||||
exports.Repo = Repo;
|
exports.Repo = Repo;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 8884:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.savePackageCache = exports.loadPackageCache = void 0;
|
||||||
|
const core = __nccwpck_require__(9093);
|
||||||
|
const exec_1 = __nccwpck_require__(7775);
|
||||||
|
const io = __nccwpck_require__(2826);
|
||||||
|
const cache = __nccwpck_require__(6878);
|
||||||
|
const os = __nccwpck_require__(2037);
|
||||||
|
const path = __nccwpck_require__(1017);
|
||||||
|
const fsutils = __nccwpck_require__(4295);
|
||||||
|
function getProjectRootPath() {
|
||||||
|
let projectRootPath = core.getInput('project-path');
|
||||||
|
if (!projectRootPath) {
|
||||||
|
projectRootPath = process.cwd();
|
||||||
|
}
|
||||||
|
projectRootPath = projectRootPath.trim();
|
||||||
|
if (projectRootPath && projectRootPath !== '' && !path.isAbsolute(projectRootPath)) {
|
||||||
|
projectRootPath = path.join(process.cwd(), projectRootPath);
|
||||||
|
}
|
||||||
|
return projectRootPath;
|
||||||
|
}
|
||||||
|
async function getPackageCacheKey() {
|
||||||
|
var _a;
|
||||||
|
let packageCacheKey = core.getInput('package-cache-key');
|
||||||
|
if (!packageCacheKey) {
|
||||||
|
packageCacheKey = '';
|
||||||
|
}
|
||||||
|
let packageCacheHash = '';
|
||||||
|
const projectRootPath = getProjectRootPath();
|
||||||
|
if (projectRootPath && projectRootPath !== '' && fsutils.isDir(projectRootPath)) {
|
||||||
|
const options = {};
|
||||||
|
options.env = {
|
||||||
|
...process.env,
|
||||||
|
XMAKE_ROOT: 'y',
|
||||||
|
};
|
||||||
|
options.cwd = projectRootPath;
|
||||||
|
options.listeners = {
|
||||||
|
stdout: (data) => {
|
||||||
|
packageCacheHash += data.toString();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await (0, exec_1.exec)('xmake', ['repo', '--update']);
|
||||||
|
await (0, exec_1.exec)('xmake', ['l', 'utils.ci.packageskey'], options);
|
||||||
|
packageCacheHash = packageCacheHash.trim();
|
||||||
|
}
|
||||||
|
return `xmake-package-cache-${packageCacheKey}-${packageCacheHash}-${os.arch()}-${os.platform()}-${(_a = process.env.RUNNER_OS) !== null && _a !== void 0 ? _a : 'unknown'}`;
|
||||||
|
}
|
||||||
|
async function getPackageCachePath() {
|
||||||
|
let packageCachePath = '';
|
||||||
|
const options = {};
|
||||||
|
options.env = {
|
||||||
|
...process.env,
|
||||||
|
XMAKE_ROOT: 'y',
|
||||||
|
};
|
||||||
|
options.listeners = {
|
||||||
|
stdout: (data) => {
|
||||||
|
packageCachePath += data.toString();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await (0, exec_1.exec)('xmake', ['l', '-c', 'import("core.package.package"); print(package.installdir())'], options);
|
||||||
|
packageCachePath = packageCachePath.trim();
|
||||||
|
return packageCachePath;
|
||||||
|
}
|
||||||
|
function getPackageCacheFolder() {
|
||||||
|
return '.xmake-package-cache';
|
||||||
|
}
|
||||||
|
async function loadPackageCache() {
|
||||||
|
const packageCache = core.getBooleanInput('package-cache');
|
||||||
|
if (!packageCache) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const packageCacheFolder = getPackageCacheFolder();
|
||||||
|
const packageCacheKey = await getPackageCacheKey();
|
||||||
|
const packageCachePath = await getPackageCachePath();
|
||||||
|
if (!packageCachePath || packageCachePath === '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (packageCacheFolder && process.env.GITHUB_WORKSPACE) {
|
||||||
|
const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, packageCacheFolder);
|
||||||
|
const filepath = path.join(fullCachePath, 'package_cache_saved.txt');
|
||||||
|
if (!fsutils.isFile(filepath)) {
|
||||||
|
core.info(`Restore package cache path: ${fullCachePath} to ${packageCachePath}, key: ${packageCacheKey}`);
|
||||||
|
await cache.restoreCache([packageCacheFolder], packageCacheKey);
|
||||||
|
}
|
||||||
|
if (fsutils.isFile(filepath)) {
|
||||||
|
if (fsutils.isDir(packageCachePath)) {
|
||||||
|
await io.rmRF(packageCachePath);
|
||||||
|
}
|
||||||
|
await io.cp(fullCachePath, packageCachePath, {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
|
core.saveState('hitPackageCache', 'true');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.warning(`No cached files found at path "${fullCachePath}".`);
|
||||||
|
await io.rmRF(fullCachePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.loadPackageCache = loadPackageCache;
|
||||||
|
async function savePackageCache() {
|
||||||
|
const packageCache = core.getBooleanInput('package-cache');
|
||||||
|
if (!packageCache) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const packageCacheFolder = getPackageCacheFolder();
|
||||||
|
const packageCacheKey = await getPackageCacheKey();
|
||||||
|
const packageCachePath = await getPackageCachePath();
|
||||||
|
if (!packageCachePath || packageCachePath === '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const hitPackageCache = !!core.getState('hitPackageCache');
|
||||||
|
if (!hitPackageCache && packageCacheFolder && process.env.GITHUB_WORKSPACE && fsutils.isDir(packageCachePath)) {
|
||||||
|
const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, packageCacheFolder);
|
||||||
|
core.info(`Save package cache path: ${packageCachePath} to ${fullCachePath}, key: ${packageCacheKey}`);
|
||||||
|
await io.cp(packageCachePath, fullCachePath, {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
|
const options = {};
|
||||||
|
options.env = {
|
||||||
|
...process.env,
|
||||||
|
XMAKE_ROOT: 'y',
|
||||||
|
};
|
||||||
|
await (0, exec_1.exec)('xmake', ['l', 'os.touch', path.join(fullCachePath, 'package_cache_saved.txt')], options);
|
||||||
|
await cache.saveCache([packageCacheFolder], packageCacheKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.savePackageCache = savePackageCache;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 8387:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.IsPost = void 0;
|
||||||
|
const core = __nccwpck_require__(9093);
|
||||||
|
/**
|
||||||
|
* Indicates whether the POST action is running
|
||||||
|
*/
|
||||||
|
exports.IsPost = !!core.getState('isPost');
|
||||||
|
// Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic.
|
||||||
|
// This is necessary since we don't have a separate entry point.
|
||||||
|
if (!exports.IsPost) {
|
||||||
|
core.saveState('isPost', 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 6689:
|
/***/ 6689:
|
||||||
@@ -82835,11 +83222,14 @@ const path = __nccwpck_require__(1017);
|
|||||||
const semver = __nccwpck_require__(117);
|
const semver = __nccwpck_require__(117);
|
||||||
const git = __nccwpck_require__(3555);
|
const git = __nccwpck_require__(3555);
|
||||||
function getInstallerUrl(version, latest) {
|
function getInstallerUrl(version, latest) {
|
||||||
const ver = version.version;
|
let ver = version.version;
|
||||||
switch (version.type) {
|
switch (version.type) {
|
||||||
case 'heads': {
|
case 'heads': {
|
||||||
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
|
||||||
const latestver = latest.version;
|
const latestver = latest.version;
|
||||||
|
if (ver !== 'dev' && ver !== 'master') {
|
||||||
|
ver = latestver;
|
||||||
|
}
|
||||||
return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
|
return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
|
||||||
}
|
}
|
||||||
case 'pull': {
|
case 'pull': {
|
||||||
@@ -82849,7 +83239,7 @@ function getInstallerUrl(version, latest) {
|
|||||||
throw new Error('Sha builds for windows is not supported');
|
throw new Error('Sha builds for windows is not supported');
|
||||||
}
|
}
|
||||||
case 'tags': {
|
case 'tags': {
|
||||||
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
|
||||||
return semver.gt(ver, '2.2.6')
|
return semver.gt(ver, '2.2.6')
|
||||||
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
|
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
|
||||||
: `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
|
: `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
|
||||||
@@ -87427,29 +87817,37 @@ var exports = __webpack_exports__;
|
|||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const core = __nccwpck_require__(9093);
|
const core = __nccwpck_require__(9093);
|
||||||
const exec_1 = __nccwpck_require__(7775);
|
const stateHelper = __nccwpck_require__(8387);
|
||||||
const os = __nccwpck_require__(2037);
|
const install_1 = __nccwpck_require__(6633);
|
||||||
const versions_1 = __nccwpck_require__(406);
|
const build_cache_1 = __nccwpck_require__(53);
|
||||||
const win_install_1 = __nccwpck_require__(1612);
|
const package_cache_1 = __nccwpck_require__(8884);
|
||||||
const unix_install_1 = __nccwpck_require__(6689);
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const version = await (0, versions_1.selectVersion)();
|
await (0, install_1.installXmake)();
|
||||||
if (os.platform() === 'win32' || os.platform() === 'cygwin') {
|
await (0, build_cache_1.loadBuildCache)();
|
||||||
const latest = await (0, versions_1.selectVersion)('latest');
|
await (0, package_cache_1.loadPackageCache)();
|
||||||
await (0, win_install_1.winInstall)(version, latest);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
await (0, unix_install_1.unixInstall)(version);
|
|
||||||
}
|
|
||||||
await (0, exec_1.exec)('xmake --root --version');
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
const ex = error;
|
const ex = error;
|
||||||
core.setFailed(ex.message);
|
core.setFailed(ex.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
run().catch((e) => core.error(e));
|
async function saveCache() {
|
||||||
|
try {
|
||||||
|
await (0, build_cache_1.saveBuildCache)();
|
||||||
|
await (0, package_cache_1.savePackageCache)();
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const ex = error;
|
||||||
|
core.setFailed(ex.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!stateHelper.IsPost) {
|
||||||
|
run().catch((e) => core.error(e));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
saveCache().catch((e) => core.error(e));
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
Generated
+84
-23
@@ -1,20 +1,19 @@
|
|||||||
{
|
{
|
||||||
"name": "github-action-setup-xmake",
|
"name": "github-action-setup-xmake",
|
||||||
"version": "1.1.2",
|
"version": "1.1.9",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "github-action-setup-xmake",
|
"name": "github-action-setup-xmake",
|
||||||
"version": "1.1.2",
|
"version": "1.1.9",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.2.4",
|
"@actions/cache": "^4.0.3",
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.3",
|
"@actions/io": "^1.1.3",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
"pnpm": "^9.15.0",
|
|
||||||
"semver": "^7.6.0"
|
"semver": "^7.6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -36,9 +35,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache": {
|
"node_modules/@actions/cache": {
|
||||||
"version": "3.3.0",
|
"version": "4.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-4.0.3.tgz",
|
||||||
"integrity": "sha512-+eCsMTIZUEm+QA9GqjollOhCdvRrZ1JV8d9Rp34zVNizBkYITO8dhKczP5Xps1dFzc5n59p7vYVtZrGt18bb5Q==",
|
"integrity": "sha512-SvrqFtYJ7I48A/uXNkoJrnukx5weQv1fGquhs3+4nkByZThBH109KTIqj5x/cGV7JGNvb8dLPVywUOqX1fjiXg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
@@ -49,6 +48,7 @@
|
|||||||
"@azure/abort-controller": "^1.1.0",
|
"@azure/abort-controller": "^1.1.0",
|
||||||
"@azure/ms-rest-js": "^2.6.0",
|
"@azure/ms-rest-js": "^2.6.0",
|
||||||
"@azure/storage-blob": "^12.13.0",
|
"@azure/storage-blob": "^12.13.0",
|
||||||
|
"@protobuf-ts/plugin": "^2.9.4",
|
||||||
"semver": "^6.3.1"
|
"semver": "^6.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1709,6 +1709,83 @@
|
|||||||
"url": "https://opencollective.com/unts"
|
"url": "https://opencollective.com/unts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@protobuf-ts/plugin": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/plugin/-/plugin-2.10.0.tgz",
|
||||||
|
"integrity": "sha512-iMX4C4TVfMNRLn2msK0cVg5jmizjtu5FYiy8EK5Lg6EgyR9TVHeK2rzmufWKYM2Pcg1jSwC0cFcXHQnCoeFxUg==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@protobuf-ts/plugin-framework": "^2.10.0",
|
||||||
|
"@protobuf-ts/protoc": "^2.10.0",
|
||||||
|
"@protobuf-ts/runtime": "^2.10.0",
|
||||||
|
"@protobuf-ts/runtime-rpc": "^2.10.0",
|
||||||
|
"typescript": "^3.9"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"protoc-gen-dump": "bin/protoc-gen-dump",
|
||||||
|
"protoc-gen-ts": "bin/protoc-gen-ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/plugin-framework": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/plugin-framework/-/plugin-framework-2.10.0.tgz",
|
||||||
|
"integrity": "sha512-EuW9irbt+w7Ml1CaAxK6xyl7pSuWVbNy0rsChxJEthMrAVTN5EPdJ3whNWvsRBa+HwRImEl8KHNnRoq/vGOHbg==",
|
||||||
|
"license": "(Apache-2.0 AND BSD-3-Clause)",
|
||||||
|
"dependencies": {
|
||||||
|
"@protobuf-ts/runtime": "^2.10.0",
|
||||||
|
"typescript": "^3.9"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/plugin-framework/node_modules/typescript": {
|
||||||
|
"version": "3.9.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||||
|
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/plugin/node_modules/typescript": {
|
||||||
|
"version": "3.9.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||||
|
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/protoc": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.10.0.tgz",
|
||||||
|
"integrity": "sha512-S4BtGBh22+uL5E6qLVxV0QNY6tiLVB8QL7RIkvo+KYknipZfSNwubdKy5CPkrwVXzJn4s3cx7bKx1w6BxkBIPg==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bin": {
|
||||||
|
"protoc": "protoc.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/runtime": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.10.0.tgz",
|
||||||
|
"integrity": "sha512-ypYwGg9Pn3W/2lZ7/HW60hONGuSdzphvOY8Dq7LeNttymDe0y3LaTUUMRpuGqOT6FfrWEMnfQbyqU8AAreo8wA==",
|
||||||
|
"license": "(Apache-2.0 AND BSD-3-Clause)"
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/runtime-rpc": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.10.0.tgz",
|
||||||
|
"integrity": "sha512-8CS/XPv3+pMK4v8UKhtCdvbS4h9l7aqlteKdRt0/UbIKZ8n0qHj6hX8cBhz2ngvohxCOS0N08zPr9aCLBNhW3Q==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@protobuf-ts/runtime": "^2.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@sinclair/typebox": {
|
"node_modules/@sinclair/typebox": {
|
||||||
"version": "0.27.8",
|
"version": "0.27.8",
|
||||||
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
|
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
|
||||||
@@ -5094,22 +5171,6 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/pnpm": {
|
|
||||||
"version": "9.15.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/pnpm/-/pnpm-9.15.0.tgz",
|
|
||||||
"integrity": "sha512-duI3l2CkMo7EQVgVvNZije5yevN3mqpMkU45RBVsQpmSGon5djge4QfUHxLPpLZmgcqccY8GaPoIMe1MbYulbA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"bin": {
|
|
||||||
"pnpm": "bin/pnpm.cjs",
|
|
||||||
"pnpx": "bin/pnpx.cjs"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18.12"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://opencollective.com/pnpm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/prelude-ls": {
|
"node_modules/prelude-ls": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "github-action-setup-xmake",
|
"name": "github-action-setup-xmake",
|
||||||
"version": "1.1.2",
|
"version": "1.1.9",
|
||||||
"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",
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"release": "pnpm clean && pnpm format && pnpm lint && pnpm build"
|
"release": "pnpm clean && pnpm format && pnpm lint && pnpm build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.2.4",
|
"@actions/cache": "^4.0.3",
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.3",
|
"@actions/io": "^1.1.3",
|
||||||
|
|||||||
Generated
+88
-18
@@ -8,8 +8,8 @@ importers:
|
|||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@actions/cache':
|
'@actions/cache':
|
||||||
specifier: ^3.2.4
|
specifier: ^4.0.3
|
||||||
version: 3.2.4
|
version: 4.0.3
|
||||||
'@actions/core':
|
'@actions/core':
|
||||||
specifier: ^1.10.1
|
specifier: ^1.10.1
|
||||||
version: 1.10.1
|
version: 1.10.1
|
||||||
@@ -37,7 +37,7 @@ importers:
|
|||||||
version: 7.5.8
|
version: 7.5.8
|
||||||
'@typescript-eslint/eslint-plugin':
|
'@typescript-eslint/eslint-plugin':
|
||||||
specifier: ^7.5.0
|
specifier: ^7.5.0
|
||||||
version: 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.4)
|
version: 7.5.0(@typescript-eslint/parser@7.5.0(eslint@8.57.0)(typescript@5.4.4))(eslint@8.57.0)(typescript@5.4.4)
|
||||||
'@typescript-eslint/parser':
|
'@typescript-eslint/parser':
|
||||||
specifier: ^7.5.0
|
specifier: ^7.5.0
|
||||||
version: 7.5.0(eslint@8.57.0)(typescript@5.4.4)
|
version: 7.5.0(eslint@8.57.0)(typescript@5.4.4)
|
||||||
@@ -52,7 +52,7 @@ importers:
|
|||||||
version: 9.1.0(eslint@8.57.0)
|
version: 9.1.0(eslint@8.57.0)
|
||||||
eslint-plugin-prettier:
|
eslint-plugin-prettier:
|
||||||
specifier: ^5.1.3
|
specifier: ^5.1.3
|
||||||
version: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5)
|
version: 5.1.3(eslint-config-prettier@9.1.0(eslint@8.57.0))(eslint@8.57.0)(prettier@3.2.5)
|
||||||
jest:
|
jest:
|
||||||
specifier: ^29.7.0
|
specifier: ^29.7.0
|
||||||
version: 29.7.0(@types/node@20.12.4)
|
version: 29.7.0(@types/node@20.12.4)
|
||||||
@@ -64,7 +64,7 @@ importers:
|
|||||||
version: 5.0.5
|
version: 5.0.5
|
||||||
ts-jest:
|
ts-jest:
|
||||||
specifier: ^29.1.2
|
specifier: ^29.1.2
|
||||||
version: 29.1.2(@babel/core@7.24.4)(jest@29.7.0)(typescript@5.4.4)
|
version: 29.1.2(@babel/core@7.24.4)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.4))(jest@29.7.0(@types/node@20.12.4))(typescript@5.4.4)
|
||||||
type-fest:
|
type-fest:
|
||||||
specifier: ^4.15.0
|
specifier: ^4.15.0
|
||||||
version: 4.15.0
|
version: 4.15.0
|
||||||
@@ -78,14 +78,18 @@ packages:
|
|||||||
{ integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== }
|
{ integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== }
|
||||||
engines: { node: '>=0.10.0' }
|
engines: { node: '>=0.10.0' }
|
||||||
|
|
||||||
'@actions/cache@3.2.4':
|
'@actions/cache@4.0.3':
|
||||||
resolution:
|
resolution:
|
||||||
{ integrity: sha512-RuHnwfcDagtX+37s0ZWy7clbOfnZ7AlDJQ7k/9rzt2W4Gnwde3fa/qjSjVuz4vLcLIpc7fUob27CMrqiWZytYA== }
|
{ integrity: sha512-SvrqFtYJ7I48A/uXNkoJrnukx5weQv1fGquhs3+4nkByZThBH109KTIqj5x/cGV7JGNvb8dLPVywUOqX1fjiXg== }
|
||||||
|
|
||||||
'@actions/core@1.10.1':
|
'@actions/core@1.10.1':
|
||||||
resolution:
|
resolution:
|
||||||
{ integrity: sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g== }
|
{ integrity: sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g== }
|
||||||
|
|
||||||
|
'@actions/core@1.11.1':
|
||||||
|
resolution:
|
||||||
|
{ integrity: sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A== }
|
||||||
|
|
||||||
'@actions/exec@1.1.1':
|
'@actions/exec@1.1.1':
|
||||||
resolution:
|
resolution:
|
||||||
{ integrity: sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w== }
|
{ integrity: sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w== }
|
||||||
@@ -130,6 +134,7 @@ packages:
|
|||||||
resolution:
|
resolution:
|
||||||
{ integrity: sha512-Fok9VVhMdxAFOtqiiAtg74fL0UJkt0z3D+ouUUxcRLzZNBioPRAMJFVxiWoJljYpXsRi4GDQHzQHDc9AiYaIUQ== }
|
{ integrity: sha512-Fok9VVhMdxAFOtqiiAtg74fL0UJkt0z3D+ouUUxcRLzZNBioPRAMJFVxiWoJljYpXsRi4GDQHzQHDc9AiYaIUQ== }
|
||||||
engines: { node: '>=14.0.0' }
|
engines: { node: '>=14.0.0' }
|
||||||
|
deprecated: This package is no longer supported. Please migrate to use @azure/core-rest-pipeline
|
||||||
|
|
||||||
'@azure/core-lro@2.7.1':
|
'@azure/core-lro@2.7.1':
|
||||||
resolution:
|
resolution:
|
||||||
@@ -558,6 +563,28 @@ packages:
|
|||||||
{ integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== }
|
{ integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== }
|
||||||
engines: { node: ^12.20.0 || ^14.18.0 || >=16.0.0 }
|
engines: { node: ^12.20.0 || ^14.18.0 || >=16.0.0 }
|
||||||
|
|
||||||
|
'@protobuf-ts/plugin-framework@2.10.0':
|
||||||
|
resolution:
|
||||||
|
{ integrity: sha512-EuW9irbt+w7Ml1CaAxK6xyl7pSuWVbNy0rsChxJEthMrAVTN5EPdJ3whNWvsRBa+HwRImEl8KHNnRoq/vGOHbg== }
|
||||||
|
|
||||||
|
'@protobuf-ts/plugin@2.10.0':
|
||||||
|
resolution:
|
||||||
|
{ integrity: sha512-iMX4C4TVfMNRLn2msK0cVg5jmizjtu5FYiy8EK5Lg6EgyR9TVHeK2rzmufWKYM2Pcg1jSwC0cFcXHQnCoeFxUg== }
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
|
'@protobuf-ts/protoc@2.10.0':
|
||||||
|
resolution:
|
||||||
|
{ integrity: sha512-S4BtGBh22+uL5E6qLVxV0QNY6tiLVB8QL7RIkvo+KYknipZfSNwubdKy5CPkrwVXzJn4s3cx7bKx1w6BxkBIPg== }
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
|
'@protobuf-ts/runtime-rpc@2.10.0':
|
||||||
|
resolution:
|
||||||
|
{ integrity: sha512-8CS/XPv3+pMK4v8UKhtCdvbS4h9l7aqlteKdRt0/UbIKZ8n0qHj6hX8cBhz2ngvohxCOS0N08zPr9aCLBNhW3Q== }
|
||||||
|
|
||||||
|
'@protobuf-ts/runtime@2.10.0':
|
||||||
|
resolution:
|
||||||
|
{ integrity: sha512-ypYwGg9Pn3W/2lZ7/HW60hONGuSdzphvOY8Dq7LeNttymDe0y3LaTUUMRpuGqOT6FfrWEMnfQbyqU8AAreo8wA== }
|
||||||
|
|
||||||
'@sinclair/typebox@0.27.8':
|
'@sinclair/typebox@0.27.8':
|
||||||
resolution:
|
resolution:
|
||||||
{ integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== }
|
{ integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== }
|
||||||
@@ -2196,6 +2223,12 @@ packages:
|
|||||||
{ integrity: sha512-tB9lu0pQpX5KJq54g+oHOLumOx+pMep4RaM6liXh2PKmVRFF+/vAtUP0ZaJ0kOySfVNjF6doBWPHhBhISKdlIA== }
|
{ integrity: sha512-tB9lu0pQpX5KJq54g+oHOLumOx+pMep4RaM6liXh2PKmVRFF+/vAtUP0ZaJ0kOySfVNjF6doBWPHhBhISKdlIA== }
|
||||||
engines: { node: '>=16' }
|
engines: { node: '>=16' }
|
||||||
|
|
||||||
|
typescript@3.9.10:
|
||||||
|
resolution:
|
||||||
|
{ integrity: sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q== }
|
||||||
|
engines: { node: '>=4.2.0' }
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
typescript@5.4.4:
|
typescript@5.4.4:
|
||||||
resolution:
|
resolution:
|
||||||
{ integrity: sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw== }
|
{ integrity: sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw== }
|
||||||
@@ -2316,9 +2349,9 @@ packages:
|
|||||||
snapshots:
|
snapshots:
|
||||||
'@aashutoshrathi/word-wrap@1.2.6': {}
|
'@aashutoshrathi/word-wrap@1.2.6': {}
|
||||||
|
|
||||||
'@actions/cache@3.2.4':
|
'@actions/cache@4.0.3':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@actions/core': 1.10.1
|
'@actions/core': 1.11.1
|
||||||
'@actions/exec': 1.1.1
|
'@actions/exec': 1.1.1
|
||||||
'@actions/glob': 0.1.2
|
'@actions/glob': 0.1.2
|
||||||
'@actions/http-client': 2.2.1
|
'@actions/http-client': 2.2.1
|
||||||
@@ -2326,8 +2359,8 @@ snapshots:
|
|||||||
'@azure/abort-controller': 1.1.0
|
'@azure/abort-controller': 1.1.0
|
||||||
'@azure/ms-rest-js': 2.7.0
|
'@azure/ms-rest-js': 2.7.0
|
||||||
'@azure/storage-blob': 12.17.0
|
'@azure/storage-blob': 12.17.0
|
||||||
|
'@protobuf-ts/plugin': 2.10.0
|
||||||
semver: 6.3.1
|
semver: 6.3.1
|
||||||
uuid: 3.4.0
|
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- encoding
|
- encoding
|
||||||
|
|
||||||
@@ -2336,13 +2369,18 @@ snapshots:
|
|||||||
'@actions/http-client': 2.2.1
|
'@actions/http-client': 2.2.1
|
||||||
uuid: 8.3.2
|
uuid: 8.3.2
|
||||||
|
|
||||||
|
'@actions/core@1.11.1':
|
||||||
|
dependencies:
|
||||||
|
'@actions/exec': 1.1.1
|
||||||
|
'@actions/http-client': 2.2.1
|
||||||
|
|
||||||
'@actions/exec@1.1.1':
|
'@actions/exec@1.1.1':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@actions/io': 1.1.3
|
'@actions/io': 1.1.3
|
||||||
|
|
||||||
'@actions/glob@0.1.2':
|
'@actions/glob@0.1.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@actions/core': 1.10.1
|
'@actions/core': 1.11.1
|
||||||
minimatch: 3.1.2
|
minimatch: 3.1.2
|
||||||
|
|
||||||
'@actions/http-client@2.2.1':
|
'@actions/http-client@2.2.1':
|
||||||
@@ -2904,6 +2942,27 @@ snapshots:
|
|||||||
|
|
||||||
'@pkgr/core@0.1.1': {}
|
'@pkgr/core@0.1.1': {}
|
||||||
|
|
||||||
|
'@protobuf-ts/plugin-framework@2.10.0':
|
||||||
|
dependencies:
|
||||||
|
'@protobuf-ts/runtime': 2.10.0
|
||||||
|
typescript: 3.9.10
|
||||||
|
|
||||||
|
'@protobuf-ts/plugin@2.10.0':
|
||||||
|
dependencies:
|
||||||
|
'@protobuf-ts/plugin-framework': 2.10.0
|
||||||
|
'@protobuf-ts/protoc': 2.10.0
|
||||||
|
'@protobuf-ts/runtime': 2.10.0
|
||||||
|
'@protobuf-ts/runtime-rpc': 2.10.0
|
||||||
|
typescript: 3.9.10
|
||||||
|
|
||||||
|
'@protobuf-ts/protoc@2.10.0': {}
|
||||||
|
|
||||||
|
'@protobuf-ts/runtime-rpc@2.10.0':
|
||||||
|
dependencies:
|
||||||
|
'@protobuf-ts/runtime': 2.10.0
|
||||||
|
|
||||||
|
'@protobuf-ts/runtime@2.10.0': {}
|
||||||
|
|
||||||
'@sinclair/typebox@0.27.8': {}
|
'@sinclair/typebox@0.27.8': {}
|
||||||
|
|
||||||
'@sinonjs/commons@3.0.1':
|
'@sinonjs/commons@3.0.1':
|
||||||
@@ -2979,7 +3038,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@types/yargs-parser': 21.0.3
|
'@types/yargs-parser': 21.0.3
|
||||||
|
|
||||||
'@typescript-eslint/eslint-plugin@7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.4)':
|
'@typescript-eslint/eslint-plugin@7.5.0(@typescript-eslint/parser@7.5.0(eslint@8.57.0)(typescript@5.4.4))(eslint@8.57.0)(typescript@5.4.4)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/regexpp': 4.10.0
|
'@eslint-community/regexpp': 4.10.0
|
||||||
'@typescript-eslint/parser': 7.5.0(eslint@8.57.0)(typescript@5.4.4)
|
'@typescript-eslint/parser': 7.5.0(eslint@8.57.0)(typescript@5.4.4)
|
||||||
@@ -2994,6 +3053,7 @@ snapshots:
|
|||||||
natural-compare: 1.4.0
|
natural-compare: 1.4.0
|
||||||
semver: 7.6.0
|
semver: 7.6.0
|
||||||
ts-api-utils: 1.3.0(typescript@5.4.4)
|
ts-api-utils: 1.3.0(typescript@5.4.4)
|
||||||
|
optionalDependencies:
|
||||||
typescript: 5.4.4
|
typescript: 5.4.4
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
@@ -3006,6 +3066,7 @@ snapshots:
|
|||||||
'@typescript-eslint/visitor-keys': 7.5.0
|
'@typescript-eslint/visitor-keys': 7.5.0
|
||||||
debug: 4.3.4
|
debug: 4.3.4
|
||||||
eslint: 8.57.0
|
eslint: 8.57.0
|
||||||
|
optionalDependencies:
|
||||||
typescript: 5.4.4
|
typescript: 5.4.4
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
@@ -3022,6 +3083,7 @@ snapshots:
|
|||||||
debug: 4.3.4
|
debug: 4.3.4
|
||||||
eslint: 8.57.0
|
eslint: 8.57.0
|
||||||
ts-api-utils: 1.3.0(typescript@5.4.4)
|
ts-api-utils: 1.3.0(typescript@5.4.4)
|
||||||
|
optionalDependencies:
|
||||||
typescript: 5.4.4
|
typescript: 5.4.4
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
@@ -3038,6 +3100,7 @@ snapshots:
|
|||||||
minimatch: 9.0.3
|
minimatch: 9.0.3
|
||||||
semver: 7.6.0
|
semver: 7.6.0
|
||||||
ts-api-utils: 1.3.0(typescript@5.4.4)
|
ts-api-utils: 1.3.0(typescript@5.4.4)
|
||||||
|
optionalDependencies:
|
||||||
typescript: 5.4.4
|
typescript: 5.4.4
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
@@ -3327,13 +3390,14 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
eslint: 8.57.0
|
eslint: 8.57.0
|
||||||
|
|
||||||
eslint-plugin-prettier@5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5):
|
eslint-plugin-prettier@5.1.3(eslint-config-prettier@9.1.0(eslint@8.57.0))(eslint@8.57.0)(prettier@3.2.5):
|
||||||
dependencies:
|
dependencies:
|
||||||
eslint: 8.57.0
|
eslint: 8.57.0
|
||||||
eslint-config-prettier: 9.1.0(eslint@8.57.0)
|
|
||||||
prettier: 3.2.5
|
prettier: 3.2.5
|
||||||
prettier-linter-helpers: 1.0.0
|
prettier-linter-helpers: 1.0.0
|
||||||
synckit: 0.8.8
|
synckit: 0.8.8
|
||||||
|
optionalDependencies:
|
||||||
|
eslint-config-prettier: 9.1.0(eslint@8.57.0)
|
||||||
|
|
||||||
eslint-scope@7.2.2:
|
eslint-scope@7.2.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -3717,7 +3781,6 @@ snapshots:
|
|||||||
'@babel/core': 7.24.4
|
'@babel/core': 7.24.4
|
||||||
'@jest/test-sequencer': 29.7.0
|
'@jest/test-sequencer': 29.7.0
|
||||||
'@jest/types': 29.6.3
|
'@jest/types': 29.6.3
|
||||||
'@types/node': 20.12.4
|
|
||||||
babel-jest: 29.7.0(@babel/core@7.24.4)
|
babel-jest: 29.7.0(@babel/core@7.24.4)
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
ci-info: 3.9.0
|
ci-info: 3.9.0
|
||||||
@@ -3737,6 +3800,8 @@ snapshots:
|
|||||||
pretty-format: 29.7.0
|
pretty-format: 29.7.0
|
||||||
slash: 3.0.0
|
slash: 3.0.0
|
||||||
strip-json-comments: 3.1.1
|
strip-json-comments: 3.1.1
|
||||||
|
optionalDependencies:
|
||||||
|
'@types/node': 20.12.4
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- babel-plugin-macros
|
- babel-plugin-macros
|
||||||
- supports-color
|
- supports-color
|
||||||
@@ -3818,7 +3883,7 @@ snapshots:
|
|||||||
jest-util: 29.7.0
|
jest-util: 29.7.0
|
||||||
|
|
||||||
jest-pnp-resolver@1.2.3(jest-resolve@29.7.0):
|
jest-pnp-resolver@1.2.3(jest-resolve@29.7.0):
|
||||||
dependencies:
|
optionalDependencies:
|
||||||
jest-resolve: 29.7.0
|
jest-resolve: 29.7.0
|
||||||
|
|
||||||
jest-regex-util@29.6.3: {}
|
jest-regex-util@29.6.3: {}
|
||||||
@@ -4326,9 +4391,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
typescript: 5.4.4
|
typescript: 5.4.4
|
||||||
|
|
||||||
ts-jest@29.1.2(@babel/core@7.24.4)(jest@29.7.0)(typescript@5.4.4):
|
ts-jest@29.1.2(@babel/core@7.24.4)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.4))(jest@29.7.0(@types/node@20.12.4))(typescript@5.4.4):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/core': 7.24.4
|
|
||||||
bs-logger: 0.2.6
|
bs-logger: 0.2.6
|
||||||
fast-json-stable-stringify: 2.1.0
|
fast-json-stable-stringify: 2.1.0
|
||||||
jest: 29.7.0(@types/node@20.12.4)
|
jest: 29.7.0(@types/node@20.12.4)
|
||||||
@@ -4339,6 +4403,10 @@ snapshots:
|
|||||||
semver: 7.6.0
|
semver: 7.6.0
|
||||||
typescript: 5.4.4
|
typescript: 5.4.4
|
||||||
yargs-parser: 21.1.1
|
yargs-parser: 21.1.1
|
||||||
|
optionalDependencies:
|
||||||
|
'@babel/core': 7.24.4
|
||||||
|
'@jest/types': 29.6.3
|
||||||
|
babel-jest: 29.7.0(@babel/core@7.24.4)
|
||||||
|
|
||||||
tslib@1.14.1: {}
|
tslib@1.14.1: {}
|
||||||
|
|
||||||
@@ -4358,6 +4426,8 @@ snapshots:
|
|||||||
|
|
||||||
type-fest@4.15.0: {}
|
type-fest@4.15.0: {}
|
||||||
|
|
||||||
|
typescript@3.9.10: {}
|
||||||
|
|
||||||
typescript@5.4.4: {}
|
typescript@5.4.4: {}
|
||||||
|
|
||||||
undici-types@5.26.5: {}
|
undici-types@5.26.5: {}
|
||||||
|
|||||||
@@ -0,0 +1,168 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import { exec, ExecOptions } from '@actions/exec';
|
||||||
|
import * as io from '@actions/io';
|
||||||
|
import * as cache from '@actions/cache';
|
||||||
|
import * as os from 'os';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as fsutils from './fsutils';
|
||||||
|
|
||||||
|
function getBuildTime(hours?: string): string {
|
||||||
|
let key = 'BuildTime';
|
||||||
|
if (hours && hours !== '') {
|
||||||
|
key = key + hours;
|
||||||
|
}
|
||||||
|
let buildTime = core.getState(key);
|
||||||
|
if (!buildTime || buildTime === '') {
|
||||||
|
const now = new Date();
|
||||||
|
const year = now.getFullYear();
|
||||||
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(now.getDate()).padStart(2, '0');
|
||||||
|
if (!hours || hours === '') {
|
||||||
|
hours = String(now.getHours()).padStart(2, '0');
|
||||||
|
}
|
||||||
|
buildTime = `${year}${month}${day}_${hours}`;
|
||||||
|
core.saveState(key, buildTime);
|
||||||
|
}
|
||||||
|
return buildTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getProjectRootPath(): string {
|
||||||
|
let projectRootPath = core.getInput('project-path');
|
||||||
|
if (!projectRootPath) {
|
||||||
|
projectRootPath = process.cwd();
|
||||||
|
}
|
||||||
|
projectRootPath = projectRootPath.trim();
|
||||||
|
if (projectRootPath && projectRootPath !== '' && !path.isAbsolute(projectRootPath)) {
|
||||||
|
projectRootPath = path.join(process.cwd(), projectRootPath);
|
||||||
|
}
|
||||||
|
return projectRootPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBuildCacheKey(buildCacheTime?: string): string {
|
||||||
|
let buildCacheKey = core.getInput('build-cache-key');
|
||||||
|
if (!buildCacheKey) {
|
||||||
|
buildCacheKey = '';
|
||||||
|
}
|
||||||
|
if (!buildCacheTime || buildCacheTime === '') {
|
||||||
|
buildCacheTime = getBuildTime();
|
||||||
|
}
|
||||||
|
return `xmake-build-cache-${buildCacheKey}-${buildCacheTime}-${os.arch()}-${os.platform()}-${process.env.RUNNER_OS ?? 'unknown'}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getBuildCachePath(): Promise<string> {
|
||||||
|
let buildCachePath = core.getInput('build-cache-path');
|
||||||
|
if (!buildCachePath) {
|
||||||
|
buildCachePath = '';
|
||||||
|
const projectRootPath = getProjectRootPath();
|
||||||
|
if (projectRootPath && projectRootPath !== '' && fsutils.isDir(projectRootPath)) {
|
||||||
|
const options: ExecOptions = {};
|
||||||
|
options.env = {
|
||||||
|
...process.env,
|
||||||
|
XMAKE_ROOT: 'y',
|
||||||
|
};
|
||||||
|
options.cwd = projectRootPath;
|
||||||
|
options.listeners = {
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
buildCachePath += data.toString();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await exec(
|
||||||
|
'xmake',
|
||||||
|
[
|
||||||
|
'l',
|
||||||
|
'-c',
|
||||||
|
'import("core.project.config"); import("private.cache.build_cache"); config.load(); print(build_cache.rootdir())',
|
||||||
|
],
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
buildCachePath = buildCachePath.trim();
|
||||||
|
if (buildCachePath !== '' && !path.isAbsolute(buildCachePath)) {
|
||||||
|
buildCachePath = path.join(projectRootPath, buildCachePath);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
buildCachePath = 'build/.build_cache';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buildCachePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBuildCacheFolder(): string {
|
||||||
|
return '.xmake-build-cache';
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function loadBuildCache(): Promise<void> {
|
||||||
|
const buildCache = core.getBooleanInput('build-cache');
|
||||||
|
if (!buildCache) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// export $XMAKE_ACTION_BUILD_CACHE, xmake will check it and enable build cache by default on ci.
|
||||||
|
core.exportVariable('XMAKE_ACTION_BUILD_CACHE', 'true');
|
||||||
|
|
||||||
|
const buildCacheFolder = getBuildCacheFolder();
|
||||||
|
const buildCachePath = await getBuildCachePath();
|
||||||
|
|
||||||
|
if (buildCacheFolder && process.env.GITHUB_WORKSPACE) {
|
||||||
|
const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, buildCacheFolder);
|
||||||
|
const filepath = path.join(fullCachePath, 'build_cache_saved.txt');
|
||||||
|
// Since action/cache cannot overwrite updates, we try to restore the cache from the last 24 hours.
|
||||||
|
const now = new Date();
|
||||||
|
for (let i = 0; i < 24; i++) {
|
||||||
|
const hours = now.getHours() - i;
|
||||||
|
if (hours < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const buildCacheKey = getBuildCacheKey(getBuildTime(String(hours).padStart(2, '0')));
|
||||||
|
if (!fsutils.isFile(filepath)) {
|
||||||
|
core.info(`Restore build cache path: ${fullCachePath} to ${buildCachePath}, key: ${buildCacheKey}`);
|
||||||
|
await cache.restoreCache([buildCacheFolder], buildCacheKey);
|
||||||
|
}
|
||||||
|
if (fsutils.isFile(filepath)) {
|
||||||
|
if (fsutils.isDir(buildCachePath)) {
|
||||||
|
await io.rmRF(buildCachePath);
|
||||||
|
}
|
||||||
|
await io.cp(fullCachePath, buildCachePath, {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
|
/* Even if the historical cache is hit, we need to update to the latest cache
|
||||||
|
* Therefore, only when the latest cache is hit, it is a real hit, and we no longer need to update the cache.
|
||||||
|
*/
|
||||||
|
if (i === 0) {
|
||||||
|
core.saveState('hitBuildCache', 'true');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!fsutils.isFile(filepath)) {
|
||||||
|
core.warning(`No cached files found at path "${fullCachePath}".`);
|
||||||
|
await io.rmRF(fullCachePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function saveBuildCache(): Promise<void> {
|
||||||
|
const buildCache = core.getBooleanInput('build-cache');
|
||||||
|
if (!buildCache) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const buildCacheFolder = getBuildCacheFolder();
|
||||||
|
const buildCacheKey = getBuildCacheKey();
|
||||||
|
const buildCachePath = await getBuildCachePath();
|
||||||
|
|
||||||
|
const hitBuildCache = !!core.getState('hitBuildCache');
|
||||||
|
if (!hitBuildCache && buildCacheFolder && process.env.GITHUB_WORKSPACE && fsutils.isDir(buildCachePath)) {
|
||||||
|
const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, buildCacheFolder);
|
||||||
|
core.info(`Save build cache path: ${buildCachePath} to ${fullCachePath}, key: ${buildCacheKey}`);
|
||||||
|
await io.cp(buildCachePath, fullCachePath, {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
|
const options: ExecOptions = {};
|
||||||
|
options.env = {
|
||||||
|
...process.env,
|
||||||
|
XMAKE_ROOT: 'y',
|
||||||
|
};
|
||||||
|
await exec('xmake', ['l', 'os.touch', path.join(fullCachePath, 'build_cache_saved.txt')], options);
|
||||||
|
await cache.saveCache([buildCacheFolder], buildCacheKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
|
export function isFile(filepath: string): boolean {
|
||||||
|
try {
|
||||||
|
fs.accessSync(filepath, fs.constants.F_OK);
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isDir(filepath: string): boolean {
|
||||||
|
try {
|
||||||
|
const stats = fs.statSync(filepath);
|
||||||
|
if (stats.isDirectory()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
-14
@@ -1,24 +1,32 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import { exec } from '@actions/exec';
|
import * as stateHelper from './state-helper';
|
||||||
import * as os from 'os';
|
import { installXmake } from './install';
|
||||||
import { selectVersion } from './versions';
|
import { loadBuildCache, saveBuildCache } from './build-cache';
|
||||||
import { winInstall } from './win-install';
|
import { loadPackageCache, savePackageCache } from './package-cache';
|
||||||
import { unixInstall } from './unix-install';
|
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const version = await selectVersion();
|
await installXmake();
|
||||||
if (os.platform() === 'win32' || os.platform() === 'cygwin') {
|
await loadBuildCache();
|
||||||
const latest = await selectVersion('latest');
|
await loadPackageCache();
|
||||||
await winInstall(version, latest);
|
|
||||||
} else {
|
|
||||||
await unixInstall(version);
|
|
||||||
}
|
|
||||||
await exec('xmake --root --version');
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const ex = error as Error;
|
const ex = error as Error;
|
||||||
core.setFailed(ex.message);
|
core.setFailed(ex.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
run().catch((e: Error) => core.error(e));
|
async function saveCache(): Promise<void> {
|
||||||
|
try {
|
||||||
|
await saveBuildCache();
|
||||||
|
await savePackageCache();
|
||||||
|
} catch (error) {
|
||||||
|
const ex = error as Error;
|
||||||
|
core.setFailed(ex.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stateHelper.IsPost) {
|
||||||
|
run().catch((e: Error) => core.error(e));
|
||||||
|
} else {
|
||||||
|
saveCache().catch((e: Error) => core.error(e));
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { exec } from '@actions/exec';
|
||||||
|
import * as os from 'os';
|
||||||
|
import { selectVersion } from './versions';
|
||||||
|
import { winInstall } from './win-install';
|
||||||
|
import { unixInstall } from './unix-install';
|
||||||
|
|
||||||
|
export async function installXmake(): Promise<void> {
|
||||||
|
const version = await selectVersion();
|
||||||
|
if (os.platform() === 'win32' || os.platform() === 'cygwin') {
|
||||||
|
const latest = await selectVersion('latest');
|
||||||
|
await winInstall(version, latest);
|
||||||
|
} else {
|
||||||
|
await unixInstall(version);
|
||||||
|
}
|
||||||
|
await exec('xmake --root --version');
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import { exec, ExecOptions } from '@actions/exec';
|
||||||
|
import * as io from '@actions/io';
|
||||||
|
import * as cache from '@actions/cache';
|
||||||
|
import * as os from 'os';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as fsutils from './fsutils';
|
||||||
|
|
||||||
|
function getProjectRootPath(): string {
|
||||||
|
let projectRootPath = core.getInput('project-path');
|
||||||
|
if (!projectRootPath) {
|
||||||
|
projectRootPath = process.cwd();
|
||||||
|
}
|
||||||
|
projectRootPath = projectRootPath.trim();
|
||||||
|
if (projectRootPath && projectRootPath !== '' && !path.isAbsolute(projectRootPath)) {
|
||||||
|
projectRootPath = path.join(process.cwd(), projectRootPath);
|
||||||
|
}
|
||||||
|
return projectRootPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPackageCacheKey(): Promise<string> {
|
||||||
|
let packageCacheKey = core.getInput('package-cache-key');
|
||||||
|
if (!packageCacheKey) {
|
||||||
|
packageCacheKey = '';
|
||||||
|
}
|
||||||
|
let packageCacheHash = '';
|
||||||
|
const projectRootPath = getProjectRootPath();
|
||||||
|
if (projectRootPath && projectRootPath !== '' && fsutils.isDir(projectRootPath)) {
|
||||||
|
const options: ExecOptions = {};
|
||||||
|
options.env = {
|
||||||
|
...process.env,
|
||||||
|
XMAKE_ROOT: 'y',
|
||||||
|
};
|
||||||
|
options.cwd = projectRootPath;
|
||||||
|
options.listeners = {
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
packageCacheHash += data.toString();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await exec('xmake', ['repo', '--update']);
|
||||||
|
await exec('xmake', ['l', 'utils.ci.packageskey'], options);
|
||||||
|
packageCacheHash = packageCacheHash.trim();
|
||||||
|
}
|
||||||
|
return `xmake-package-cache-${packageCacheKey}-${packageCacheHash}-${os.arch()}-${os.platform()}-${process.env.RUNNER_OS ?? 'unknown'}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPackageCachePath(): Promise<string> {
|
||||||
|
let packageCachePath = '';
|
||||||
|
const options: ExecOptions = {};
|
||||||
|
options.env = {
|
||||||
|
...process.env,
|
||||||
|
XMAKE_ROOT: 'y',
|
||||||
|
};
|
||||||
|
options.listeners = {
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
packageCachePath += data.toString();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
await exec('xmake', ['l', '-c', 'import("core.package.package"); print(package.installdir())'], options);
|
||||||
|
packageCachePath = packageCachePath.trim();
|
||||||
|
return packageCachePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPackageCacheFolder(): string {
|
||||||
|
return '.xmake-package-cache';
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function loadPackageCache(): Promise<void> {
|
||||||
|
const packageCache = core.getBooleanInput('package-cache');
|
||||||
|
if (!packageCache) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const packageCacheFolder = getPackageCacheFolder();
|
||||||
|
const packageCacheKey = await getPackageCacheKey();
|
||||||
|
const packageCachePath = await getPackageCachePath();
|
||||||
|
if (!packageCachePath || packageCachePath === '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packageCacheFolder && process.env.GITHUB_WORKSPACE) {
|
||||||
|
const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, packageCacheFolder);
|
||||||
|
const filepath = path.join(fullCachePath, 'package_cache_saved.txt');
|
||||||
|
if (!fsutils.isFile(filepath)) {
|
||||||
|
core.info(`Restore package cache path: ${fullCachePath} to ${packageCachePath}, key: ${packageCacheKey}`);
|
||||||
|
await cache.restoreCache([packageCacheFolder], packageCacheKey);
|
||||||
|
}
|
||||||
|
if (fsutils.isFile(filepath)) {
|
||||||
|
if (fsutils.isDir(packageCachePath)) {
|
||||||
|
await io.rmRF(packageCachePath);
|
||||||
|
}
|
||||||
|
await io.cp(fullCachePath, packageCachePath, {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
|
core.saveState('hitPackageCache', 'true');
|
||||||
|
} else {
|
||||||
|
core.warning(`No cached files found at path "${fullCachePath}".`);
|
||||||
|
await io.rmRF(fullCachePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function savePackageCache(): Promise<void> {
|
||||||
|
const packageCache = core.getBooleanInput('package-cache');
|
||||||
|
if (!packageCache) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const packageCacheFolder = getPackageCacheFolder();
|
||||||
|
const packageCacheKey = await getPackageCacheKey();
|
||||||
|
const packageCachePath = await getPackageCachePath();
|
||||||
|
if (!packageCachePath || packageCachePath === '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hitPackageCache = !!core.getState('hitPackageCache');
|
||||||
|
if (!hitPackageCache && packageCacheFolder && process.env.GITHUB_WORKSPACE && fsutils.isDir(packageCachePath)) {
|
||||||
|
const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, packageCacheFolder);
|
||||||
|
core.info(`Save package cache path: ${packageCachePath} to ${fullCachePath}, key: ${packageCacheKey}`);
|
||||||
|
await io.cp(packageCachePath, fullCachePath, {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
|
const options: ExecOptions = {};
|
||||||
|
options.env = {
|
||||||
|
...process.env,
|
||||||
|
XMAKE_ROOT: 'y',
|
||||||
|
};
|
||||||
|
await exec('xmake', ['l', 'os.touch', path.join(fullCachePath, 'package_cache_saved.txt')], options);
|
||||||
|
await cache.saveCache([packageCacheFolder], packageCacheKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the POST action is running
|
||||||
|
*/
|
||||||
|
export const IsPost = !!core.getState('isPost');
|
||||||
|
|
||||||
|
// Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic.
|
||||||
|
// This is necessary since we don't have a separate entry point.
|
||||||
|
if (!IsPost) {
|
||||||
|
core.saveState('isPost', 'true');
|
||||||
|
}
|
||||||
+6
-3
@@ -11,11 +11,14 @@ import * as git from './git';
|
|||||||
import { Version, GitVersion } from './interfaces';
|
import { Version, GitVersion } from './interfaces';
|
||||||
|
|
||||||
function getInstallerUrl(version: GitVersion, latest: GitVersion): string {
|
function getInstallerUrl(version: GitVersion, latest: GitVersion): string {
|
||||||
const ver = version.version;
|
let ver = version.version;
|
||||||
switch (version.type) {
|
switch (version.type) {
|
||||||
case 'heads': {
|
case 'heads': {
|
||||||
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
|
||||||
const latestver = latest.version;
|
const latestver = latest.version;
|
||||||
|
if (ver !== 'dev' && ver !== 'master') {
|
||||||
|
ver = latestver;
|
||||||
|
}
|
||||||
return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
|
return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
|
||||||
}
|
}
|
||||||
case 'pull': {
|
case 'pull': {
|
||||||
@@ -25,7 +28,7 @@ function getInstallerUrl(version: GitVersion, latest: GitVersion): string {
|
|||||||
throw new Error('Sha builds for windows is not supported');
|
throw new Error('Sha builds for windows is not supported');
|
||||||
}
|
}
|
||||||
case 'tags': {
|
case 'tags': {
|
||||||
const arch = os.arch() === 'x64' ? 'win64' : 'win32';
|
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
|
||||||
return semver.gt(ver, '2.2.6')
|
return semver.gt(ver, '2.2.6')
|
||||||
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
|
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
|
||||||
: `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
|
: `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Xmake cache
|
||||||
|
.xmake/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# MacOS Cache
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
std::cout << "hello world!" << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
add_rules("mode.debug", "mode.release")
|
||||||
|
|
||||||
|
add_requires("libpng", "libogg", {system = false})
|
||||||
|
|
||||||
|
target("sample")
|
||||||
|
set_kind("binary")
|
||||||
|
add_files("src/*.cpp")
|
||||||
|
add_packages("libpng", "libogg")
|
||||||
|
|
||||||
Reference in New Issue
Block a user