Compare commits

...

14 Commits

3 changed files with 68 additions and 14 deletions
+4 -3
View File
@@ -11,14 +11,14 @@ 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'
@@ -31,6 +31,7 @@ jobs:
- name: Run tests - name: Run tests
run: | run: |
sw_vers -productVersion
xmake --version xmake --version
cd tests/sample cd tests/sample
xmake -y -vD xmake -y -vD
+32 -6
View File
@@ -70993,10 +70993,34 @@ 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);
async function getPlatformIdentifier() {
var _a;
let identifier = `${os.platform()}-${os.arch()}-${(_a = process.env.RUNNER_OS) !== null && _a !== void 0 ? _a : 'unknown'}`;
if (os.platform() === 'darwin') {
let productVersion = '';
try {
await (0, exec_1.exec)('sw_vers', ['-productVersion'], {
silent: true,
listeners: {
stdout: (data) => {
productVersion = data.toString().trim();
},
},
});
if (productVersion) {
identifier += `-${productVersion}`;
}
}
catch (error) {
core.warning(`Failed to get macOS product version: ${error instanceof Error ? error.message : String(error)}`);
}
}
return identifier;
}
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 {
@@ -71005,7 +71029,6 @@ async function install(sourceDir, binDir) {
} }
} }
async function unixInstall(version) { async function unixInstall(version) {
var _a;
let toolDir = ''; let toolDir = '';
const actionsCacheFolder = core.getInput('actions-cache-folder'); const actionsCacheFolder = core.getInput('actions-cache-folder');
let actionsCacheKey = core.getInput('actions-cache-key'); let actionsCacheKey = core.getInput('actions-cache-key');
@@ -71015,22 +71038,23 @@ 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 cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${os.arch()}-${os.platform()}-${(_a = process.env.RUNNER_OS) !== null && _a !== void 0 ? _a : 'unknown'}`; const platformIdentifier = await getPlatformIdentifier();
const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${platformIdentifier}`;
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) { if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
const fullCachePath = path.join(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);
} }
catch (_b) { catch (_a) {
await cache.restoreCache([actionsCacheFolder], cacheKey); await cache.restoreCache([actionsCacheFolder], cacheKey);
} }
fs.accessSync(path.join(fullCachePath, 'bin', 'xmake'), fs.constants.X_OK); fs.accessSync(path.join(fullCachePath, 'bin', 'xmake'), fs.constants.X_OK);
toolDir = fullCachePath; toolDir = fullCachePath;
core.info(`cache path: ${toolDir}, key: ${cacheKey}`); core.info(`cache path: ${toolDir}, key: ${cacheKey}`);
} }
catch (_c) { catch (_b) {
core.warning(`No cached files found at path "${fullCachePath}".`); core.warning(`No cached files found at path "${fullCachePath}, key: ${cacheKey}".`);
await io.rmRF(fullCachePath); await io.rmRF(fullCachePath);
} }
} }
@@ -71074,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')}`);
} }
+32 -5
View File
@@ -10,10 +10,35 @@ import * as semver from 'semver';
import * as git from './git'; import * as git from './git';
import { Version } from './interfaces'; import { Version } from './interfaces';
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 });
@@ -32,9 +57,8 @@ export async function unixInstall(version: Version): Promise<void> {
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 cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${os.arch()}-${os.platform()}-${ const platformIdentifier = await getPlatformIdentifier();
process.env.RUNNER_OS ?? 'unknown' const cacheKey = `xmake-cache-${actionsCacheKey}-${ver}-${sha}-${platformIdentifier}`;
}`;
if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) { if (actionsCacheFolder && process.env.GITHUB_WORKSPACE) {
const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder); const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, actionsCacheFolder);
@@ -48,7 +72,7 @@ export async function unixInstall(version: Version): Promise<void> {
toolDir = fullCachePath; toolDir = fullCachePath;
core.info(`cache path: ${toolDir}, key: ${cacheKey}`); core.info(`cache path: ${toolDir}, key: ${cacheKey}`);
} catch { } catch {
core.warning(`No cached files found at path "${fullCachePath}".`); core.warning(`No cached files found at path "${fullCachePath}, key: ${cacheKey}".`);
await io.rmRF(fullCachePath); await io.rmRF(fullCachePath);
} }
} else { } else {
@@ -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')}`);
} }