Compare commits

...

16 Commits

5 changed files with 52297 additions and 55213 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
+52209 -55153
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "github-action-setup-xmake", "name": "github-action-setup-xmake",
"version": "1.2.0", "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.0", "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.0", "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",
+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')}`);
} }