fix: brew isn't supported on Linux arm

This commit is contained in:
Amin Yahyaabadi 2025-03-09 00:48:26 -08:00
parent 29cd2e193a
commit fb55d3cdfe
8 changed files with 26 additions and 14 deletions

View File

@ -75,18 +75,14 @@ Download the executable for your platform from [here](https://github.com/aminya/
```shell
# windows x64
curl -o ./setup-cpp.exe -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.1.1/setup-cpp-x64-windows.exe"
# linux x64
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.1.1/setup-cpp-x64-linux"
chmod +x ./setup-cpp
# linux arm64
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.1.1/setup-cpp-arm64-linux"
# macos arm64
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.1.1/setup-cpp-arm64-macos"
chmod +x ./setup-cpp
# macos x64
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.1.1/setup-cpp-x64-macos"
chmod +x ./setup-cpp
```
An example that installs llvm, cmake, ninja, ccache, and vcpkg:
@ -99,6 +95,7 @@ An example that installs llvm, cmake, ninja, ccache, and vcpkg:
```shell
# linux/macos example
chmod +x ./setup-cpp
sudo ./setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
source ~/.cpprc # activate cpp environment variables
```

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,10 @@ import { setupBrew } from "../src/index.js"
jest.setTimeout(300000)
describe("setup-brew", () => {
if (process.platform === "win32") {
if (
process.platform === "win32"
|| process.platform === "linux" && process.arch !== "x64"
) {
it.skip("should setup brew", () => {})
return
}

View File

@ -1,6 +1,6 @@
{
"name": "setup-brew",
"version": "1.1.0",
"version": "1.1.1",
"description": "Setup brew and brew packages",
"repository": "https://github.com/aminya/setup-cpp",
"homepage": "https://github.com/aminya/setup-cpp/tree/master/packages/setup-brew",

View File

@ -1,5 +1,6 @@
import { tmpdir } from "os"
import { dirname, join } from "path"
import { warning } from "ci-log"
import { type AddPathOptions, addPath } from "envosman"
import { execaSync } from "execa"
import { DownloaderHelper } from "node-downloader-helper"
@ -21,9 +22,20 @@ export type SetupBrewOptions = {
arch?: never
}
/**
* Install brew
*
* @param options - Options for adding the brew path to the rc file
* @returns The path to the bin directory of brew if brew is installed, otherwise undefined if brew is not supported on the current platform
*/
export async function setupBrew(options: SetupBrewOptions = {}): Promise<InstallationInfo | undefined> {
// brew is only available on darwin and linux
if (!["darwin", "linux"].includes(process.platform)) {
if (
// brew is only available on darwin and linux
!["darwin", "linux"].includes(process.platform)
// brew is only supported on Linux x64
|| (process.platform === "linux" && process.arch !== "x64")
) {
warning(`Brew is not supported on ${process.platform} ${process.arch}`)
return undefined
}