Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check-action-file.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
name: Validate GitHub Actions workflows
permissions:
contents: read
runs-on: ubuntu-22.04
runs-on: arm64-mo-shanghai-4c8g
steps:
- uses: actions/checkout@v6
- name: Check for any changed workflows
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ jobs:

sca:
environment: ci
runs-on: ${{ vars.RUNNER_LABEL || 'ubuntu-22.04' }}
name: SCA Test on Ubuntu/x86
runs-on: ${{ vars.SCA_RUNNER_LABEL || 'arm64-mo-shanghai-8c16g' }}
name: SCA Test on Linux/arm64
steps:
- uses: actions/checkout@v6
with:
Expand All @@ -220,7 +220,7 @@ jobs:
go-version-file: "${{ github.workspace }}/go.mod"
- name: Prepare ENV
run: |
cd $GITHUB_WORKSPACE && make clean && make config && make build
cd $GITHUB_WORKSPACE && make clean && make config && make cgo
make install-static-check-tools
- name: Static Code Analysis
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/merge-update-moc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
Update_MOC:
name: Update MOC
environment: ci
runs-on: ubuntu-latest
runs-on: arm64-mo-shanghai-4c8g
steps:
- name: Update MOC Data
uses: matrixorigin/CI/actions/check-coverage@main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:

linux-arm64-build-job:
environment: ci
runs-on: arm64-mo-guangzhou-2xlarge16
runs-on: arm64-mo-shanghai-8c16g
steps:
- name: Checkout source
uses: actions/checkout@v6
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/robot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
issue-notify:
if: github.event_name == 'issues' && github.event.action == 'assigned'
environment: ci
runs-on: ubuntu-22.04
runs-on: arm64-mo-shanghai-4c8g
steps:
- name: ISSUE Triggered
uses: chf007/action-wechat-work@master
Expand All @@ -34,7 +34,7 @@ jobs:
check-bvt-issue:
if: github.event_name == 'issues' && github.event.action == 'closed'
environment: ci
runs-on: ubuntu-22.04
runs-on: arm64-mo-shanghai-4c8g
steps:
- name: CheckOut
uses: actions/checkout@v6
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:

issue-reopen:
environment: ci
runs-on: ubuntu-22.04
runs-on: arm64-mo-shanghai-4c8g
if: github.event_name == 'issues' && github.event.action == 'closed'
steps:
- name: Reopen Issue
Expand All @@ -86,7 +86,7 @@ jobs:

issue_close_check:
environment: ci
runs-on: ubuntu-22.04
runs-on: arm64-mo-shanghai-4c8g
if: github.event_name == 'issues' && github.event.action == 'closed'
steps:
- uses: guguducken/pull-issue-reviewer@issue_close_check_with_name
Expand Down Expand Up @@ -293,7 +293,7 @@ jobs:

issue-rm-labels:
environment: ci
runs-on: ubuntu-latest
runs-on: arm64-mo-shanghai-4c8g
if: ${{ github.event_name == 'issues' && github.event.action == 'assigned' }}
steps:
- name: Remove Labels
Expand All @@ -311,7 +311,7 @@ jobs:

reopen-without-PR:
environment: ci
runs-on: ubuntu-latest
runs-on: arm64-mo-shanghai-4c8g
if: ${{ github.event_name == 'issues' && github.event.action == 'closed' && github.actor != 'sukki37' && github.actor != 'Ariznawlll' }}
steps:
- name: Reopen Issue Without PR
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/utils.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ on:
jobs:
check_organization_user:
environment: ci
runs-on: ubuntu-22.04
runs-on: arm64-mo-shanghai-4c8g
outputs:
in_org: ${{ steps.check_in_org.outputs.in_org }}
safe_label: ${{ steps.check_safe_label.outputs.safe_label }}
Expand Down Expand Up @@ -389,7 +389,7 @@ jobs:

pr-size-label:
environment: ci
runs-on: ubuntu-22.04
runs-on: arm64-mo-shanghai-4c8g
needs: [check_organization_user]
steps:
- name: size-label
Expand Down
66 changes: 59 additions & 7 deletions actions/setup-cmake/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,20 @@ function ninja() {
required: true
});
const platform = getPlatform(core.getInput('platform'));
if (platform === 'linux' && process.arch === 'arm64') {
yield core.group('Install ninja-build via apt on linux/arm64', () => __awaiter(this, void 0, void 0, function* () {
const child_process_1 = __webpack_require__(129);
const runCommand = (command, args) => {
const result = child_process_1.spawnSync(command, args, { stdio: 'inherit' });
if (result.status !== 0) {
throw new Error(`Command failed: ${command} ${args.join(' ')}`);
}
};
runCommand('sudo', ['apt-get', 'update', '-qq']);
runCommand('sudo', ['apt-get', 'install', '-y', 'ninja-build']);
}));
return 'ninja';
}
const url = `https://github.com/ninja-build/ninja/releases/download/v${version}/ninja-${platform}.zip`;
// Get an unique output directory name from the URL.
const key = hashCode(url);
Expand Down Expand Up @@ -4776,6 +4790,28 @@ function getOutputPath(subDir) {
}
return path.join(process.env.RUNNER_TEMP, subDir);
}
function getCMakeArch(platformStr) {
const arch = process.arch;
if (platformStr === 'linux') {
if (arch === 'arm64') {
return 'aarch64';
}
if (arch === 'x64') {
return 'x86_64';
}
throw new Error(`Unsupported linux arch '${arch}'`);
}
if (platformStr === 'mac' || platformStr === 'darwin') {
if (arch === 'arm64') {
return 'arm64';
}
if (arch === 'x64') {
return 'x86_64';
}
throw new Error(`Unsupported darwin arch '${arch}'`);
}
throw new Error(`Unsupported platform '${platformStr}' for arch detection`);
}
function getPlatformData(version, platform) {
const platformStr = platform || process.platform;
switch (platformStr) {
Expand All @@ -4789,30 +4825,46 @@ function getPlatformData(version, platform) {
url: `https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-win64-x64.zip`
};
case 'mac':
case 'darwin':
case 'darwin': {
const cmakeArch = getCMakeArch('darwin');
return {
binPath: 'CMake.app/Contents/bin/',
dropSuffix: '.tar.gz',
extractFunction: tools.extractTar,
url: `https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-Darwin-x86_64.tar.gz`
url: `https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-Darwin-${cmakeArch}.tar.gz`
};
case 'linux':
}
case 'linux': {
const cmakeArch = getCMakeArch('linux');
return {
binPath: 'bin/',
dropSuffix: '.tar.gz',
extractFunction: tools.extractTar,
url: `https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-Linux-x86_64.tar.gz`
url: `https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-Linux-${cmakeArch}.tar.gz`
};
}
default:
throw new Error(`Unsupported platform '${platformStr}'`);
}
}
const MIN_LINUX_AARCH64_CMAKE = '3.22.6';
function resolveCMakeVersion(version, platform) {
const platformStr = platform || process.platform;
if (platformStr === 'linux' && process.arch === 'arm64') {
const [major, minor] = version.split('.').map(Number);
if (major < 3 || (major === 3 && minor < 19)) {
core.info(`CMake ${version} has no Linux-aarch64 prebuilt binary, using ${MIN_LINUX_AARCH64_CMAKE} instead`);
return MIN_LINUX_AARCH64_CMAKE;
}
}
return version;
}
function cmake() {
return __awaiter(this, void 0, void 0, function* () {
const version = core.getInput('cmake', {
required: true
});
const platform = core.getInput('platform');
const version = resolveCMakeVersion(core.getInput('cmake', {
required: true
}), platform);
const data = getPlatformData(version, platform);
// Get an unique output directory name from the URL.
const key = hashCode(data.url);
Expand Down
64 changes: 56 additions & 8 deletions actions/setup-cmake/src/cmake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,31 @@ function getOutputPath(subDir: string): string {
return path.join(process.env.RUNNER_TEMP, subDir);
}

function getCMakeArch(platformStr: string): string {
const arch = process.arch;
if (platformStr === 'linux') {
if (arch === 'arm64') {
return 'aarch64';
}
if (arch === 'x64') {
return 'x86_64';
}
throw new Error(`Unsupported linux arch '${arch}'`);
}

if (platformStr === 'mac' || platformStr === 'darwin') {
if (arch === 'arm64') {
return 'arm64';
}
if (arch === 'x64') {
return 'x86_64';
}
throw new Error(`Unsupported darwin arch '${arch}'`);
}

throw new Error(`Unsupported platform '${platformStr}' for arch detection`);
}

function getPlatformData(version: string, platform?: string): PackageInfo {
const platformStr = platform || process.platform;
switch (platformStr) {
Expand All @@ -58,31 +83,54 @@ function getPlatformData(version: string, platform?: string): PackageInfo {
url: `https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-win64-x64.zip`
};
case 'mac':
case 'darwin':
case 'darwin': {
const cmakeArch = getCMakeArch('darwin');
return {
binPath: 'CMake.app/Contents/bin/',
dropSuffix: '.tar.gz',
extractFunction: tools.extractTar,
url: `https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-Darwin-x86_64.tar.gz`
url: `https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-Darwin-${cmakeArch}.tar.gz`
};
case 'linux':
}
case 'linux': {
const cmakeArch = getCMakeArch('linux');
return {
binPath: 'bin/',
dropSuffix: '.tar.gz',
extractFunction: tools.extractTar,
url: `https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-Linux-x86_64.tar.gz`
url: `https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-Linux-${cmakeArch}.tar.gz`
};
}
default:
throw new Error(`Unsupported platform '${platformStr}'`);
}
}

export async function cmake(): Promise<string> {
const version = core.getInput('cmake', {
required: true
});
const MIN_LINUX_AARCH64_CMAKE = '3.22.6';

function resolveCMakeVersion(version: string, platform?: string): string {
const platformStr = platform || process.platform;
if (platformStr === 'linux' && process.arch === 'arm64') {
const [major, minor] = version.split('.').map(Number);
if (major < 3 || (major === 3 && minor < 19)) {
core.info(
`CMake ${version} has no Linux-aarch64 prebuilt binary, using ${MIN_LINUX_AARCH64_CMAKE} instead`
);
return MIN_LINUX_AARCH64_CMAKE;
}
}
return version;
}

export async function cmake(): Promise<string> {
const platform = core.getInput('platform');
const version = resolveCMakeVersion(
core.getInput('cmake', {
required: true
}),
platform
);

const data = getPlatformData(version, platform);

// Get an unique output directory name from the URL.
Expand Down
16 changes: 16 additions & 0 deletions actions/setup-cmake/src/ninja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
* Copyright (c) 2020 Luca Cappa.
*/
import * as core from '@actions/core';
import { spawnSync } from 'child_process';
import * as fs from 'fs';
import * as path from 'path';
import * as tools from '@actions/tool-cache';

function runCommand(command: string, args: string[]): void {
const result = spawnSync(command, args, { stdio: 'inherit' });
if (result.status !== 0) {
throw new Error(`Command failed: ${command} ${args.join(' ')}`);
}
}

/**
* Compute an unique number given some text.
* @param {string} text
Expand Down Expand Up @@ -59,6 +67,14 @@ export async function ninja(): Promise<string> {

const platform = getPlatform(core.getInput('platform'));

if (platform === 'linux' && process.arch === 'arm64') {
await core.group('Install ninja-build via apt on linux/arm64', async () => {
runCommand('sudo', ['apt-get', 'update', '-qq']);
runCommand('sudo', ['apt-get', 'install', '-y', 'ninja-build']);
});
return 'ninja';
}

const url = `https://github.com/ninja-build/ninja/releases/download/v${version}/ninja-${platform}.zip`;

// Get an unique output directory name from the URL.
Expand Down