mirror of https://github.com/aminya/setup-cpp.git
Compare commits
230 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 | |
|
|
fc7a5158bd | |
|
|
1837c0d47a | |
|
|
83d70f96bc | |
|
|
be9dd533df | |
|
|
2e04f42cca | |
|
|
6ecab5ef9d | |
|
|
8eb691a796 | |
|
|
895d69ee98 | |
|
|
8e78c541a2 | |
|
|
c04f432701 | |
|
|
24ed36b061 | |
|
|
d34b955da5 | |
|
|
ae24e964ab | |
|
|
8a0c8a726b | |
|
|
ad49f54a72 | |
|
|
f23c0b8778 | |
|
|
d8d2caee94 | |
|
|
477dd40685 | |
|
|
2ee99e208e | |
|
|
0730cb5e36 | |
|
|
5b56272eaf | |
|
|
bcc7fc2a92 | |
|
|
d04bcbf1dc | |
|
|
e6bd753a7f | |
|
|
4d2ad5fc8b | |
|
|
1158c50fa0 | |
|
|
9a2e61232c | |
|
|
4c992d0556 | |
|
|
ba81f6ae16 | |
|
|
5a0bbafcb2 | |
|
|
3108fdcf8d | |
|
|
dd785bad39 | |
|
|
18f6af3e6c | |
|
|
f737a07371 | |
|
|
6cd53aa7e2 | |
|
|
f4fab9f74a | |
|
|
7974077db1 | |
|
|
045f4c5242 | |
|
|
2fe3219ef1 | |
|
|
7ea6387acb | |
|
|
01ccf4c1cc | |
|
|
be9505b2e5 | |
|
|
2428548d77 | |
|
|
ae4905b61c | |
|
|
8b1e80507e | |
|
|
af1b02b5ed | |
|
|
9845e6e84d | |
|
|
1273879b4d | |
|
|
a96be2f0e6 | |
|
|
fd0d475a53 | |
|
|
81892a4640 | |
|
|
d11e5d7d70 | |
|
|
29c12dc98c | |
|
|
a63071ebb3 | |
|
|
8115710285 | |
|
|
660206b3e3 | |
|
|
b59e0ce00b | |
|
|
374c0cd9ec | |
|
|
2250f08263 | |
|
|
1916446e22 | |
|
|
67fad8bf37 | |
|
|
a4bc77491c | |
|
|
a835d4b72e | |
|
|
6ef1af9182 | |
|
|
fb55d3cdfe | |
|
|
29cd2e193a | |
|
|
1d64427488 | |
|
|
3cc2476a87 | |
|
|
56767a8edb | |
|
|
a76dd1b9e9 | |
|
|
12841b3f65 | |
|
|
b4d8a5c5a6 |
|
|
@ -12,6 +12,7 @@ concurrency:
|
|||
|
||||
env:
|
||||
NODE_OPTIONS: --enable-source-maps
|
||||
version: "1.8.0"
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
|
|
@ -23,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: |
|
||||
|
|
@ -66,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
|
||||
|
|
@ -84,49 +87,65 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- windows-2019
|
||||
- ubuntu-20.04
|
||||
- macos-13 # x64
|
||||
- windows-2022
|
||||
- ubuntu-22.04
|
||||
- ubuntu-22.04-arm
|
||||
- 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: |
|
||||
|
|
@ -142,49 +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
|
||||
|
|
@ -192,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
|
||||
|
||||
|
|
@ -216,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
|
||||
|
|
@ -225,7 +245,7 @@ jobs:
|
|||
node ./dist/legacy/setup-cpp.js --gcc true --cmake true
|
||||
|
||||
Docker:
|
||||
name: Docker-${{ matrix.container.image }}-${{ matrix.platform }}
|
||||
name: Docker-${{ matrix.container.image }}-${{ matrix.platform }}-${{ matrix.container.tag }}
|
||||
needs: [Build]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
|
|
@ -236,20 +256,32 @@ jobs:
|
|||
platform:
|
||||
- linux/amd64
|
||||
container:
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04-1.1.1" }
|
||||
- { distro: "fedora", image: "setup-cpp-fedora", tag: "40-1.1.1" }
|
||||
- { distro: "arch", image: "setup-cpp-arch", tag: "base-1.1.1" }
|
||||
- { 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: "44" }
|
||||
- { distro: "arch", image: "setup-cpp-arch", tag: "base" }
|
||||
- { distro: "alpine", image: "setup-cpp-alpine", tag: "3.21", base_version: "22-alpine3.21" }
|
||||
include:
|
||||
- os: ubuntu-24.04-arm
|
||||
platform: linux/arm64
|
||||
container: { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04-1.1.1" }
|
||||
container: { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "24.04" }
|
||||
- os: ubuntu-24.04-arm
|
||||
platform: linux/arm64
|
||||
container: { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04" }
|
||||
- os: ubuntu-24.04-arm
|
||||
platform: linux/arm64
|
||||
container: { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "20.04" }
|
||||
- os: ubuntu-24.04-arm
|
||||
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
|
||||
|
||||
|
|
@ -279,21 +311,25 @@ jobs:
|
|||
load: true
|
||||
provenance: false
|
||||
platforms: ${{ matrix.platform }}
|
||||
tags: aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}:latest
|
||||
tags: aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-to: type=inline
|
||||
build-args: BASE_VERSION=${{ matrix.container.base_version || matrix.container.tag }}
|
||||
|
||||
- name: Tag latest locally
|
||||
run: |
|
||||
docker tag aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}:latest
|
||||
docker tag aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}:latest
|
||||
docker tag aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}
|
||||
|
||||
- name: Push latest to Docker Hub
|
||||
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' }}
|
||||
run: docker push aminya/${{ matrix.container.image }}:latest
|
||||
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'alpine' }}
|
||||
run: |
|
||||
docker push aminya/${{ matrix.container.image }}:latest
|
||||
docker push aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}
|
||||
|
||||
- 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 }}
|
||||
|
|
@ -302,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: .
|
||||
|
|
@ -310,21 +347,25 @@ jobs:
|
|||
load: true
|
||||
provenance: false
|
||||
platforms: ${{ matrix.platform }}
|
||||
tags: aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}-llvm:latest
|
||||
tags: aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-to: type=inline
|
||||
|
||||
- name: Tag latest locally
|
||||
if: ${{ matrix.container.distro != 'arch' }}
|
||||
run: |
|
||||
docker tag aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}-${{ 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: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' }}
|
||||
run: docker push aminya/${{ matrix.container.image }}-llvm:latest
|
||||
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 }}
|
||||
|
|
@ -332,14 +373,14 @@ 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: .
|
||||
file: ./dev/docker/examples/${{ matrix.container.distro }}-llvm.dockerfile
|
||||
push: false
|
||||
platforms: ${{ matrix.platform }}
|
||||
tags: aminya/test-${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}
|
||||
tags: aminya/test-${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}-${{ env.version }}
|
||||
|
||||
- name: Build setup-cpp-${{matrix.container.distro }}-gcc
|
||||
id: build_gcc
|
||||
|
|
@ -351,21 +392,24 @@ jobs:
|
|||
load: true
|
||||
provenance: false
|
||||
platforms: ${{ matrix.platform }}
|
||||
tags: aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}-gcc:latest
|
||||
tags: aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-to: type=inline
|
||||
|
||||
- name: Tag latest locally
|
||||
run: |
|
||||
docker tag aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-gcc:latest
|
||||
docker tag aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-gcc:latest
|
||||
docker tag aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}
|
||||
|
||||
- name: Push latest to Docker Hub
|
||||
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' }}
|
||||
run: docker push aminya/${{ matrix.container.image }}-gcc:latest
|
||||
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'alpine' }}
|
||||
run: |
|
||||
docker push aminya/${{ matrix.container.image }}-gcc:latest
|
||||
docker push aminya/${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}
|
||||
|
||||
- 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 }}
|
||||
|
|
@ -380,11 +424,11 @@ jobs:
|
|||
file: ./dev/docker/examples/${{ matrix.container.distro }}-gcc.dockerfile
|
||||
push: false
|
||||
platforms: ${{ matrix.platform }}
|
||||
tags: aminya/test-${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}
|
||||
tags: aminya/test-${{ matrix.container.image }}-gcc:${{ matrix.container.tag }}-${{ env.version }}
|
||||
|
||||
- name: Build setup-cpp-${{matrix.container.distro }}-mingw
|
||||
id: build_mingw
|
||||
if: ${{ matrix.container.distro != 'fedora' }}
|
||||
if: ${{ matrix.container.distro != 'fedora' && !(matrix.container.distro == 'alpine' && matrix.platform == 'linux/arm64') }}
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
|
|
@ -393,22 +437,24 @@ jobs:
|
|||
load: true
|
||||
provenance: false
|
||||
platforms: ${{ matrix.platform }}
|
||||
tags: aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}-mingw:latest
|
||||
tags: aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-to: type=inline
|
||||
|
||||
- name: Tag latest locally
|
||||
if: ${{ matrix.container.distro != 'fedora' }}
|
||||
if: ${{ matrix.container.distro != 'fedora' && !(matrix.container.distro == 'alpine' && matrix.platform == 'linux/arm64') }}
|
||||
run: |
|
||||
docker tag aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-mingw:latest
|
||||
|
||||
docker tag aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-mingw:latest
|
||||
docker tag aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}-${{ env.version }}-${{ steps.platform.outputs.suffix }} aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}
|
||||
- name: Push latest to Docker Hub
|
||||
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'fedora' }}
|
||||
run: docker push aminya/${{ matrix.container.image }}-mingw:latest
|
||||
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'ubuntu' && matrix.container.distro != 'fedora' && matrix.container.distro != 'alpine' }}
|
||||
run: |
|
||||
docker push aminya/${{ matrix.container.image }}-mingw:latest
|
||||
docker push aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}
|
||||
|
||||
- name: Docker Readme for setup-cpp-${{matrix.container.distro }}-mingw
|
||||
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'fedora' }}
|
||||
uses: peter-evans/dockerhub-description@v4
|
||||
if: ${{ github.event_name != 'pull_request' && matrix.container.distro != 'fedora' && !(matrix.container.distro == 'alpine' && matrix.platform == 'linux/arm64') }}
|
||||
uses: peter-evans/dockerhub-description@v5
|
||||
with:
|
||||
username: aminya
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
|
@ -416,19 +462,42 @@ jobs:
|
|||
readme-filepath: ./README_DOCKER.md
|
||||
|
||||
- name: Test Mingw
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && matrix.container.distro != 'fedora' }}
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && matrix.container.distro != 'fedora' && matrix.container.distro != 'alpine' }}
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./dev/docker/examples/${{ matrix.container.distro }}-mingw.dockerfile
|
||||
push: false
|
||||
platforms: ${{ matrix.platform }}
|
||||
tags: aminya/test-${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}
|
||||
tags: aminya/test-${{ matrix.container.image }}-mingw:${{ matrix.container.tag }}-${{ env.version }}
|
||||
|
||||
Docker-Manifest:
|
||||
needs: [Docker]
|
||||
runs-on: ubuntu-24.04
|
||||
if: ${{ github.event_name != 'pull_request' || contains(github.event.head_commit.message, '[push docker]') }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
container:
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "20.04", suffix: "", latest: false }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "20.04", suffix: "-llvm", latest: false }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "20.04", suffix: "-gcc", latest: false }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "20.04", suffix: "-mingw", latest: false }
|
||||
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04", suffix: "", latest: false }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04", suffix: "-llvm", latest: false }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04", suffix: "-gcc", latest: false }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04", suffix: "-mingw", latest: false }
|
||||
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "24.04", suffix: "", latest: true }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "24.04", suffix: "-llvm", latest: true }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "24.04", suffix: "-gcc", latest: true }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "24.04", suffix: "-mingw", latest: true }
|
||||
|
||||
- { 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 }
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
|
@ -441,53 +510,23 @@ jobs:
|
|||
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu:22.04-1.1.1
|
||||
images: aminya/setup-cpp-ubuntu:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu:22.04-1.1.1-arm64
|
||||
push: true
|
||||
amend: true
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu:latest
|
||||
images: aminya/setup-cpp-ubuntu:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu:22.04-1.1.1-arm64
|
||||
inputs: aminya/${{ matrix.container.image }}${{ matrix.container.suffix }}:${{ matrix.container.tag }}-${{ env.version }}
|
||||
images: aminya/${{ matrix.container.image }}${{ matrix.container.suffix }}:${{ matrix.container.tag }}-${{ env.version }}-amd64,aminya/${{ matrix.container.image }}${{ matrix.container.suffix }}:${{ matrix.container.tag }}-${{ env.version }}-arm64
|
||||
push: true
|
||||
amend: true
|
||||
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1
|
||||
images: aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1-arm64
|
||||
push: true
|
||||
amend: true
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu-llvm:latest
|
||||
images: aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1-arm64
|
||||
inputs: aminya/${{ matrix.container.image }}${{ matrix.container.suffix }}:${{ matrix.container.tag }}
|
||||
images: aminya/${{ matrix.container.image }}${{ matrix.container.suffix }}:${{ matrix.container.tag }}-${{ env.version }}-amd64,aminya/${{ matrix.container.image }}${{ matrix.container.suffix }}:${{ matrix.container.tag }}-${{ env.version }}-arm64
|
||||
push: true
|
||||
amend: true
|
||||
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
if: ${{ matrix.container.latest }}
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1
|
||||
images: aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1-arm64
|
||||
push: true
|
||||
amend: true
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu-gcc:latest
|
||||
images: aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1-arm64
|
||||
push: true
|
||||
amend: true
|
||||
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1
|
||||
images: aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1-arm64
|
||||
push: true
|
||||
amend: true
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu-mingw:latest
|
||||
images: aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1-amd64,aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1-arm64
|
||||
inputs: aminya/${{ matrix.container.image }}${{ matrix.container.suffix }}:latest
|
||||
images: aminya/${{ matrix.container.image }}${{ matrix.container.suffix }}:${{ matrix.container.tag }}-${{ env.version }}-amd64,aminya/${{ matrix.container.image }}${{ matrix.container.suffix }}:${{ matrix.container.tag }}-${{ env.version }}-arm64
|
||||
push: true
|
||||
amend: true
|
||||
|
||||
|
|
@ -497,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/
|
||||
|
|
@ -509,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.1.1
|
||||
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__`.
|
||||
|
|
|
|||
147
README.md
147
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,23 +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.1.1), 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.1.1/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.1.1/setup-cpp-x64-linux"
|
||||
chmod +x ./setup-cpp
|
||||
|
||||
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.8.0/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
|
||||
|
||||
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.1.1/setup-cpp-x64-macos"
|
||||
chmod +x ./setup-cpp
|
||||
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:
|
||||
|
|
@ -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
|
||||
```
|
||||
|
|
@ -212,90 +209,145 @@ When using the `setup-cpp` action in GitHub Actions, by default it will also ins
|
|||
|
||||
To provide fast development environments, `setup-cpp` provides several prebuilt docker images that have the tools you need. You can use these images as a base image for your project.
|
||||
|
||||
The names are in the format `aminya/setup-cpp-<platform>:<platform_version>-<setup_cpp_version>` and `aminya/setup-cpp-<platform>-<compiler>:<platform_version>-<setup_cpp_version>`.
|
||||
The tags are in the following template:
|
||||
|
||||
#### Ubuntu Images
|
||||
- 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.8.0`
|
||||
- Compiler image with pinned setup-cpp version: `aminya/setup-cpp-ubuntu-llvm:24.04-v1.8.0`
|
||||
|
||||
Base image with `cmake, ninja, task, vcpkg, python, make, cppcheck, gcovr, doxygen, ccache, conan, meson, cmakelang`
|
||||
The supported platforms are `ubuntu`, `alpine`, `fedora`, and `arch`. The supported compilers are `llvm`, `gcc`, and `mingw`.
|
||||
|
||||
#### Ubuntu Images (amd64 and arm64)
|
||||
|
||||
Setup-cpp provides prebuilt images for various Ubuntu versions (20.04, 22.04, 24.04) 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 Ubuntu 24.04:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-ubuntu:22.04-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu:24.04 AS builder
|
||||
```
|
||||
|
||||
Image with `llvm` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-llvm:24.04 AS builder
|
||||
```
|
||||
|
||||
Image with `gcc` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-gcc:24.04 AS builder
|
||||
```
|
||||
|
||||
Image with `mingw` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-mingw:24.04 AS builder
|
||||
```
|
||||
|
||||
#### Fedora Images
|
||||
There are also the variants for Ubuntu `22.04`
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-ubuntu:22.04 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-llvm:22.04 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-gcc:22.04 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-mingw:22.04 AS builder
|
||||
```
|
||||
|
||||
And for Ubuntu `20.04`:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-ubuntu:20.04 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-llvm:20.04 AS builder
|
||||
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>
|
||||
|
||||
Base image with `cmake, ninja, task, vcpkg, python, make, cppcheck, gcovr, doxygen, ccache, conan, meson, cmakelang`
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-fedora:40-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-fedora:40 AS builder
|
||||
```
|
||||
|
||||
Image with `llvm` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-fedora-llvm:40-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-fedora-llvm:40 AS builder
|
||||
```
|
||||
|
||||
Image with `gcc` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-fedora-gcc:40-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-fedora-gcc:40 AS builder
|
||||
```
|
||||
|
||||
Image with `mingw` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-fedora-mingw:40-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-fedora-mingw:40 AS builder
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
#### ArchLinux Images
|
||||
#### ArchLinux Images (amd64)
|
||||
|
||||
<details>
|
||||
|
||||
Base image with `cmake, ninja, task, vcpkg, python, make, cppcheck, gcovr, doxygen, ccache, conan, meson, cmakelang`
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch:base-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-arch:base AS builder
|
||||
```
|
||||
|
||||
Image with `llvm` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch-llvm:base-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-arch-llvm:base AS builder
|
||||
```
|
||||
|
||||
Image with `gcc` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch-gcc:base-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-arch-gcc:base AS builder
|
||||
```
|
||||
|
||||
Image with `mingw` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch-mingw:base-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-arch-mingw:base AS builder
|
||||
```
|
||||
|
||||
</details>
|
||||
|
|
@ -314,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.1.1 && \
|
||||
npm install -g setup-cpp@v1.8.0 && \
|
||||
# install the compiler and tools
|
||||
NODE_OPTIONS="--enable-source-maps" \
|
||||
setup-cpp \
|
||||
|
|
@ -424,7 +476,7 @@ stages:
|
|||
apt-get install -y --no-install-recommends nodejs npm
|
||||
|
||||
# install setup-cpp
|
||||
npm install -g setup-cpp@v1.1.1
|
||||
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
|
||||
|
|
@ -453,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)
|
||||
|
|
|
|||
101
README_DOCKER.md
101
README_DOCKER.md
|
|
@ -16,82 +16,145 @@ See https://github.com/aminya/setup-cpp for more information about using `setup-
|
|||
|
||||
To provide fast development environments, `setup-cpp` provides several prebuilt docker images that have the tools you need. You can use these images as a base image for your project.
|
||||
|
||||
The names are in the format `aminya/setup-cpp-<platform>:<platform_version>-<setup_cpp_version>` and `aminya/setup-cpp-<platform>-<compiler>:<platform_version>-<setup_cpp_version>`.
|
||||
The tags are in the following template:
|
||||
|
||||
#### Ubuntu Images
|
||||
- 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.8.0`
|
||||
- Compiler image with pinned setup-cpp version: `aminya/setup-cpp-ubuntu-llvm:24.04-v1.8.0`
|
||||
|
||||
Base image with `cmake, ninja, task, vcpkg, python, make, cppcheck, gcovr, doxygen, ccache, conan, meson, cmakelang`
|
||||
The supported platforms are `ubuntu`, `alpine`, `fedora`, and `arch`. The supported compilers are `llvm`, `gcc`, and `mingw`.
|
||||
|
||||
#### Ubuntu Images (amd64 and arm64)
|
||||
|
||||
Setup-cpp provides prebuilt images for various Ubuntu versions (20.04, 22.04, 24.04) 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 Ubuntu 24.04:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-ubuntu:22.04-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu:24.04 AS builder
|
||||
```
|
||||
|
||||
Image with `llvm` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-ubuntu-llvm:22.04-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-llvm:24.04 AS builder
|
||||
```
|
||||
|
||||
Image with `gcc` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-ubuntu-gcc:22.04-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-gcc:24.04 AS builder
|
||||
```
|
||||
|
||||
Image with `mingw` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-ubuntu-mingw:22.04-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-mingw:24.04 AS builder
|
||||
```
|
||||
|
||||
#### Fedora Images
|
||||
|
||||
Base image with `cmake, ninja, task, vcpkg, python, make, cppcheck, gcovr, doxygen, ccache, conan, meson, cmakelang`
|
||||
There are also the variants for Ubuntu `22.04`
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-fedora:40-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu:22.04 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-llvm:22.04 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-gcc:22.04 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-mingw:22.04 AS builder
|
||||
```
|
||||
|
||||
And for Ubuntu `20.04`:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-ubuntu:20.04 AS builder
|
||||
FROM aminya/setup-cpp-ubuntu-llvm:20.04 AS builder
|
||||
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-fedora-llvm:40-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-alpine-llvm:3.21 AS builder
|
||||
```
|
||||
|
||||
Image with `gcc` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-fedora-gcc:40-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-alpine-gcc:3.21 AS builder
|
||||
```
|
||||
|
||||
Image with `mingw` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-fedora-mingw:40-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-alpine-mingw:3.21 AS builder
|
||||
```
|
||||
|
||||
#### ArchLinux Images
|
||||
#### Fedora Images (amd64)
|
||||
|
||||
<details>
|
||||
|
||||
Base image with `cmake, ninja, task, vcpkg, python, make, cppcheck, gcovr, doxygen, ccache, conan, meson, cmakelang`
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch:base-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-fedora:40 AS builder
|
||||
```
|
||||
|
||||
Image with `llvm` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch-llvm:base-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-fedora-llvm:40 AS builder
|
||||
```
|
||||
|
||||
Image with `gcc` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch-gcc:base-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-fedora-gcc:40 AS builder
|
||||
```
|
||||
|
||||
Image with `mingw` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch-mingw:base-1.1.1 AS builder
|
||||
FROM aminya/setup-cpp-fedora-mingw:40 AS builder
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
#### ArchLinux Images (amd64)
|
||||
|
||||
<details>
|
||||
|
||||
Base image with `cmake, ninja, task, vcpkg, python, make, cppcheck, gcovr, doxygen, ccache, conan, meson, cmakelang`
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch:base AS builder
|
||||
```
|
||||
|
||||
Image with `llvm` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch-llvm:base AS builder
|
||||
```
|
||||
|
||||
Image with `gcc` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch-gcc:base AS builder
|
||||
```
|
||||
|
||||
Image with `mingw` and the base tools:
|
||||
|
||||
```dockerfile
|
||||
FROM aminya/setup-cpp-arch-mingw:base AS builder
|
||||
```
|
||||
|
||||
</details>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
FROM aminya/setup-cpp-alpine:latest AS setup-cpp-alpine-gcc
|
||||
|
||||
# install gcc
|
||||
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
|
||||
--compiler gcc && \
|
||||
# cleanup
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
SHELL ["/entrypoint.sh", "/bin/sh", "-c"]
|
||||
ENTRYPOINT ["/entrypoint.sh", "/bin/sh"]
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
FROM aminya/setup-cpp-alpine:latest AS setup-cpp-alpine-llvm
|
||||
|
||||
# install llvm
|
||||
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
|
||||
--compiler llvm && \
|
||||
# cleanup
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
SHELL ["/entrypoint.sh", "/bin/sh", "-c"]
|
||||
ENTRYPOINT ["/entrypoint.sh", "/bin/sh"]
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
FROM aminya/setup-cpp-alpine:latest AS setup-cpp-alpine-mingw
|
||||
|
||||
# install mingw/powershell
|
||||
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
|
||||
--compiler mingw \
|
||||
--powershell true && \
|
||||
# cleanup
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
SHELL ["/entrypoint.sh", "/bin/sh", "-c"]
|
||||
ENTRYPOINT ["/entrypoint.sh", "/bin/sh"]
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
ARG BASE_VERSION=22-alpine3.21
|
||||
|
||||
#### Base Image with Node.js
|
||||
FROM --platform=$BUILDPLATFORM node:${BASE_VERSION} AS alpine-nodejs
|
||||
|
||||
#### Base Image with Tools
|
||||
FROM alpine-nodejs AS setup-cpp-alpine
|
||||
|
||||
COPY "./dist/modern" "/usr/lib/setup-cpp/"
|
||||
|
||||
# install the cpp tools
|
||||
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
|
||||
--cmake true \
|
||||
--ninja true \
|
||||
--task true \
|
||||
--python true \
|
||||
--make true \
|
||||
--cppcheck true \
|
||||
--gcovr true \
|
||||
--doxygen true \
|
||||
--vcpkg true \
|
||||
--ccache true \
|
||||
--conan true \
|
||||
--cmakelang true \
|
||||
--meson true && \
|
||||
# cleanup
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
# Custom entrypoint due to bash -l limitations on Alpine
|
||||
RUN printf '#!/bin/bash\nsource $HOME/.cpprc\nexec "$@"\n' > /entrypoint.sh && \
|
||||
chmod +x /entrypoint.sh
|
||||
|
||||
SHELL ["/entrypoint.sh", "/bin/sh", "-c"]
|
||||
ENTRYPOINT ["/entrypoint.sh", "/bin/sh"]
|
||||
|
|
@ -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 && \
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@ FROM aminya/setup-cpp-ubuntu:latest AS setup-cpp-ubuntu-gcc
|
|||
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
|
||||
--compiler gcc && \
|
||||
# cleanup
|
||||
nala autoremove -y && \
|
||||
nala autopurge -y && \
|
||||
apt-get clean && \
|
||||
nala clean --lists && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
rm -rf /tmp/*
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@ FROM aminya/setup-cpp-ubuntu:latest AS setup-cpp-ubuntu-llvm
|
|||
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
|
||||
--compiler llvm && \
|
||||
# cleanup
|
||||
nala autoremove -y && \
|
||||
nala autopurge -y && \
|
||||
apt-get clean && \
|
||||
nala clean --lists && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
rm -rf /tmp/*
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,8 @@ RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
|
|||
--compiler mingw \
|
||||
--powershell true && \
|
||||
# cleanup
|
||||
nala autoremove -y && \
|
||||
nala autopurge -y && \
|
||||
apt-get clean && \
|
||||
nala clean --lists && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
rm -rf /tmp/*
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
ARG BASE_VERSION=22.04
|
||||
|
||||
#### Base Image with Node.js
|
||||
FROM --platform=$BUILDPLATFORM ubuntu:22.04 AS ubuntu-nodejs
|
||||
FROM --platform=$BUILDPLATFORM ubuntu:${BASE_VERSION} AS ubuntu-nodejs
|
||||
|
||||
# install latest nodejs
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install -y --no-install-recommends curl gnupg ca-certificates && \
|
||||
mkdir -p /etc/apt/keyrings && \
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
||||
apt-get update -qq && \
|
||||
apt-get install -y --no-install-recommends nodejs && \
|
||||
# cleanup
|
||||
|
|
@ -21,7 +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 \
|
||||
--nala true \
|
||||
--apt-fast true \
|
||||
--cmake true \
|
||||
--ninja true \
|
||||
--task true \
|
||||
|
|
@ -36,10 +38,8 @@ RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
|
|||
--cmakelang true \
|
||||
--meson true && \
|
||||
# cleanup
|
||||
nala autoremove -y && \
|
||||
nala autopurge -y && \
|
||||
apt-get clean && \
|
||||
nala clean --lists && \
|
||||
apt-get clean autoclean && \
|
||||
apt-get autoremove -y && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
rm -rf /tmp/*
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
#### Building (example)
|
||||
FROM aminya/setup-cpp-alpine-gcc AS builder
|
||||
|
||||
COPY ./dev/cpp_vcpkg_project /home/app
|
||||
WORKDIR /home/app
|
||||
RUN task build
|
||||
|
||||
#### Running environment
|
||||
# use a fresh image as the runner
|
||||
FROM alpine:3.21 AS runner
|
||||
|
||||
# copy the built binaries and their runtime dependencies
|
||||
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
|
||||
WORKDIR /home/app/
|
||||
ENTRYPOINT ["./my_exe"]
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#### Building (example)
|
||||
FROM aminya/setup-cpp-alpine-llvm AS builder
|
||||
|
||||
COPY ./dev/cpp_vcpkg_project /home/app
|
||||
WORKDIR /home/app
|
||||
RUN task build
|
||||
|
||||
#### Running environment
|
||||
# use a fresh image as the runner
|
||||
FROM alpine:3.21 AS runner
|
||||
|
||||
# copy the built binaries and their runtime dependencies
|
||||
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
|
||||
WORKDIR /home/app/
|
||||
ENTRYPOINT ["./my_exe"]
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#### Cross Building (example)
|
||||
FROM aminya/setup-cpp-alpine-mingw AS builder-mingw
|
||||
|
||||
COPY ./dev/cpp_vcpkg_project /home/app
|
||||
WORKDIR /home/app
|
||||
RUN bash -c 'source ~/.cpprc \
|
||||
&& task build_cross_mingw'
|
||||
|
|
@ -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 && \
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ RUN apt-get update -qq && \
|
|||
apt-get install -y --no-install-recommends curl gnupg ca-certificates && \
|
||||
mkdir -p /etc/apt/keyrings && \
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
||||
apt-get update -qq && \
|
||||
apt-get install -y --no-install-recommends nodejs && \
|
||||
# install setup-cpp
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ RUN apt-get update -qq && \
|
|||
apt-get install -y --no-install-recommends curl gnupg ca-certificates && \
|
||||
mkdir -p /etc/apt/keyrings && \
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
||||
apt-get update -qq && \
|
||||
apt-get install -y --no-install-recommends nodejs && \
|
||||
# install setup-cpp
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ RUN apt-get update -qq && \
|
|||
apt-get install -y --no-install-recommends curl gnupg ca-certificates && \
|
||||
mkdir -p /etc/apt/keyrings && \
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
||||
apt-get update -qq && \
|
||||
apt-get install -y --no-install-recommends nodejs && \
|
||||
# install setup-cpp
|
||||
|
|
|
|||
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.12.0-2","ubuntu":{"22":"1.12.0","18":"1.10.0","else":"1.10.0"},"else":"1.12.0"},"else":"1.12.0"},"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.12.0-2","ubuntu":{"22":"1.12.0","18":"1.10.0","else":"1.10.0"},"else":"1.12.0"},"else":"1.12.0"},"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.1.1"
|
||||
"version": "1.8.0"
|
||||
}
|
||||
|
|
|
|||
133
package.json
133
package.json
|
|
@ -1,84 +1,76 @@
|
|||
{
|
||||
"name": "setup-cpp",
|
||||
"version": "1.2.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 && pnpm 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,45 +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",
|
||||
"semver": "7.7.3",
|
||||
"setup-alpine": "workspace:*",
|
||||
"setup-apt": "workspace:*",
|
||||
"setup-brew": "workspace:*",
|
||||
"setup-python": "github:aminya/setup-python#9700887",
|
||||
"shx": "0.3.4",
|
||||
"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"
|
||||
|
|
@ -184,9 +175,9 @@
|
|||
"retry-as-promised",
|
||||
"semver",
|
||||
"setup-apt",
|
||||
"setup-alpine",
|
||||
"setup-brew",
|
||||
"setup-python",
|
||||
"simple-update-notifier",
|
||||
"time-delta",
|
||||
"ubuntu-version",
|
||||
"untildify-user",
|
||||
|
|
@ -194,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.1",
|
||||
"packageManager": "bun@1.3.6",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
|
|
@ -222,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.3",
|
||||
"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.10",
|
||||
"@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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,8 @@ async function addEnvSystem(name: string, valGiven: string | undefined, options:
|
|||
await appendFile(options.rcPath, `\nexport ${name}="${val}"\n`)
|
||||
info(`${name}="${val}" was added to "${options.rcPath}`)
|
||||
}
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
process.env[name] = val
|
||||
return
|
||||
}
|
||||
default: {
|
||||
|
|
|
|||
|
|
@ -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,3 @@
|
|||
{
|
||||
"extends": "../../.eslintrc.json"
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"name": "setup-alpine",
|
||||
"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",
|
||||
"license": "Apache-2.0",
|
||||
"author": "Amin Yahyaabadi",
|
||||
"main": "./dist/index.js",
|
||||
"source": "./src/index.ts",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"dist",
|
||||
"src",
|
||||
"tsconfig.json"
|
||||
],
|
||||
"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": "25.0.9",
|
||||
"admina": "^1.0.1",
|
||||
"path-exists": "^5.0.0",
|
||||
"ci-log": "workspace:*",
|
||||
"envosman": "workspace:*",
|
||||
"which": "4.0.0",
|
||||
"execa": "7.2.0",
|
||||
"memoizee": "^0.4.17"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"keywords": [
|
||||
"setup",
|
||||
"apk",
|
||||
"apk-add",
|
||||
"repository",
|
||||
"alpine",
|
||||
"install",
|
||||
"setup-apk",
|
||||
"repositories",
|
||||
"linux",
|
||||
"alpine-linux",
|
||||
"package"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/memoizee": "0.4.12",
|
||||
"@types/which": "~3.0.4"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
import { info } from "ci-log"
|
||||
import { appendFile, readFile } from "fs/promises"
|
||||
import { pathExists } from "path-exists"
|
||||
import { hasApk } from "./has-apk.js"
|
||||
import { updateApkMemoized } from "./update.js"
|
||||
|
||||
/**
|
||||
* Add an APK repository
|
||||
* @param repoUrl The URL of the repository to add
|
||||
* @returns Whether the repository was added successfully
|
||||
*/
|
||||
|
||||
export async function addApkRepository(repoUrl: string): Promise<boolean> {
|
||||
if (!(await hasApk())) {
|
||||
throw new Error("apk is not available on this system")
|
||||
}
|
||||
|
||||
try {
|
||||
// Check if repositories file exists
|
||||
const reposFile = "/etc/apk/repositories"
|
||||
if (!(await pathExists(reposFile))) {
|
||||
throw new Error(`APK repositories file not found at ${reposFile}`)
|
||||
}
|
||||
|
||||
// Add repository to the file
|
||||
info(`Adding repository: ${repoUrl}`)
|
||||
await appendFile(reposFile, `${repoUrl}\n`)
|
||||
|
||||
// Update package index after adding repository
|
||||
await updateApkMemoized.clear()
|
||||
await updateApkMemoized()
|
||||
|
||||
info(`Successfully added repository: ${repoUrl}`)
|
||||
return true
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to add repository ${repoUrl}: ${error}`)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the community repository
|
||||
* @returns Whether the repository was added successfully
|
||||
*/
|
||||
export async function enableCommunityRepository() {
|
||||
const alpineVersion = (await getAlpineVersion()).split(".").slice(0, 2).join(".")
|
||||
|
||||
return addApkRepository(`https://dl-cdn.alpinelinux.org/alpine/v${alpineVersion}/community/`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Alpine version
|
||||
* @returns The Alpine version
|
||||
*/
|
||||
export async function getAlpineVersion() {
|
||||
const releaseFile = "/etc/alpine-release"
|
||||
if (!(await pathExists(releaseFile))) {
|
||||
throw new Error(`Alpine release file not found at ${releaseFile}`)
|
||||
}
|
||||
return readFile(releaseFile, "utf8")
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
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 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Check if apk is available on the system
|
||||
*/
|
||||
export const hasApk = memoizee(hasApk_, { promise: true })
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
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,19 @@
|
|||
import { defaultExecOptions, execRootSync } from "admina"
|
||||
import memoize from "memoizee"
|
||||
import { filterAndQualifyApkPackages } from "./qualify-install.js"
|
||||
|
||||
/** Install bash (usually missing from docker containers) */
|
||||
export async function initApk() {
|
||||
const toInstall = await filterAndQualifyApkPackages([
|
||||
{ name: "bash" },
|
||||
])
|
||||
|
||||
if (toInstall.length !== 0) {
|
||||
execRootSync("apk", ["add", ...toInstall], {
|
||||
...defaultExecOptions,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/** Install bash (usually missing from docker containers) (memoized) */
|
||||
export const initApkMemoized = memoize(initApk, { promise: true })
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
import { execRoot } from "admina"
|
||||
import { info, warning } from "ci-log"
|
||||
import { hasApk } from "./has-apk.js"
|
||||
import { initApkMemoized } from "./init-apt.js"
|
||||
import { type ApkPackage, filterAndQualifyApkPackages, formatPackageWithVersion } from "./qualify-install.js"
|
||||
import { updateApkMemoized } from "./update.js"
|
||||
|
||||
/**
|
||||
* The information about an installation result
|
||||
*/
|
||||
export type InstallationInfo = {
|
||||
/** The install dir of the package (Defaults to `undefined`) */
|
||||
installDir?: string
|
||||
/** The bin dir of the package (Defaults to `/usr/bin`) */
|
||||
binDir: string
|
||||
/** The bin path of the package (Defaults to `undefined`) */
|
||||
bin?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Install a package using Alpine's apk package manager
|
||||
* @param packages The packages to install
|
||||
* @param update Whether to update the package index before installing
|
||||
* @returns The installation information
|
||||
*/
|
||||
export async function installApkPack(packages: ApkPackage[], update = false): Promise<InstallationInfo> {
|
||||
// Check if apk is available
|
||||
if (!(await hasApk())) {
|
||||
throw new Error("apk is not available on this system")
|
||||
}
|
||||
|
||||
try {
|
||||
// Update package index if requested
|
||||
|
||||
// init the apk
|
||||
await initApkMemoized()
|
||||
|
||||
if (update) {
|
||||
// Force update the repos
|
||||
await updateApkMemoized.clear()
|
||||
}
|
||||
// Update the repos if needed
|
||||
await updateApkMemoized()
|
||||
|
||||
const packagesToInstall = await filterAndQualifyApkPackages(packages)
|
||||
|
||||
if (packagesToInstall.length === 0) {
|
||||
info("All packages are already installed")
|
||||
return { binDir: "/usr/bin" }
|
||||
}
|
||||
|
||||
// Install the packages
|
||||
info(`Installing ${packagesToInstall.join(" ")}`)
|
||||
await execRoot("apk", ["add", ...packagesToInstall])
|
||||
|
||||
info(`Successfully installed ${packagesToInstall.join(" ")}`)
|
||||
return { binDir: "/usr/bin" }
|
||||
} catch (error) {
|
||||
warning(`Failed to install ${packages.map((pkg) => formatPackageWithVersion(pkg)).join(" ")}: ${error}`)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
|
@ -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,83 @@
|
|||
import { execRoot } from "admina"
|
||||
|
||||
/**
|
||||
* The information about an apt package
|
||||
*/
|
||||
export type ApkPackage = {
|
||||
/** The name of the package */
|
||||
name: string
|
||||
/** The version of the package (optional) */
|
||||
version?: string
|
||||
/** The repository to add before installing the package (optional) */
|
||||
repository?: string
|
||||
/**
|
||||
* If the given version is not available, fall back to the latest version
|
||||
* @default false
|
||||
*/
|
||||
fallBackToLatest?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a package is already installed
|
||||
* @param pkg The package to check
|
||||
* @returns Whether the package is installed
|
||||
*/
|
||||
export async function checkPackageInstalled(pkg: ApkPackage): Promise<boolean> {
|
||||
try {
|
||||
// First check if the package is installed at all
|
||||
const { exitCode } = await execRoot("apk", ["info", "-e", pkg.name], {
|
||||
reject: false,
|
||||
stdio: ["ignore", "pipe", "ignore"],
|
||||
})
|
||||
|
||||
if (exitCode !== 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
// If no specific version is required, we're done
|
||||
if (pkg.version === undefined || pkg.version === "") {
|
||||
return true
|
||||
}
|
||||
|
||||
// Check the installed version
|
||||
const { stdout: versionOutput } = await execRoot("apk", ["info", "-v", pkg.name], {
|
||||
stdio: ["ignore", "pipe", "ignore"],
|
||||
})
|
||||
|
||||
// Parse the version from output (format is typically "package-name-version")
|
||||
const installedVersion = versionOutput.trim().split("-").slice(-1)[0]
|
||||
|
||||
return installedVersion === pkg.version
|
||||
} catch (error) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter out packages that are already installed and qualify those that need installation
|
||||
* @param packages List of packages to check
|
||||
* @returns List of packages that need to be installed
|
||||
*/
|
||||
export async function filterAndQualifyApkPackages(packages: ApkPackage[]): Promise<string[]> {
|
||||
const results = await Promise.all(
|
||||
packages.map(async (pack) => {
|
||||
const isInstalled = await checkPackageInstalled(pack)
|
||||
return isInstalled ? undefined : pack
|
||||
}),
|
||||
)
|
||||
|
||||
return results.filter((pack): pack is ApkPackage => pack !== undefined)
|
||||
.map(formatPackageWithVersion)
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a package with its version if specified
|
||||
* @param pkg The package object
|
||||
* @returns Formatted package string (name=version or just name)
|
||||
*/
|
||||
export function formatPackageWithVersion(pkg: ApkPackage): string {
|
||||
if (pkg.version !== undefined && pkg.version !== "") {
|
||||
return `${pkg.name}=${pkg.version}`
|
||||
}
|
||||
return pkg.name
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import { execa } from "execa"
|
||||
import memoizee from "memoizee"
|
||||
|
||||
async function updateApk() {
|
||||
await execa("apk", ["update"], { stdio: "inherit" })
|
||||
}
|
||||
export const updateApkMemoized = memoizee(updateApk, { promise: true })
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"noEmit": false,
|
||||
"allowImportingTsExtensions": false
|
||||
},
|
||||
"include": ["./src"]
|
||||
}
|
||||
|
|
@ -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)
|
||||
})
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue