mirror of https://github.com/aminya/setup-cpp.git
Compare commits
158 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
04f0267e50 | |
|
|
1155f23302 | |
|
|
867d72f10a | |
|
|
daf5d4b9da | |
|
|
31141736b3 | |
|
|
9792a2bbe0 | |
|
|
27061795a8 | |
|
|
1f17f92d6a | |
|
|
bd777f32ba | |
|
|
f3c42a2724 | |
|
|
38bbe83367 | |
|
|
156935991e | |
|
|
51ca1f1f80 | |
|
|
5c16b2f2fd | |
|
|
7c7690a1ac | |
|
|
aaf5bb78ea | |
|
|
4878b35f60 | |
|
|
957a3565d3 | |
|
|
aa2e7dbda1 | |
|
|
c9b0b918df | |
|
|
9306008c10 | |
|
|
9bc9b8cd8a | |
|
|
3481e9e840 | |
|
|
cc0e9fb8ec | |
|
|
131fbe52b0 | |
|
|
d93d404f38 | |
|
|
a55b1da658 | |
|
|
24822b26f9 | |
|
|
747e9cfe05 | |
|
|
26bd7cda45 | |
|
|
6f1d3cd81e | |
|
|
bb0daa4e32 | |
|
|
a276e6e3d1 | |
|
|
1c89539b8f | |
|
|
b32feb04d5 | |
|
|
d8571402cb | |
|
|
aa0fcb9bee | |
|
|
988cdb3377 | |
|
|
d09e6b8dab | |
|
|
c43a237684 | |
|
|
6004eca28b | |
|
|
d42bb0b88f | |
|
|
c9eb020813 | |
|
|
3cb32ec74d | |
|
|
fb3f6ad2f8 | |
|
|
559fcdd572 | |
|
|
8e6c0edd38 | |
|
|
8ffe76cee3 | |
|
|
0fa8654824 | |
|
|
928af1ef3b | |
|
|
751b635450 | |
|
|
056bb3b1d9 | |
|
|
fe10751e1c | |
|
|
c0171961c2 | |
|
|
ce9f94db97 | |
|
|
9392dd1bd8 | |
|
|
2e6bb1caa0 | |
|
|
004edc1952 | |
|
|
46cbfc276f | |
|
|
396258ba63 | |
|
|
70e614fd48 | |
|
|
075261cd2b | |
|
|
fcda129998 | |
|
|
42ccc76417 | |
|
|
af7dd8c367 | |
|
|
b21cd99e0b | |
|
|
085eecfbd1 | |
|
|
197080ad94 | |
|
|
15c6190549 | |
|
|
38b4d16f6e | |
|
|
00a96b353f | |
|
|
8d6f65af17 | |
|
|
55470af31b | |
|
|
820b8f3163 | |
|
|
3a19939866 | |
|
|
3b773c4e87 | |
|
|
0d11c74dbd | |
|
|
f0dab3c2eb | |
|
|
f015113d31 | |
|
|
9dc9c217f4 | |
|
|
5649ee9e2d | |
|
|
ecb2ccca2e | |
|
|
2a58e75f05 | |
|
|
f1825e19b6 | |
|
|
e09ae7eb8e | |
|
|
45a956b27e | |
|
|
1cfde8e589 | |
|
|
a4ca8de391 | |
|
|
022729da27 | |
|
|
6b72a94712 | |
|
|
464f3a00d5 | |
|
|
faff663ab1 | |
|
|
da1971da81 | |
|
|
dbf5b5e2bf | |
|
|
3fd1b0b32c | |
|
|
988b5fd210 | |
|
|
c9348d3629 | |
|
|
9b5350fb6e | |
|
|
b7dcc5b7e6 | |
|
|
264de9ab1a | |
|
|
fc5f36e99b | |
|
|
1134b80cc2 | |
|
|
6540167f34 | |
|
|
62036a9dd7 | |
|
|
350b16f518 | |
|
|
4c0bf0acdb | |
|
|
ecc6c767e0 | |
|
|
00fe6df1cf | |
|
|
46ac5adacc | |
|
|
e10853e3f5 | |
|
|
3fffbe9648 | |
|
|
c9145519e3 | |
|
|
5c5dffcda7 | |
|
|
6c94aa9d63 | |
|
|
80ffb63efd | |
|
|
5accdbc0a7 | |
|
|
d8c2b30cb3 | |
|
|
829f53844a | |
|
|
28288fd7bc | |
|
|
5ea110ae8d | |
|
|
9bc8921c0a | |
|
|
e8ac0e7160 | |
|
|
9d12750bbe | |
|
|
c9007c8f5a | |
|
|
05bd2b5297 | |
|
|
3d8c387d48 | |
|
|
55f022dea4 | |
|
|
75890615f7 | |
|
|
a7162273d0 | |
|
|
f40cb3bc3f | |
|
|
ac92a10732 | |
|
|
d10f4b6db0 | |
|
|
8fb6bd1b28 | |
|
|
a993d3ff56 | |
|
|
d0235b0adb | |
|
|
79f7ff95eb | |
|
|
3bc026fd01 | |
|
|
6c5ed96033 | |
|
|
70850773b2 | |
|
|
186f2dc52d | |
|
|
b683fdffce | |
|
|
bb5b6b1b44 | |
|
|
6370aaa025 | |
|
|
95a7de4f2e | |
|
|
d6447bbe91 | |
|
|
71c0122abf | |
|
|
ad7d44b1e3 | |
|
|
7e66da1495 | |
|
|
f37a612a84 | |
|
|
d60a91780b | |
|
|
a5ee5b0e9b | |
|
|
dc7c474237 | |
|
|
a8782096b0 | |
|
|
f5f4ddffea | |
|
|
6ef4c24024 | |
|
|
d1834415a9 | |
|
|
68964ee26c | |
|
|
6ee48d5c81 |
|
|
@ -12,7 +12,7 @@ concurrency:
|
|||
|
||||
env:
|
||||
NODE_OPTIONS: --enable-source-maps
|
||||
version: "1.4.0"
|
||||
version: "1.8.0"
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
|
|
@ -24,30 +24,32 @@ jobs:
|
|||
os:
|
||||
- ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.head_ref || github.ref_name }}
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version-file: "./.nvmrc"
|
||||
|
||||
- name: Setup Pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: "package.json"
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
pnpm install
|
||||
bun install
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
pnpm build
|
||||
pnpm build.docker-ci
|
||||
bun run build
|
||||
bun run build.docker-ci
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
pnpm run test.lint
|
||||
bun run test.lint
|
||||
|
||||
- name: Update Dist
|
||||
run: |
|
||||
|
|
@ -67,7 +69,7 @@ jobs:
|
|||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload Dist
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
if: always()
|
||||
with:
|
||||
name: dist
|
||||
|
|
@ -85,50 +87,65 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2019
|
||||
- ubuntu-20.04
|
||||
- windows-2022
|
||||
- ubuntu-22.04
|
||||
- ubuntu-22.04-arm
|
||||
- macos-13 # x64
|
||||
- macos-15-intel # x64
|
||||
- macos-14 # arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: dist
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version-file: "./.nvmrc"
|
||||
|
||||
- name: Setup Pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: "package.json"
|
||||
|
||||
- name: Cache node_modules
|
||||
if: ${{ !contains(matrix.os, 'windows') }}
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
D:\.pnpm-store
|
||||
~/.bun
|
||||
./node_modules
|
||||
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-${{ hashFiles('./.npmrc', './package.json', './.nvmrc', './pnpm-*.yaml') }}"
|
||||
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-${{ hashFiles('./.npmrc', './package.json', './.nvmrc', './bun.lock') }}"
|
||||
restore-keys: |
|
||||
"setupcpp-node_modules-cache-OS:${{ matrix.os }}-"
|
||||
|
||||
- name: Cache Turbo
|
||||
uses: rharkor/caching-for-turbo@v1.8
|
||||
|
||||
- name: Cache .cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
./.cache/eslint
|
||||
./.cache/cspell
|
||||
/home/runner/.cache/dprint
|
||||
key: "setupcpp-cache-OS:${{ matrix.os }}-${{ hashFiles('./*.json', './.*rc', './*.yml') }}"
|
||||
restore-keys: |
|
||||
"setupcpp-cache-OS:${{ matrix.os }}-"
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
pnpm install
|
||||
bun install
|
||||
|
||||
# Create self-contained executable that bundles Nodejs
|
||||
- name: Create Executable
|
||||
run: |
|
||||
pnpm run pack.exe
|
||||
bun run pack.exe
|
||||
|
||||
- name: Upload Executables
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: exe-${{ matrix.os }}
|
||||
path: |
|
||||
|
|
@ -144,51 +161,50 @@ jobs:
|
|||
matrix:
|
||||
os:
|
||||
- windows-2022
|
||||
- windows-2019
|
||||
- ubuntu-24.04-arm
|
||||
- ubuntu-24.04
|
||||
- ubuntu-22.04-arm
|
||||
- ubuntu-22.04
|
||||
- ubuntu-20.04
|
||||
# - ubuntu-20.04
|
||||
- macos-15 # arm64
|
||||
# - macos-15-large # x64
|
||||
- macos-14 # arm64
|
||||
# - macos-14-large # x64
|
||||
- macos-15-intel # x64
|
||||
# - macos-14-xlarge #arm64
|
||||
- macos-13 # x64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Download Dist
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: dist
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version-file: "./.nvmrc"
|
||||
|
||||
- name: Setup Pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: "package.json"
|
||||
|
||||
- name: Cache node_modules
|
||||
if: ${{ !contains(matrix.os, 'windows') }}
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
~/.pnpm-store
|
||||
D:\.pnpm-store
|
||||
~/.bun
|
||||
./node_modules
|
||||
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-${{ hashFiles('./.npmrc', './package.json', './.nvmrc', './pnpm-*.yaml') }}"
|
||||
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-${{ hashFiles('./.npmrc', './package.json', './.nvmrc', './bun.lock') }}"
|
||||
restore-keys: |
|
||||
"setupcpp-node_modules-cache-OS:${{ matrix.os }}-"
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
pnpm install
|
||||
bun install
|
||||
|
||||
# - name: Setup SSH debugging session
|
||||
# uses: mxschmitt/action-tmate@v3
|
||||
|
|
@ -196,12 +212,12 @@ jobs:
|
|||
- name: Tests
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip test]') }}
|
||||
run: |
|
||||
pnpm run test
|
||||
bun run test
|
||||
env:
|
||||
RUNNER_OS_NAME: ${{ matrix.os }}
|
||||
|
||||
- name: Setup Node 20
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
|
|
@ -220,7 +236,7 @@ jobs:
|
|||
|
||||
- name: Setup Node 12
|
||||
if: ${{ !contains(matrix.os, 'macos-14') && !contains(matrix.os, 'macos-15') }}
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 12
|
||||
- name: Smoke Test Legacy Bundle
|
||||
|
|
@ -243,7 +259,7 @@ jobs:
|
|||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "24.04" }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04" }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "20.04" }
|
||||
- { distro: "fedora", image: "setup-cpp-fedora", tag: "40" }
|
||||
- { distro: "fedora", image: "setup-cpp-fedora", tag: "44" }
|
||||
- { distro: "arch", image: "setup-cpp-arch", tag: "base" }
|
||||
- { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21", base_version: "22-alpine3.21" }
|
||||
include:
|
||||
|
|
@ -260,12 +276,12 @@ jobs:
|
|||
platform: linux/arm64
|
||||
container: { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21", base_version: "22-alpine3.21" }
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Download Dist
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: dist
|
||||
|
||||
|
|
@ -313,7 +329,7 @@ jobs:
|
|||
|
||||
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}
|
||||
if: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
|
||||
uses: peter-evans/dockerhub-description@v4
|
||||
uses: peter-evans/dockerhub-description@v5
|
||||
with:
|
||||
username: aminya
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
|
@ -322,6 +338,7 @@ jobs:
|
|||
|
||||
- name: Build setup-cpp-${{matrix.container.distro }}-llvm
|
||||
id: build_llvm
|
||||
if: ${{ matrix.container.distro != 'arch' }}
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
|
|
@ -335,19 +352,20 @@ jobs:
|
|||
cache-to: type=inline
|
||||
|
||||
- name: Tag latest locally
|
||||
if: ${{ matrix.container.distro != 'arch' }}
|
||||
run: |
|
||||
docker tag aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-llvm:latest
|
||||
docker tag aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}
|
||||
|
||||
- name: Push latest to Docker Hub
|
||||
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'alpine' }}
|
||||
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'alpine' && matrix.container.distro != 'arch' }}
|
||||
run: |
|
||||
docker push aminya/${{ matrix.container.image }}-llvm:latest
|
||||
docker push aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}
|
||||
|
||||
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}-llvm
|
||||
if: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
|
||||
uses: peter-evans/dockerhub-description@v4
|
||||
if: ${{ (github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]')) && matrix.container.distro != 'arch' }}
|
||||
uses: peter-evans/dockerhub-description@v5
|
||||
with:
|
||||
username: aminya
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
|
@ -355,7 +373,7 @@ jobs:
|
|||
readme-filepath: ./README_DOCKER.md
|
||||
|
||||
- name: Test LLVM
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip test]') }}
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && matrix.container.distro != 'arch' }}
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
|
|
@ -391,7 +409,7 @@ jobs:
|
|||
|
||||
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}-gcc
|
||||
if: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
|
||||
uses: peter-evans/dockerhub-description@v4
|
||||
uses: peter-evans/dockerhub-description@v5
|
||||
with:
|
||||
username: aminya
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
|
@ -436,7 +454,7 @@ jobs:
|
|||
|
||||
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}-mingw
|
||||
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'fedora' && !(matrix.container.distro == 'alpine' && matrix.platform == 'linux/arm64') }}
|
||||
uses: peter-evans/dockerhub-description@v4
|
||||
uses: peter-evans/dockerhub-description@v5
|
||||
with:
|
||||
username: aminya
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
|
@ -479,7 +497,7 @@ jobs:
|
|||
- { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21", suffix: "", latest: true }
|
||||
- { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21", suffix: "-llvm", latest: true }
|
||||
- { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21", suffix: "-gcc", latest: true }
|
||||
- { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21", suffix: "-mingw", latest: true }
|
||||
# - { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21", suffix: "-mingw", latest: true }
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
|
@ -518,7 +536,7 @@ jobs:
|
|||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Download Executables
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
pattern: exe-*
|
||||
path: ./exe/
|
||||
|
|
@ -530,7 +548,7 @@ jobs:
|
|||
chmod +x -R ./exe/
|
||||
|
||||
- name: Download Dist
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
|
|
|
|||
|
|
@ -24,3 +24,5 @@ coverage
|
|||
/src/llvm/assets/
|
||||
|
||||
/build
|
||||
dist/library
|
||||
*.tgz
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
.DS_Store
|
||||
Thumbs.db
|
||||
**/node_modules
|
||||
**/temp-*
|
||||
**/tsconfig.tsbuildinfo
|
||||
.parcel-cache
|
||||
**/exe/
|
||||
**/log
|
||||
**/exe
|
||||
**/cache
|
||||
**/.cache
|
||||
**/coverage
|
||||
**/.turbo
|
||||
src/llvm/assets/
|
||||
**/build
|
||||
**/__tests__
|
||||
**/dev/cpp_vcpkg_project
|
||||
**/packages/*/dist/
|
||||
**/*.tgz
|
||||
**/.eslintrc.json
|
||||
**/jest.config.mjs
|
||||
.vscode/
|
||||
.github/
|
||||
biome.jsonc
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
import { buildTerserOptions } from "terser-config-atomic/dist/builder.js"
|
||||
const config = buildTerserOptions(process.env.NODE_ENV, undefined, true)
|
||||
|
||||
if (
|
||||
typeof config.compress === "object"
|
||||
&& "unsafe_math" in config.compress
|
||||
) {
|
||||
config.compress.unsafe_math = false
|
||||
}
|
||||
|
||||
export default config
|
||||
|
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.21...3.28)
|
|||
|
||||
project(
|
||||
setup_cpp_tests
|
||||
VERSION 1.4.0
|
||||
VERSION 1.8.0
|
||||
DESCRIPTION "Tests for setup-cpp"
|
||||
HOMEPAGE_URL "https://github.com/aminya/setup-cpp"
|
||||
LANGUAGES CXX C)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Contributing
|
||||
|
||||
You will need [`pnpm`](https://pnpm.io/installation) to build and test `setup-cpp`:
|
||||
You will need [`bun`](https://bun.com/) to build and test `setup-cpp`:
|
||||
|
||||
```shell
|
||||
pnpm install
|
||||
bun install
|
||||
```
|
||||
|
||||
To avoid permenant changes to your system, you can use the test docker images under `./dev/docker/__tests__`.
|
||||
|
|
|
|||
83
README.md
83
README.md
|
|
@ -31,12 +31,12 @@ Setting up a **cross-platform** environment for building and testing C++/C proje
|
|||
| --------------- | ----------------------------------------------------------------------------------------------------------- |
|
||||
| compiler | llvm, gcc, msvc, apple-clang, vcvarsall |
|
||||
| build system | cmake, ninja, meson, make, task, bazel |
|
||||
| package manager | vcpkg, conan, choco, brew, nala, git, setup-cpp |
|
||||
| package manager | vcpkg, conan, choco, brew, apt-fast, nala, git, setup-cpp |
|
||||
| analyzer/linter | clang-tidy, clang-format, cppcheck, cpplint, flawfinder, lizard, infer, cmakelang, cmake-format, cmake-lint |
|
||||
| cache | ccache, sccache |
|
||||
| documentation | doxygen, graphviz |
|
||||
| coverage | gcovr, opencppcoverage, kcov |
|
||||
| other | python, powershell, sevenzip |
|
||||
| other | python, powershell, sevenzip, tar |
|
||||
|
||||
`setup-cpp` automatically handles the dependencies of the selected tool (e.g., `python` is required for `conan`).
|
||||
|
||||
|
|
@ -70,19 +70,19 @@ NOTE: setup-cpp requires Nodejs 12 or higher. If Nodejs shipped with your distri
|
|||
|
||||
#### With executable
|
||||
|
||||
Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v1.4.0), and run it with the available options. You can also automate downloading using `curl`, or other similar tools.
|
||||
Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v1.8.0), and run it with the available options. You can also automate downloading using `curl`, or other similar tools.
|
||||
|
||||
```shell
|
||||
# windows x64
|
||||
curl -o ./setup-cpp.exe -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.4.0/setup-cpp-x64-windows.exe"
|
||||
curl -o ./setup-cpp.exe -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.8.0/setup-cpp-x64-windows.exe"
|
||||
# linux x64
|
||||
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.4.0/setup-cpp-x64-linux"
|
||||
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.8.0/setup-cpp-x64-linux"
|
||||
# linux arm64
|
||||
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.4.0/setup-cpp-arm64-linux"
|
||||
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.8.0/setup-cpp-arm64-linux"
|
||||
# macos arm64
|
||||
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.4.0/setup-cpp-arm64-macos"
|
||||
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.8.0/setup-cpp-arm64-macos"
|
||||
# macos x64
|
||||
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.4.0/setup-cpp-x64-macos"
|
||||
curl -o ./setup-cpp -LJ "https://github.com/aminya/setup-cpp/releases/download/v1.8.0/setup-cpp-x64-macos"
|
||||
```
|
||||
|
||||
An example that installs llvm, cmake, ninja, ccache, and vcpkg:
|
||||
|
|
@ -213,8 +213,8 @@ The tags are in the following template:
|
|||
|
||||
- Base image: `aminya/setup-cpp-ubuntu:24.04`
|
||||
- Compiler image: `aminya/setup-cpp-ubuntu-llvm:24.04`
|
||||
- Base image with pinned setup-cpp version: `aminya/setup-cpp-ubuntu:24.04-v1.4.0`
|
||||
- Compiler image with pinned setup-cpp version: `aminya/setup-cpp-ubuntu-llvm:24.04-v1.4.0`
|
||||
- Base image with pinned setup-cpp version: `aminya/setup-cpp-ubuntu:24.04-v1.8.0`
|
||||
- Compiler image with pinned setup-cpp version: `aminya/setup-cpp-ubuntu-llvm:24.04-v1.8.0`
|
||||
|
||||
The supported platforms are `ubuntu`, `alpine`, `fedora`, and `arch`. The supported compilers are `llvm`, `gcc`, and `mingw`.
|
||||
|
||||
|
|
@ -264,6 +264,34 @@ FROM aminya/setup-cpp-ubuntu-gcc:20.04 AS builder
|
|||
FROM aminya/setup-cpp-ubuntu-mingw:20.04 AS builder
|
||||
```
|
||||
|
||||
#### Alpine Images (amd64 and arm64)
|
||||
|
||||
Setup-cpp provides prebuilt images for Alpine with support for base tools, and compilers `llvm`, `gcc`, and `mingw` available for `amd64` and `arm64` architectures.
|
||||
|
||||
Base image with `cmake, ninja, task, vcpkg, python, make, cppcheck, gcovr, doxygen, ccache, conan, meson, cmakelang` for Alpine 3.18:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-alpine:3.21 AS builder
|
||||
```
|
||||
|
||||
Image with `llvm` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-alpine-llvm:3.21 AS builder
|
||||
```
|
||||
|
||||
Image with `gcc` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-alpine-gcc:3.21 AS builder
|
||||
```
|
||||
|
||||
Image with `mingw` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-alpine-mingw:3.21 AS builder
|
||||
```
|
||||
|
||||
#### Fedora Images (amd64)
|
||||
|
||||
<details>
|
||||
|
|
@ -338,7 +366,7 @@ RUN apt-get update -qq && \
|
|||
# install nodejs
|
||||
apt-get install -y --no-install-recommends nodejs npm && \
|
||||
# install setup-cpp
|
||||
npm install -g setup-cpp@v1.4.0 && \
|
||||
npm install -g setup-cpp@v1.8.0 && \
|
||||
# install the compiler and tools
|
||||
NODE_OPTIONS="--enable-source-maps" \
|
||||
setup-cpp \
|
||||
|
|
@ -448,7 +476,7 @@ stages:
|
|||
apt-get install -y --no-install-recommends nodejs npm
|
||||
|
||||
# install setup-cpp
|
||||
npm install -g setup-cpp@v1.4.0
|
||||
npm install -g setup-cpp@v1.8.0
|
||||
|
||||
# install the compiler and tools
|
||||
./setup-cpp-x64-linux --compiler $compiler --cmake true --ninja true --ccache true --vcpkg true
|
||||
|
|
@ -477,6 +505,37 @@ test_linux_gcc:
|
|||
- *test
|
||||
```
|
||||
|
||||
### As a Library in Nodejs
|
||||
|
||||
```ts
|
||||
import { setupCpp, success, error } from "setup-cpp"
|
||||
|
||||
async function main() {
|
||||
const { errorMessages, successMessages } = await setupCpp({
|
||||
compiler: "llvm",
|
||||
cmake: true,
|
||||
ninja: true,
|
||||
vcpkg: true,
|
||||
})
|
||||
|
||||
for (const message of errorMessages) {
|
||||
error(message)
|
||||
}
|
||||
for (const message of successMessages) {
|
||||
success(message)
|
||||
}
|
||||
|
||||
if (errorMessages.length !== 0) {
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
})
|
||||
```
|
||||
|
||||
## Articles
|
||||
|
||||
[Setup-Cpp on Dev.to](https://dev.to/aminya/setup-cpp-3ia4)
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ The tags are in the following template:
|
|||
|
||||
- Base image: `aminya/setup-cpp-ubuntu:24.04`
|
||||
- Compiler image: `aminya/setup-cpp-ubuntu-llvm:24.04`
|
||||
- Base image with pinned setup-cpp version: `aminya/setup-cpp-ubuntu:24.04-v1.4.0`
|
||||
- Compiler image with pinned setup-cpp version: `aminya/setup-cpp-ubuntu-llvm:24.04-v1.4.0`
|
||||
- Base image with pinned setup-cpp version: `aminya/setup-cpp-ubuntu:24.04-v1.8.0`
|
||||
- Compiler image with pinned setup-cpp version: `aminya/setup-cpp-ubuntu-llvm:24.04-v1.8.0`
|
||||
|
||||
The supported platforms are `ubuntu`, `alpine`, `fedora`, and `arch`. The supported compilers are `llvm`, `gcc`, and `mingw`.
|
||||
|
||||
|
|
|
|||
|
|
@ -163,6 +163,12 @@ inputs:
|
|||
node-package-manager:
|
||||
description: "The node package manager to use (npm/yarn/pnpm) when installing setup-cpp globally"
|
||||
required: false
|
||||
git:
|
||||
description: "Wether to install git (true/false) or the specific version to install."
|
||||
required: false
|
||||
tar:
|
||||
description: "Wether to install tar (true/false) or the specific version to install."
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: "node20"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { TransformOptions } from "@babel/core"
|
||||
// @ts-ignore
|
||||
// @ts-expect-error no types
|
||||
import RemoveNodePrefix from "@upleveled/babel-plugin-remove-node-prefix"
|
||||
|
||||
const babelConfig: TransformOptions = {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
[install]
|
||||
linker = "hoisted"
|
||||
|
|
@ -31,6 +31,8 @@ words:
|
|||
- clangd
|
||||
- cmake
|
||||
- cmakeformat
|
||||
- cmakelang
|
||||
- cmakelint
|
||||
- cobertura
|
||||
- copr
|
||||
- CPATH
|
||||
|
|
@ -48,6 +50,7 @@ words:
|
|||
- dyld
|
||||
- eabi
|
||||
- envosman
|
||||
- envosmanrc
|
||||
- esac
|
||||
- esbuild
|
||||
- esmodule
|
||||
|
|
@ -57,11 +60,13 @@ words:
|
|||
- gcovr
|
||||
- ghes
|
||||
- Graphviz
|
||||
- gtar
|
||||
- hadolint
|
||||
- iarna
|
||||
- inja
|
||||
- isci
|
||||
- isroot
|
||||
- jsonify
|
||||
- kcov
|
||||
- LDFLAGS
|
||||
- lefticus
|
||||
|
|
@ -71,6 +76,7 @@ words:
|
|||
- libstdc
|
||||
- libtinfo
|
||||
- liuli
|
||||
- llvmorg
|
||||
- mdimporterdir
|
||||
- memoizee
|
||||
- mkdirp
|
||||
|
|
@ -100,6 +106,7 @@ words:
|
|||
- pygments
|
||||
- pypy
|
||||
- qlplugindir
|
||||
- rharkor
|
||||
- Sccache
|
||||
- setupcpp
|
||||
- setx
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
## base image
|
||||
FROM --platform=$BUILDPLATFORM fedora:40 AS fedora-nodejs
|
||||
FROM --platform=$BUILDPLATFORM fedora:44 AS fedora-nodejs
|
||||
|
||||
# install nodejs
|
||||
RUN dnf -y install nodejs npm && \
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ COPY "./dist/modern" "/usr/lib/setup-cpp/"
|
|||
|
||||
# install the cpp tools
|
||||
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
|
||||
--apt-fast true \
|
||||
--cmake true \
|
||||
--ninja true \
|
||||
--task true \
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
## base image
|
||||
FROM fedora:40 AS setup-cpp-fedora
|
||||
FROM fedora:44 AS setup-cpp-fedora
|
||||
|
||||
# install nodejs
|
||||
RUN dnf -y install nodejs npm && \
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
## base image
|
||||
FROM fedora:40 AS setup-cpp-fedora-mingw
|
||||
FROM fedora:44 AS setup-cpp-fedora-mingw
|
||||
|
||||
# install nodejs
|
||||
RUN dnf -y install nodejs npm && \
|
||||
|
|
|
|||
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
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
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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -143,5 +143,5 @@ if [[ "${VERSION_CODENAME}" == "bookworm" ]]; then
|
|||
add-apt-repository -y "${REPO_NAME}"
|
||||
fi
|
||||
|
||||
add-apt-repository -y --no-update --remove "${REPO_NAME}"
|
||||
add-apt-repository -y --remove "${REPO_NAME}"
|
||||
apt-get update
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
{"ninja":"1.12.1","cmake":"3.31.4","task":"3.40.1","powershell":"7.4.5","pip":">=22.2.0","python":">=3.7.9","meson":{"linux":{"ubuntu":{"20":"1.6.1","18":"0.61.4","else":"0.61.4"},"else":"1.6.1"},"else":"1.6.1"},"kcov":{"linux":{"ubuntu":{"22":"42-binary","20":"40-binary","14":"40","else":"42"},"else":"42"},"else":"42"},"doxygen":{"linux":{"archlinux":"1.13.2-1","ubuntu":{"22":"1.13.2","18":"1.10.0","else":"1.10.0"},"else":"1.13.2"},"else":"1.13.2"},"gcc":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","else":""},"mingw":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","else":""},"gcovr":{"linux":{"ubuntu":{"20":"","18":"5.0","else":"5.0"},"else":""},"else":""},"nala":{"linux":{"ubuntu":{"22":"","21":"legacy","else":"legacy"},"else":""},"else":""},"llvm":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clang":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clang++":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clang-tidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clangtidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clang-format":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clangformat":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"}}
|
||||
{"ninja":"1.13.2","cmake":"3.31.10","task":"3.46.4","powershell":"7.5.1","pip":">=22.2.0","python":">=3.7.9","meson":{"linux":{"ubuntu":{"20":"1.10.0","18":"0.61.4","else":"0.61.4"},"else":"1.10.0"},"else":"1.10.0"},"kcov":{"linux":{"ubuntu":{"22":"42-binary","20":"40-binary","14":"40","else":"42"},"else":"42"},"else":"42"},"doxygen":{"linux":{"archlinux":"1.15.0-2","ubuntu":{"22":"","18":"1.10.0","else":"1.10.0"},"else":""},"else":"1.15.0"},"tar":{"win32":"1.13-1","else":""},"gcc":{"win32":"15.2.0posix-13.0.0-ucrt-r5","else":""},"mingw":{"win32":"15.2.0posix-13.0.0-ucrt-r5","else":""},"gcovr":{"linux":{"ubuntu":{"20":"","18":"5.0","else":"5.0"},"else":""},"else":""},"nala":{"linux":{"ubuntu":{"22":"","21":"legacy","else":"legacy"},"else":""},"else":""},"llvm":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clang":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clang++":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clang-tidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clangtidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clang-format":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clangformat":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"}}
|
||||
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
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
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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -143,5 +143,5 @@ if [[ "${VERSION_CODENAME}" == "bookworm" ]]; then
|
|||
add-apt-repository -y "${REPO_NAME}"
|
||||
fi
|
||||
|
||||
add-apt-repository -y --no-update --remove "${REPO_NAME}"
|
||||
add-apt-repository -y --remove "${REPO_NAME}"
|
||||
apt-get update
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
{"ninja":"1.12.1","cmake":"3.31.4","task":"3.40.1","powershell":"7.4.5","pip":">=22.2.0","python":">=3.7.9","meson":{"linux":{"ubuntu":{"20":"1.6.1","18":"0.61.4","else":"0.61.4"},"else":"1.6.1"},"else":"1.6.1"},"kcov":{"linux":{"ubuntu":{"22":"42-binary","20":"40-binary","14":"40","else":"42"},"else":"42"},"else":"42"},"doxygen":{"linux":{"archlinux":"1.13.2-1","ubuntu":{"22":"1.13.2","18":"1.10.0","else":"1.10.0"},"else":"1.13.2"},"else":"1.13.2"},"gcc":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","else":""},"mingw":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","else":""},"gcovr":{"linux":{"ubuntu":{"20":"","18":"5.0","else":"5.0"},"else":""},"else":""},"nala":{"linux":{"ubuntu":{"22":"","21":"legacy","else":"legacy"},"else":""},"else":""},"llvm":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clang":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clang++":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clang-tidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clangtidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clang-format":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"},"clangformat":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"19.1.6"}}
|
||||
{"ninja":"1.13.2","cmake":"3.31.10","task":"3.46.4","powershell":"7.5.1","pip":">=22.2.0","python":">=3.7.9","meson":{"linux":{"ubuntu":{"20":"1.10.0","18":"0.61.4","else":"0.61.4"},"else":"1.10.0"},"else":"1.10.0"},"kcov":{"linux":{"ubuntu":{"22":"42-binary","20":"40-binary","14":"40","else":"42"},"else":"42"},"else":"42"},"doxygen":{"linux":{"archlinux":"1.15.0-2","ubuntu":{"22":"","18":"1.10.0","else":"1.10.0"},"else":""},"else":"1.15.0"},"tar":{"win32":"1.13-1","else":""},"gcc":{"win32":"15.2.0posix-13.0.0-ucrt-r5","else":""},"mingw":{"win32":"15.2.0posix-13.0.0-ucrt-r5","else":""},"gcovr":{"linux":{"ubuntu":{"20":"","18":"5.0","else":"5.0"},"else":""},"else":""},"nala":{"linux":{"ubuntu":{"22":"","21":"legacy","else":"legacy"},"else":""},"else":""},"llvm":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clang":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clang++":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clang-tidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clangtidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clang-format":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"},"clangformat":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"20.1.8"}}},"linux":{"alpine":{"else":{"else":"19.1.7"}},"else":"20.1.8"},"else":"20.1.8"}}
|
||||
|
|
@ -2,6 +2,6 @@ pre-commit:
|
|||
parallel: false
|
||||
commands:
|
||||
test.lint:
|
||||
run: pnpm run test.lint
|
||||
run: bun run test.lint
|
||||
build:
|
||||
run: pnpm run clean && pnpm run build -- --no-color && git add ./dist
|
||||
run: bun run build -- --no-color && git add ./dist
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"name": "setup-cpp",
|
||||
"version": "1.4.0"
|
||||
"version": "1.8.0"
|
||||
}
|
||||
|
|
|
|||
131
package.json
131
package.json
|
|
@ -1,84 +1,76 @@
|
|||
{
|
||||
"name": "setup-cpp",
|
||||
"version": "1.4.0",
|
||||
"version": "1.8.0",
|
||||
"description": "Install all the tools required for building and testing C++/C projects.",
|
||||
"repository": "https://github.com/aminya/setup-cpp",
|
||||
"license": "Apache-2.0",
|
||||
"author": "Amin Yahyaabadi",
|
||||
"main": "dist/legacy/setup-cpp.js",
|
||||
"modern": "./dist/modern/setup-cpp.mjs",
|
||||
"source": "./src/setup-cpp.ts",
|
||||
"main": "dist/library/lib.mjs",
|
||||
"modern": "dist/library/lib.mjs",
|
||||
"source": "./src/lib.ts",
|
||||
"bin": {
|
||||
"setup-cpp": "dist/legacy/setup-cpp.js"
|
||||
},
|
||||
"files": [
|
||||
"action.yml",
|
||||
".dockerignore",
|
||||
"dist",
|
||||
"src",
|
||||
"packages",
|
||||
"dev/docker",
|
||||
"README.md",
|
||||
"LICENSE.txt",
|
||||
"LICENSE.dependencies.txt",
|
||||
"package.json",
|
||||
"package-version.json",
|
||||
"tsconfig.json"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "turbo build && run-p lint.root.tsc build.vite build.vite.legacy && run-p build.json build.bash",
|
||||
"build.vite": "cross-env NODE_ENV=production vite build",
|
||||
"build.vite.legacy": "cross-env NODE_ENV=production TARGET=legacy vite build",
|
||||
"build.json": "shx cp ./src/*/*.json ./dist/legacy/ && shx cp ./dist/legacy/*.json ./dist/modern && minijson --file ./dist/**/*.json",
|
||||
"build": "turbo build && run-p build.types.modern lint.root.tsc build.cli.modern build.cli.legacy build.library && run-p build.json build.bash",
|
||||
"build.cli.modern": "cross-env NODE_ENV=production vite build --mode cli-modern",
|
||||
"build.cli.legacy": "cross-env NODE_ENV=production vite build --mode cli-legacy",
|
||||
"build.library": "cross-env NODE_ENV=production vite build --mode library",
|
||||
"build.types.modern": "tsc -p ./tsconfig.types.json",
|
||||
"build.json": "shx cp ./src/*/*.json ./dist/legacy/ && shx cp ./dist/legacy/*.json ./dist/modern && bun ./node_modules/@aminya/minijson/dist/cli.js --file \"dist/**/*.json\"",
|
||||
"build.bash": "shx cp ./src/*/*.bash ./dist/legacy/ && shx cp ./dist/legacy/*.bash ./dist/modern",
|
||||
"bump": "ncu -u -x execa,numerous,eslint,@types/eslint,which && pnpm update && pnpx typesync && pnpm run clean",
|
||||
"bump.llvm": "GITHUB_TOKEN=$(gh auth token) tsx ./src/llvm/assets-list.ts",
|
||||
"bump.gcc": "GITHUB_TOKEN=$(gh auth token) tsx ./src/gcc/assets-list.ts",
|
||||
"bump.infer": "GITHUB_TOKEN=$(gh auth token) tsx ./src/infer/assets-list.ts",
|
||||
"bump.versions": "run-p bump.llvm bump.gcc bump.infer && run-s format",
|
||||
"bump": "ncu -u -x execa,numerous,eslint,@types/eslint,which && bun update && pnpx typesync && bun run clean",
|
||||
"bump.llvm": "tsx ./src/llvm/assets-list.ts",
|
||||
"bump.gcc": "tsx ./src/gcc/assets-list.ts",
|
||||
"bump.infer": "tsx ./src/infer/assets-list.ts",
|
||||
"bump.versions": "run-p bump.llvm bump.gcc bump.infer && bun run format",
|
||||
"clean": "shx rm -rf ./dist ./packages/*/dist ./exe ./.parcel-cache && shx mkdir -p ./dist/legacy ./dist/modern ./dist/modern ",
|
||||
"dev.vite": "cross-env NODE_ENV=development vite build --watch",
|
||||
"dev.packages": "turbo dev",
|
||||
"dev.root.tsc": "tsc --noEmit --pretty --watch",
|
||||
"dev": "run-p build.json dev.packages dev.root.tsc dev.vite",
|
||||
"docs": "shx rm -rf packages/*/README.md && pnpm -r exec readme --path ../../dev/readme/template.md -y && pnpm -r exec ts-readme",
|
||||
"format": "run-s lint.dprint",
|
||||
"lint": "turbo lint && run-p --aggregate-output --continue-on-error lint.**",
|
||||
"docs": "shx rm -rf packages/*/README.md && bun -r exec readme --path ../../dev/readme/template.md -y && bun -r exec ts-readme",
|
||||
"format": "bun run lint.dprint",
|
||||
"lint": "turbo lint && run-p --aggregate-output -c 'lint.*'",
|
||||
"lint.cspell": "cspell lint --no-progress --show-suggestions --cache --cache-location ./.cache/cspell/.cspellcache",
|
||||
"lint.biome": "biome check --write --unsafe",
|
||||
"lint.dprint": "dprint fmt",
|
||||
"lint.root.tsc": "tsc --noEmit --pretty",
|
||||
"lint.root.eslint": "eslint './{src,dev}/**/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml}' --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
||||
"pack.exe": "shx rm -rf ./dist/tsconfig.tsbuildinfo && node ./dev/scripts/pack-exe.mjs",
|
||||
"publish.all": "pnpm -r publish",
|
||||
"prepublishOnly": "run-s build && shx rm ./dist/tsconfig.tsbuildinfo",
|
||||
"test.lint": "run-p --aggregate-output --continue-on-error test.lint.** lint.cspell lint.root.tsc",
|
||||
"publish.all": "bun -r publish",
|
||||
"prepublishOnly": "bun run build && bun shx rm ./dist/tsconfig.tsbuildinfo",
|
||||
"test.lint": "run-p --aggregate-output -c 'test.lint.*' lint.cspell lint.root.tsc",
|
||||
"test.lint.root.eslint": "eslint './{src,dev}/**/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml}' --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
|
||||
"test.lint.biome": "biome check",
|
||||
"test.lint.dprint": "dprint check",
|
||||
"test.docker": "tsx ./dev/docker/ci/tests/index.mts",
|
||||
"test": "turbo test && jest --runInBand --forceExit --coverage",
|
||||
"build.docker-ci": "node ./dev/docker/ci/docker-ci.mjs"
|
||||
"build.docker-ci": "node ./dev/docker/ci/docker-ci.mjs",
|
||||
"prepare": "bun ./patches/apply.mts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@actions/cache": "^4.0.2",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/http-client": "^2.2.3",
|
||||
"@actions/http-client": "2.2.3",
|
||||
"@actions/io": "^1.1.3",
|
||||
"@actions/tool-cache": "^2.0.2",
|
||||
"@aminya/minijson": "1.1.0",
|
||||
"@aminya/minijson": "1.1.3",
|
||||
"@babel/core": "^7.26.9",
|
||||
"@babel/preset-typescript": "^7.27.1",
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"@liuli-util/vite-plugin-node": "^0.9.0",
|
||||
"@octokit/core": "^6.1.4",
|
||||
"@octokit/openapi-types": "^24.0.0",
|
||||
"@octokit/plugin-paginate-rest": "^11.4.3",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^13.3.1",
|
||||
"@octokit/rest": "^21.1.1",
|
||||
"@octokit/types": "^13.8.0",
|
||||
"@liuli-util/vite-plugin-node": "^0.10.0",
|
||||
"@octokit/core": "^7.0.0",
|
||||
"@octokit/openapi-types": "^25.0.0",
|
||||
"@octokit/plugin-paginate-rest": "^13.0.0",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^16.0.0",
|
||||
"@octokit/rest": "^22.0.0",
|
||||
"@octokit/types": "^14.0.0",
|
||||
"@pnpm/patching.apply-patch": "^1000.0.7",
|
||||
"@shockpkg/archive-files": "3.2.5",
|
||||
"@swc/cli": "^0.7.0",
|
||||
"@swc/jest": "^0.2.37",
|
||||
"@types/babel__core": "~7.20.5",
|
||||
"@types/cross-spawn": "^6.0.6",
|
||||
|
|
@ -91,16 +83,16 @@
|
|||
"@types/node": "^22.13.8",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/which": "^3.0.4",
|
||||
"@upleveled/babel-plugin-remove-node-prefix": "github:aminya/babel-plugin-remove-node-prefix#02526f866c4f57d3a097590942dc0e700fb3eb15",
|
||||
"@upleveled/babel-plugin-remove-node-prefix": "github:aminya/babel-plugin-remove-node-prefix",
|
||||
"admina": "^1.0.1",
|
||||
"caxa": "^3.0.1",
|
||||
"ci-info": "^4.1.0",
|
||||
"ci-log": "workspace:*",
|
||||
"cross-env": "7.0.3",
|
||||
"cross-spawn": "^7.0.6",
|
||||
"cspell": "^8.17.5",
|
||||
"cspell": "^9.0.0",
|
||||
"diagnostics_channel": "^1.1.0",
|
||||
"dprint": "^0.49.0",
|
||||
"dprint": "^0.51.1",
|
||||
"envosman": "workspace:*",
|
||||
"escape-path-with-spaces": "^1.0.2",
|
||||
"escape-quotes": "^1.0.2",
|
||||
|
|
@ -113,46 +105,44 @@
|
|||
"fs-extra": "^11.3.0",
|
||||
"is-url-online": "^1.5.0",
|
||||
"jest": "^29.7.0",
|
||||
"lefthook": "^1.11.2",
|
||||
"lefthook": "^2.0.14",
|
||||
"macos-release": "^3.3.0",
|
||||
"memoizee": "^0.4.17",
|
||||
"mkdirp": "^3.0.1",
|
||||
"mri": "^1.2.0",
|
||||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#c01f519bd995460228ed3dec4df51df92dc290fd",
|
||||
"node-downloader-helper": "2.1.9",
|
||||
"npm-check-updates": "^17.1.15",
|
||||
"npm-run-all2": "^7.0.2",
|
||||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd",
|
||||
"node-downloader-helper": "2.1.10",
|
||||
"npm-check-updates": "^19.3.1",
|
||||
"npm-run-all2": "^8.0.4",
|
||||
"numerous": "1.0.3",
|
||||
"p-timeout": "^6.1.4",
|
||||
"path-exists": "^5.0.0",
|
||||
"patha": "^0.4.1",
|
||||
"prettier": "3.5.3",
|
||||
"prettier": "3.8.0",
|
||||
"prettier-config-atomic": "^4.0.0",
|
||||
"randomuuid-polyfill": "^1.0.2",
|
||||
"readme-md-generator": "^1.0.0",
|
||||
"retry-as-promised": "^7.1.1",
|
||||
"rollup": "^4.34.9",
|
||||
"safe-stable-stringify": "^2.5.0",
|
||||
"semver": "7.7.1",
|
||||
"setup-apt": "workspace:*",
|
||||
"semver": "7.7.3",
|
||||
"setup-alpine": "workspace:*",
|
||||
"setup-apt": "workspace:*",
|
||||
"setup-brew": "workspace:*",
|
||||
"setup-python": "github:aminya/setup-python#9700887",
|
||||
"setup-python": "github:aminya/setup-python",
|
||||
"shx": "0.4.0",
|
||||
"simple-update-notifier": "^2.0.0",
|
||||
"terser": "^5.39.0",
|
||||
"terser-config-atomic": "^1.0.0",
|
||||
"time-delta": "github:aminya/time-delta#69d91a4",
|
||||
"time-delta": "github:aminya/time-delta",
|
||||
"timers-browserify": "^2.0.12",
|
||||
"ts-node": "^10.9.2",
|
||||
"ts-readme": "^1.1.3",
|
||||
"tsx": "^4.19.3",
|
||||
"turbo": "2.4.4",
|
||||
"tsx": "^4.20.3",
|
||||
"turbo": "2.7.5",
|
||||
"typescript": "^5.8.2",
|
||||
"ubuntu-version": "^2.0.0",
|
||||
"untildify-user": "workspace:*",
|
||||
"util.types": "^0.0.2",
|
||||
"vite": "^6.2.0",
|
||||
"vite": "^7.3.1",
|
||||
"vite-plugin-babel": "^1.3.0",
|
||||
"web-streams-polyfill": "^4.1.0",
|
||||
"which": "^4.0.0"
|
||||
|
|
@ -188,7 +178,6 @@
|
|||
"setup-alpine",
|
||||
"setup-brew",
|
||||
"setup-python",
|
||||
"simple-update-notifier",
|
||||
"time-delta",
|
||||
"ubuntu-version",
|
||||
"untildify-user",
|
||||
|
|
@ -196,13 +185,18 @@
|
|||
"web-streams-polyfill",
|
||||
"timers-browserify",
|
||||
"fs-extra",
|
||||
"randomuuid-polyfill"
|
||||
"randomuuid-polyfill",
|
||||
"mri",
|
||||
"simple-update-notifier"
|
||||
],
|
||||
"overrides": {
|
||||
"sort-package-json": "github:aminya/sort-package-json"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.x",
|
||||
"pnpm": "^10"
|
||||
"bun": ">=1.3.6"
|
||||
},
|
||||
"packageManager": "pnpm@10.6.5",
|
||||
"packageManager": "bun@1.3.6",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
|
|
@ -224,10 +218,5 @@
|
|||
"cmake",
|
||||
"ninja",
|
||||
"meson"
|
||||
],
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"@actions/http-client@2.2.3": "patches/@actions__http-client@2.2.3.patch"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
import { error, info, notice, success, warning } from "../src/index.js"
|
||||
|
||||
describe("ci-log", () => {
|
||||
it("should be a function", () => {
|
||||
expect(error).toBeInstanceOf(Function)
|
||||
expect(success).toBeInstanceOf(Function)
|
||||
expect(warning).toBeInstanceOf(Function)
|
||||
expect(notice).toBeInstanceOf(Function)
|
||||
expect(info).toBeInstanceOf(Function)
|
||||
})
|
||||
})
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
import jestConfig from "../../jest.config.mjs"
|
||||
export default jestConfig
|
||||
|
|
@ -12,12 +12,14 @@
|
|||
"scripts": {
|
||||
"build": "tsc --pretty",
|
||||
"dev": "tsc --watch --pretty",
|
||||
"lint.tsc.test": "tsc --noEmit --pretty -p ./__tests__/tsconfig.json",
|
||||
"lint.tsc": "tsc --noEmit --pretty",
|
||||
"lint.eslint": "eslint '**/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml}' --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
||||
"prepublishOnly": "pnpm run build"
|
||||
"prepublishOnly": "pnpm run build",
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/core": "^2.0.0",
|
||||
"ci-info": "^4.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
import { addEnv, addPath, finalizeRC, sourceRC } from "../src/index.js"
|
||||
|
||||
describe("envosman", () => {
|
||||
it("should be a function", () => {
|
||||
expect(addEnv).toBeInstanceOf(Function)
|
||||
expect(addPath).toBeInstanceOf(Function)
|
||||
expect(finalizeRC).toBeInstanceOf(Function)
|
||||
expect(sourceRC).toBeInstanceOf(Function)
|
||||
})
|
||||
})
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
import jestConfig from "../../jest.config.mjs"
|
||||
export default jestConfig
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "envosman",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"description": "Manage environment variables, PATH, and rc files",
|
||||
"repository": "https://github.com/aminya/setup-cpp",
|
||||
"homepage": "https://github.com/aminya/setup-cpp/tree/master/packages/envosman",
|
||||
|
|
@ -12,13 +12,15 @@
|
|||
"scripts": {
|
||||
"build": "tsc --pretty",
|
||||
"dev": "tsc --watch --pretty",
|
||||
"lint.tsc.test": "tsc --noEmit --pretty -p ./__tests__/tsconfig.json",
|
||||
"lint.tsc": "tsc --noEmit --pretty",
|
||||
"lint.eslint": "eslint '**/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml}' --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
||||
"prepublishOnly": "pnpm run build"
|
||||
"prepublishOnly": "pnpm run build",
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@types/node": "22.13.11",
|
||||
"@actions/core": "^2.0.0",
|
||||
"@types/node": "25.0.9",
|
||||
"admina": "^1.0.1",
|
||||
"ci-info": "^4.0.0",
|
||||
"escape-path-with-spaces": "^1.0.2",
|
||||
|
|
@ -47,6 +49,6 @@
|
|||
],
|
||||
"devDependencies": {
|
||||
"@types/escape-quotes": "~1.0.0",
|
||||
"@types/memoizee": "0.4.11"
|
||||
"@types/memoizee": "0.4.12"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { promises } from "fs"
|
||||
import { resolve } from "path"
|
||||
import { grantUserWriteAccess } from "admina"
|
||||
import { info, warning } from "ci-log"
|
||||
import memoize from "memoizee"
|
||||
|
|
@ -6,29 +7,40 @@ import { pathExists } from "path-exists"
|
|||
import { untildifyUser } from "untildify-user"
|
||||
const { appendFile, readFile, writeFile } = promises
|
||||
|
||||
export const defaultRcPath = untildifyUser("~/.bashrc")
|
||||
export const defaultGuard = "envosman"
|
||||
export const defaultRcPath = untildifyUser("~/.envosmanrc")
|
||||
|
||||
/**
|
||||
* Options for adding an rc file
|
||||
*/
|
||||
export type RcOptions = {
|
||||
/** The path to the RC file that the env variables should be added to. */
|
||||
/** The path to the RC file that the env variables should be added to. (Default to "~/.envosmanrc") */
|
||||
rcPath: string
|
||||
|
||||
/** Provide a name (your tool) to add a variable guard for sourcing your rc file */
|
||||
/** Provide a name (your tool) to add a variable guard for sourcing your rc file (Default to "envosman") */
|
||||
guard?: string
|
||||
}
|
||||
|
||||
async function sourceRCInRc_(options: RcOptions) {
|
||||
const sourceRcString = options.guard === undefined
|
||||
? `\nsource "${options.rcPath}"\n`
|
||||
: `\n# ${options.guard}\nif [[ "$SOURCE_${options.guard.toUpperCase()}RC" != 0 && -f "${options.rcPath}" ]]; then source "${options.rcPath}"; fi\n`
|
||||
const bashrc = untildifyUser("~/.bashrc")
|
||||
const profile = untildifyUser("~/.profile")
|
||||
|
||||
const rcPath = resolve(options.rcPath)
|
||||
|
||||
// avoid source loops
|
||||
if (rcPath === bashrc || rcPath === profile) {
|
||||
return
|
||||
}
|
||||
|
||||
const guard = options.guard ?? defaultGuard
|
||||
const sourceRcString =
|
||||
`\n# ${guard}\nif [[ "$SOURCE_${guard.toUpperCase()}RC" != 0 && -f "${rcPath}" ]]; then source "${rcPath}"; fi\n`
|
||||
|
||||
try {
|
||||
await Promise.all([
|
||||
addRCHeader(options),
|
||||
addSourceToTargetRc(sourceRcString, untildifyUser("~/.bashrc")),
|
||||
addSourceToTargetRc(sourceRcString, untildifyUser("~/.profile")),
|
||||
addSourceToTargetRc(sourceRcString, bashrc),
|
||||
addSourceToTargetRc(sourceRcString, profile),
|
||||
])
|
||||
} catch (err) {
|
||||
warning(`Failed to add ${sourceRcString} to .profile or .bashrc. You should add it manually: ${err}`)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
import { execPowershell, execPowershellSync, getPowerShell } from "../src/index.js"
|
||||
|
||||
describe("exec-powershell", () => {
|
||||
it("should be a function", () => {
|
||||
expect(execPowershell).toBeInstanceOf(Function)
|
||||
expect(execPowershellSync).toBeInstanceOf(Function)
|
||||
expect(getPowerShell).toBeInstanceOf(Function)
|
||||
})
|
||||
})
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
import jestConfig from "../../jest.config.mjs"
|
||||
export default jestConfig
|
||||
|
|
@ -12,14 +12,16 @@
|
|||
"scripts": {
|
||||
"build": "tsc --pretty",
|
||||
"dev": "tsc --watch --pretty",
|
||||
"lint.tsc.test": "tsc --noEmit --pretty -p ./__tests__/tsconfig.json",
|
||||
"lint.tsc": "tsc --noEmit --pretty",
|
||||
"lint.eslint": "eslint '**/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml}' --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
||||
"prepublishOnly": "pnpm run build"
|
||||
"prepublishOnly": "pnpm run build",
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"execa": "7.2.0",
|
||||
"which": "^4.0.0",
|
||||
"@types/node": "^22.0.0"
|
||||
"@types/node": "^25.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/which": "^3.0.0"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
import { hasApk, installApkPack } from "../src/index.js"
|
||||
|
||||
describe("setup-alpine", () => {
|
||||
it("should be a function", () => {
|
||||
expect(installApkPack).toBeInstanceOf(Function)
|
||||
expect(hasApk).toBeInstanceOf(Function)
|
||||
})
|
||||
})
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
import jestConfig from "../../jest.config.mjs"
|
||||
export default jestConfig
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "setup-alpine",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"description": "Setup apk packages and repositories in Alpine Linux distributions",
|
||||
"repository": "https://github.com/aminya/setup-cpp",
|
||||
"homepage": "https://github.com/aminya/setup-cpp/tree/master/packages/setup-alpine",
|
||||
|
|
@ -17,12 +17,14 @@
|
|||
"scripts": {
|
||||
"build": "tsc --pretty",
|
||||
"dev": "tsc --watch --pretty",
|
||||
"lint.tsc.test": "tsc --noEmit --pretty -p ./__tests__/tsconfig.json",
|
||||
"lint.tsc": "tsc --noEmit --pretty",
|
||||
"lint.eslint": "eslint '**/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml}' --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
||||
"prepublishOnly": "pnpm run build"
|
||||
"prepublishOnly": "pnpm run build",
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "22.13.11",
|
||||
"@types/node": "25.0.9",
|
||||
"admina": "^1.0.1",
|
||||
"path-exists": "^5.0.0",
|
||||
"ci-log": "workspace:*",
|
||||
|
|
@ -48,7 +50,7 @@
|
|||
"package"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/memoizee": "0.4.11",
|
||||
"@types/memoizee": "0.4.12",
|
||||
"@types/which": "~3.0.4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
import memoizee from "memoizee"
|
||||
import which from "which"
|
||||
import { isAlpine } from "./is-alpine.js"
|
||||
|
||||
async function hasApk_() {
|
||||
if (!isAlpine()) {
|
||||
return false
|
||||
}
|
||||
try {
|
||||
await which("apk")
|
||||
return true
|
||||
} catch (error) {
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,5 +2,6 @@ export * from "./apk-repository.js"
|
|||
export * from "./has-apk.js"
|
||||
export * from "./init-apt.js"
|
||||
export * from "./install-package.js"
|
||||
export * from "./is-alpine.js"
|
||||
export * from "./qualify-install.js"
|
||||
export * from "./update.js"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
import { pathExistsSync } from "path-exists"
|
||||
|
||||
/**
|
||||
* Check if the current platform is Alpine
|
||||
*/
|
||||
export function isAlpine() {
|
||||
if (process.platform !== "linux") {
|
||||
return false
|
||||
}
|
||||
try {
|
||||
return pathExistsSync("/etc/alpine-release")
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import { hasAptGet, setupAptFast } from "../src/index.js"
|
||||
import { testBin } from "./testBin.js"
|
||||
|
||||
jest.setTimeout(300000)
|
||||
describe("setup-apt-fast", () => {
|
||||
if (!hasAptGet()) {
|
||||
test.skip("should setup apt-fast", () => {})
|
||||
return
|
||||
}
|
||||
it("should setup apt-fast", async () => {
|
||||
const installInfo = await setupAptFast()
|
||||
await testBin("apt-fast", null, installInfo?.binDir)
|
||||
})
|
||||
})
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
import { execRootSync } from "admina"
|
||||
import { isUbuntu } from "../../utils/env/isUbuntu.js"
|
||||
import { testBin } from "../../utils/tests/test-helpers.js"
|
||||
import { setupNala } from "../nala.js"
|
||||
import { hasAptGet } from "../src/get-apt.js"
|
||||
import { setupNala } from "../src/nala.js"
|
||||
import { testBin } from "./testBin.js"
|
||||
|
||||
jest.setTimeout(300000)
|
||||
describe("setup-nala", () => {
|
||||
if (!isUbuntu()) {
|
||||
if (!hasAptGet()) {
|
||||
test.skip("should setup nala", () => {})
|
||||
return
|
||||
}
|
||||
it("should setup nala", async () => {
|
||||
const installInfo = await setupNala("", "", process.arch)
|
||||
const installInfo = await setupNala()
|
||||
await testBin("nala", ["--version"], installInfo?.binDir)
|
||||
})
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
import spawn from "cross-spawn"
|
||||
import { pathExists } from "path-exists"
|
||||
import { addExeExt, join } from "patha"
|
||||
import which from "which"
|
||||
|
||||
export async function testBin(
|
||||
name: string,
|
||||
args: string[] | null = ["--version"],
|
||||
binDir: string | undefined = undefined,
|
||||
) {
|
||||
let bin = name
|
||||
if (typeof binDir === "string") {
|
||||
console.log(`Testing the existence of ${binDir}`)
|
||||
expect(binDir).toBeDefined()
|
||||
expect(binDir).not.toHaveLength(0)
|
||||
expect(await pathExists(binDir)).toBeTruthy()
|
||||
bin = join(binDir, addExeExt(name))
|
||||
}
|
||||
|
||||
if (args !== null) {
|
||||
console.log(`Running ${bin} ${args.join(" ")}`)
|
||||
const { status } = spawn.sync(bin, args, { stdio: "inherit" })
|
||||
expect(status).toBe(0)
|
||||
}
|
||||
|
||||
expect((await which(name, { nothrow: true }))?.includes(bin))
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
import jestConfig from "../../jest.config.mjs"
|
||||
export default jestConfig
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "setup-apt",
|
||||
"version": "3.0.2",
|
||||
"version": "3.1.3",
|
||||
"description": "Setup apt packages and repositories in Debian/Ubuntu-based distributions",
|
||||
"repository": "https://github.com/aminya/setup-cpp",
|
||||
"homepage": "https://github.com/aminya/setup-cpp/tree/master/packages/setup-apt",
|
||||
|
|
@ -17,22 +17,24 @@
|
|||
"scripts": {
|
||||
"build": "tsc --pretty",
|
||||
"dev": "tsc --watch --pretty",
|
||||
"lint.tsc.test": "tsc --noEmit --pretty -p ./__tests__/tsconfig.json",
|
||||
"lint.tsc": "tsc --noEmit --pretty",
|
||||
"lint.eslint": "eslint '**/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml}' --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
||||
"prepublishOnly": "pnpm run build"
|
||||
"prepublishOnly": "pnpm run build",
|
||||
"test": "jest --coverage --runInBand"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "22.13.11",
|
||||
"@types/node": "25.0.9",
|
||||
"admina": "^1.0.1",
|
||||
"ci-info": "^4.0.0",
|
||||
"path-exists": "^5.0.0",
|
||||
"ci-log": "workspace:*",
|
||||
"envosman": "workspace:*",
|
||||
"which": "4.0.0",
|
||||
"execa": "7.2.0",
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"node-downloader-helper": "2.1.9",
|
||||
"memoizee": "^0.4.17"
|
||||
"execa": "7.2.0",
|
||||
"memoizee": "^0.4.17",
|
||||
"node-downloader-helper": "2.1.10",
|
||||
"path-exists": "^5.0.0",
|
||||
"which": "4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
|
|
@ -52,10 +54,14 @@
|
|||
"ubuntu",
|
||||
"debian",
|
||||
"package",
|
||||
"apt-key"
|
||||
"apt-key",
|
||||
"apt-fast",
|
||||
"nala"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/memoizee": "0.4.11",
|
||||
"@types/which": "~3.0.4"
|
||||
"@types/memoizee": "0.4.12",
|
||||
"@types/which": "~3.0.4",
|
||||
"cross-spawn": "^7.0.6",
|
||||
"patha": "^0.4.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* @private Used internally
|
||||
*/
|
||||
|
||||
export function getAptEnv(apt: string) {
|
||||
export function getAptEnv(apt: string = "apt-get") {
|
||||
const env: NodeJS.ProcessEnv = { ...process.env, DEBIAN_FRONTEND: "noninteractive" }
|
||||
|
||||
if (apt === "nala") {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
import { tmpdir } from "os"
|
||||
import { dirname, join } from "path"
|
||||
import { execRootSync } from "admina"
|
||||
import { error } from "ci-log"
|
||||
import { readFile, writeFile } from "fs/promises"
|
||||
import { DownloaderHelper } from "node-downloader-helper"
|
||||
import which from "which"
|
||||
import { hasAptGet } from "./get-apt.js"
|
||||
import { installAptPack } from "./install.js"
|
||||
|
||||
let binDir: string | undefined
|
||||
|
||||
export async function setupAptFast() {
|
||||
if (!hasAptGet()) {
|
||||
return undefined
|
||||
}
|
||||
if (typeof binDir === "string") {
|
||||
return { binDir }
|
||||
}
|
||||
|
||||
const maybeBinDir = which.sync("apt-fast", { nothrow: true })
|
||||
if (maybeBinDir !== null) {
|
||||
binDir = dirname(maybeBinDir)
|
||||
return { binDir }
|
||||
}
|
||||
|
||||
binDir = "/usr/bin" // eslint-disable-line require-atomic-updates
|
||||
|
||||
// Install via the installer script
|
||||
await setupAptFastViaInstaller()
|
||||
|
||||
return { binDir }
|
||||
}
|
||||
|
||||
async function setupAptFastViaInstaller() {
|
||||
const depP = installAptPack([{ name: "bash" }, { name: "wget" }])
|
||||
|
||||
// https://github.com/ilikenwf/apt-fast
|
||||
const installer = new DownloaderHelper(
|
||||
"https://raw.githubusercontent.com/ilikenwf/apt-fast/c2cd0a0420d3f2d647dc82cf749bfd58c4697dac/quick-install.sh",
|
||||
tmpdir(),
|
||||
{ fileName: "install-apt-fast.sh" },
|
||||
)
|
||||
installer.on("error", (err) => {
|
||||
throw new Error(`Failed to download install-apt-fast.sh: ${err}`)
|
||||
})
|
||||
await installer.start()
|
||||
|
||||
const installerPath = join(tmpdir(), "install-apt-fast.sh")
|
||||
|
||||
// Patch the installer script to not use sudo explicitly
|
||||
let script = await readFile(installerPath, "utf8")
|
||||
script = script
|
||||
.replace(/sudo/g, "")
|
||||
.replace(
|
||||
"https://raw.githubusercontent.com/ilikenwf/apt-fast/master",
|
||||
"https://raw.githubusercontent.com/Rongronggg9/apt-fast/ac82051792f764220e5e303d4560de0f1952826b",
|
||||
)
|
||||
|
||||
await writeFile(installerPath, script)
|
||||
|
||||
await depP
|
||||
|
||||
try {
|
||||
execRootSync("bash", [installerPath])
|
||||
} catch (err) {
|
||||
error(`Failed to install apt-fast via installer: ${err}`)
|
||||
}
|
||||
|
||||
// Update the apt-fast config
|
||||
const aptFastConfigPath = "/etc/apt-fast.conf"
|
||||
let aptFastConfig = await readFile(aptFastConfigPath, "utf8")
|
||||
|
||||
// enable default suggested configs
|
||||
const opts = ["_APTMGR", "DOWNLOADBEFORE"]
|
||||
for (const opt of opts) {
|
||||
aptFastConfig = aptFastConfig.replace(new RegExp(`^#\\s*${opt}`, "m"), opt)
|
||||
}
|
||||
|
||||
// write the config using execRootSync
|
||||
const tempAptFast = join(tmpdir(), "apt-fast.conf")
|
||||
await writeFile(tempAptFast, aptFastConfig)
|
||||
execRootSync("mv", [tempAptFast, aptFastConfigPath])
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { defaultExecOptions, execRootSync } from "admina"
|
||||
import memoize from "memoizee"
|
||||
import { getAptEnv } from "./apt-env.js"
|
||||
import { aptTimeout } from "./apt-timeout.js"
|
||||
import { getApt } from "./get-apt.js"
|
||||
|
|
@ -6,10 +7,38 @@ import { initAptMemoized } from "./init-apt.js"
|
|||
import { isAptPackInstalled } from "./is-installed.js"
|
||||
import { updateAptReposMemoized } from "./update.js"
|
||||
|
||||
function hasNoUpdateFlag_(apt: string = "apt-get") {
|
||||
try {
|
||||
const { stdout } = execRootSync("add-apt-repository", ["--help"], {
|
||||
...defaultExecOptions,
|
||||
env: getAptEnv(apt),
|
||||
stdio: "pipe",
|
||||
})
|
||||
return stdout.includes("--no-update")
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
export const addAptHasNoUpdateFlag = memoize(hasNoUpdateFlag_)
|
||||
|
||||
export async function addAptRepository(repo: string, apt = getApt()) {
|
||||
await initAptMemoized(apt)
|
||||
await installAddAptRepo()
|
||||
execRootSync("add-apt-repository", ["-y", "--no-update", repo], { ...defaultExecOptions, env: getAptEnv(apt) })
|
||||
|
||||
try {
|
||||
execRootSync(
|
||||
"add-apt-repository",
|
||||
["-y", addAptHasNoUpdateFlag(apt) ? "--no-update" : undefined, repo].filter(a => a !== undefined),
|
||||
{ ...defaultExecOptions, env: getAptEnv(apt) },
|
||||
)
|
||||
} catch (err) {
|
||||
// try without the no-update flag
|
||||
execRootSync(
|
||||
"add-apt-repository",
|
||||
["-y", repo],
|
||||
{ ...defaultExecOptions, env: getAptEnv(apt) },
|
||||
)
|
||||
}
|
||||
|
||||
// Update the repos
|
||||
updateAptReposMemoized.clear() // ensure update is called
|
||||
|
|
@ -31,10 +60,11 @@ export async function installAddAptRepo() {
|
|||
export async function removeAptRepository(repo: string, apt = getApt()) {
|
||||
await initAptMemoized(apt)
|
||||
await installAddAptRepo()
|
||||
execRootSync("add-apt-repository", ["-y", "--no-update", "--remove", repo], {
|
||||
...defaultExecOptions,
|
||||
env: getAptEnv(apt),
|
||||
})
|
||||
execRootSync(
|
||||
"add-apt-repository",
|
||||
["-y", "--remove", addAptHasNoUpdateFlag(apt) ? undefined : "--no-update", repo].filter(a => a !== undefined),
|
||||
{ ...defaultExecOptions, env: getAptEnv(apt) },
|
||||
)
|
||||
|
||||
// Update the repos
|
||||
updateAptReposMemoized.clear() // ensure update is called
|
||||
|
|
|
|||
|
|
@ -4,7 +4,28 @@ import which from "which"
|
|||
* Check if nala is installed
|
||||
*/
|
||||
export function hasNala() {
|
||||
return which.sync("nala", { nothrow: true }) !== null
|
||||
return process.platform === "linux" && which.sync("nala", { nothrow: true }) !== null
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if apt-fast is installed
|
||||
*/
|
||||
export function hasAptFast() {
|
||||
return process.platform === "linux" && which.sync("apt-fast", { nothrow: true }) !== null
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if apt is installed
|
||||
*/
|
||||
export function hasApt() {
|
||||
return process.platform === "linux" && which.sync("apt", { nothrow: true }) !== null
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if apt-get is installed
|
||||
*/
|
||||
export function hasAptGet() {
|
||||
return process.platform === "linux" && which.sync("apt-get", { nothrow: true }) !== null
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -12,11 +33,15 @@ export function hasNala() {
|
|||
* If nala is installed, use that, otherwise use apt-get
|
||||
*/
|
||||
export function getApt() {
|
||||
let apt: string
|
||||
if (hasNala()) {
|
||||
apt = "nala"
|
||||
return "nala"
|
||||
} else if (hasAptFast()) {
|
||||
return "apt-fast"
|
||||
// } else if (hasApt()) {
|
||||
// return "apt"
|
||||
} else if (hasAptGet()) {
|
||||
return "apt-get"
|
||||
} else {
|
||||
apt = "apt-get"
|
||||
throw new Error("No apt command found")
|
||||
}
|
||||
return apt
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
export * from "./alternatives.js"
|
||||
export * from "./apt-fast.js"
|
||||
export * from "./apt-key.js"
|
||||
export * from "./apt-repository.js"
|
||||
export * from "./apt-timeout.js"
|
||||
|
|
@ -6,5 +7,6 @@ export * from "./get-apt.js"
|
|||
export * from "./init-apt.js"
|
||||
export * from "./install.js"
|
||||
export * from "./is-installed.js"
|
||||
export * from "./nala.js"
|
||||
export * from "./qualify-install.js"
|
||||
export * from "./update.js"
|
||||
|
|
|
|||
|
|
@ -4,15 +4,21 @@ import { execRootSync } from "admina"
|
|||
import { error, info } from "ci-log"
|
||||
import { readFile, writeFile } from "fs/promises"
|
||||
import { DownloaderHelper } from "node-downloader-helper"
|
||||
import { hasNala, installAptPack, qualifiedNeededAptPackage } from "setup-apt"
|
||||
import which from "which"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { hasAptGet, hasNala } from "./get-apt.js"
|
||||
import { installAptPack } from "./install.js"
|
||||
import { qualifiedNeededAptPackage } from "./qualify-install.js"
|
||||
|
||||
let binDir: string | undefined
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export async function setupNala(version: string, _setupDir: string, _arch: string) {
|
||||
if (!isUbuntu()) {
|
||||
export type SetupOptions = {
|
||||
version: string
|
||||
setupDir: string
|
||||
arch: string
|
||||
}
|
||||
|
||||
export async function setupNala({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
if (!hasAptGet()) {
|
||||
return undefined
|
||||
}
|
||||
if (typeof binDir === "string") {
|
||||
|
|
@ -61,8 +67,9 @@ export async function setupNala(version: string, _setupDir: string, _arch: strin
|
|||
}
|
||||
|
||||
async function setupNalaViaInstaller() {
|
||||
// https://gitlab.com/volian/volian-archive
|
||||
const installer = new DownloaderHelper(
|
||||
"https://gitlab.com/volian/volian-archive/-/raw/main/install-nala.sh",
|
||||
"https://gitlab.com/volian/volian-archive/-/raw/1939afc3f80638dca2bbedde74bbd86731703cc8/install-nala.sh",
|
||||
tmpdir(),
|
||||
{ fileName: "install-nala.sh" },
|
||||
)
|
||||
|
|
@ -17,19 +17,20 @@
|
|||
"scripts": {
|
||||
"build": "tsc --pretty",
|
||||
"dev": "tsc --watch --pretty",
|
||||
"lint.tsc.test": "tsc --noEmit --pretty -p ./__tests__/tsconfig.json",
|
||||
"lint.tsc": "tsc --noEmit --pretty",
|
||||
"lint.eslint": "eslint '**/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml}' --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
||||
"prepublishOnly": "pnpm run build",
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "22.13.11",
|
||||
"@types/node": "25.0.9",
|
||||
"ci-log": "workspace:*",
|
||||
"envosman": "workspace:*",
|
||||
"which": "4.0.0",
|
||||
"execa": "7.2.0",
|
||||
"setup-apt": "workspace:*",
|
||||
"node-downloader-helper": "2.1.9"
|
||||
"node-downloader-helper": "2.1.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cross-spawn": "~6.0.6",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
import { untildifyUser } from "../src/index.js"
|
||||
|
||||
describe("untildify-user", () => {
|
||||
it("should be a function", () => {
|
||||
expect(untildifyUser).toBeInstanceOf(Function)
|
||||
})
|
||||
})
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
import jestConfig from "../../jest.config.mjs"
|
||||
export default jestConfig
|
||||
|
|
@ -12,9 +12,11 @@
|
|||
"scripts": {
|
||||
"build": "tsc --pretty",
|
||||
"dev": "tsc --watch --pretty",
|
||||
"lint.tsc.test": "tsc --noEmit --pretty -p ./__tests__/tsconfig.json",
|
||||
"lint.tsc": "tsc --noEmit --pretty",
|
||||
"lint.eslint": "eslint '**/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml}' --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
||||
"prepublishOnly": "pnpm run build"
|
||||
"prepublishOnly": "pnpm run build",
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"admina": "1.0.1"
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,57 @@
|
|||
import { existsSync } from "fs"
|
||||
import path from "path"
|
||||
import { applyPatchToDir } from "@pnpm/patching.apply-patch"
|
||||
import fs from "fs/promises"
|
||||
|
||||
async function main() {
|
||||
const patches = (await fs.readdir("./patches")).filter(patch => patch.endsWith(".patch"))
|
||||
const results = await Promise.all(patches.map(applyPatch))
|
||||
|
||||
if (results.some(result => result === PatchResult.Failed)) {
|
||||
console.error("Failed to apply some patches")
|
||||
process.exit(1)
|
||||
} else {
|
||||
console.log("All patches applied successfully")
|
||||
}
|
||||
}
|
||||
|
||||
enum PatchResult {
|
||||
Success = 0,
|
||||
Failed = 1,
|
||||
Skipped = 2,
|
||||
}
|
||||
|
||||
async function applyPatch(patch: string) {
|
||||
const patchFilePath = path.resolve("./patches", patch)
|
||||
const packageName = parsePackageName(patchFilePath)
|
||||
|
||||
const patchedDir = path.resolve("./node_modules", packageName)
|
||||
|
||||
if (existsSync(path.join(patchedDir, ".patched"))) {
|
||||
console.log(`Skipping ${patch} because it is already patched`)
|
||||
return PatchResult.Skipped
|
||||
}
|
||||
|
||||
console.log(`Applying patch ${patchFilePath} to ${patchedDir}`)
|
||||
const result = applyPatchToDir({
|
||||
patchedDir,
|
||||
patchFilePath,
|
||||
})
|
||||
// create .patched file in the patchedDir
|
||||
await fs.writeFile(path.join(patchedDir, ".patched"), patch)
|
||||
if (!result) {
|
||||
console.error(`Failed to apply patch ${patch}`)
|
||||
return PatchResult.Failed
|
||||
}
|
||||
return PatchResult.Success
|
||||
}
|
||||
|
||||
/**
|
||||
* parsePackageName("@actions__http-client.patch") // "@actions/http-client"
|
||||
* parsePackageName("http-client.patch") // "http-client"
|
||||
*/
|
||||
function parsePackageName(patch: string) {
|
||||
return path.basename(patch, path.extname(patch)).replace("__", "/")
|
||||
}
|
||||
|
||||
main()
|
||||
12320
pnpm-lock.yaml
12320
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
|
@ -1,12 +0,0 @@
|
|||
packages:
|
||||
- packages/*
|
||||
|
||||
onlyBuiltDependencies:
|
||||
- "@biomejs/biome"
|
||||
- "@swc/core"
|
||||
- core-js
|
||||
- dprint
|
||||
- es5-ext
|
||||
- esbuild
|
||||
- iso-constants
|
||||
- lefthook
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
import packageJson from "../../package-version.json"
|
||||
import { setupCpp } from "../lib.js"
|
||||
|
||||
describe("setupCpp", () => {
|
||||
it("should install nothing if no tools are installed", async () => {
|
||||
const opts = {
|
||||
"setup-cpp": false,
|
||||
}
|
||||
const result = await setupCpp(opts)
|
||||
expect(result).toStrictEqual({
|
||||
successMessages: [],
|
||||
errorMessages: [],
|
||||
})
|
||||
})
|
||||
|
||||
it("should install setup-cpp if no tools are installed", async () => {
|
||||
const result = await setupCpp()
|
||||
|
||||
const version = packageJson.version
|
||||
|
||||
expect(result).toStrictEqual({
|
||||
successMessages: [`setup-cpp@${version} already installed`],
|
||||
errorMessages: [],
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import { parseArgs } from "../cli-options.js"
|
||||
process.env.SETUP_CPP_SKIP_MAIN = "true"
|
||||
import { getCompilerInfo } from "../compilers.js"
|
||||
import { parseArgs } from "../setup-cpp.js"
|
||||
import { type Inputs, llvmTools } from "../tool.js"
|
||||
import { getVersion, syncVersions } from "../versions/versions.js"
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue