Merge pull request #343 from aminya/arm64-docker [skip ci]

ci: add Arm64 docker builds + add setup-cpp base Docker images + fix vcpkg on Linux Arm64 + update apt for the first install
This commit is contained in:
Amin Ya 2025-02-24 11:14:16 -08:00 committed by GitHub
commit 6f636f96f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 290 additions and 219 deletions

View File

@ -105,6 +105,7 @@ jobs:
uses: pnpm/action-setup@v4
- name: Cache node_modules
if: ${{ !contains(matrix.os, 'windows') }}
uses: actions/cache@v4
with:
path: |
@ -170,6 +171,7 @@ jobs:
uses: pnpm/action-setup@v4
- name: Cache node_modules
if: ${{ !contains(matrix.os, 'windows') }}
uses: actions/cache@v4
with:
path: |
@ -217,7 +219,7 @@ jobs:
node ./dist/legacy/setup-cpp.js --gcc true --cmake true
Docker:
name: Docker-${{ matrix.container.image }}
name: Docker-${{ matrix.container.image }}-${{ matrix.platform }}
needs: [Build]
runs-on: ${{ matrix.os }}
strategy:
@ -225,13 +227,16 @@ jobs:
matrix:
os:
- ubuntu-24.04
platform:
- linux/amd64
container:
- { file: "ubuntu-llvm.dockerfile", image: "setup-cpp-ubuntu-llvm", tag: "22.04-0.46.2" }
- { file: "fedora-llvm.dockerfile", image: "setup-cpp-fedora-llvm", tag: "40-0.46.2" }
- { file: "arch-llvm.dockerfile", image: "setup-cpp-arch-llvm", tag: "base-0.46.2" }
- { file: "ubuntu-mingw.dockerfile", image: "setup-cpp-ubuntu-mingw", tag: "22.04-0.46.2" }
# - { file: "fedora-mingw.dockerfile", image: "setup-cpp-fedora-mingw", tag: "40-0.46.2" }
# - { file: "arch-mingw.dockerfile", image: "setup-cpp-arch-mingw", tag: "base-0.46.2" }
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04-0.46.2" }
- { distro: "fedora", image: "setup-cpp-fedora", tag: "40-0.46.2" }
- { distro: "arch", image: "setup-cpp-arch", tag: "base-0.46.2" }
include:
- os: ubuntu-24.04-arm
platform: linux/arm64
container: { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04-0.46.2" }
steps:
- uses: actions/checkout@v4
with:
@ -249,23 +254,59 @@ jobs:
username: aminya
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
- name: Build setup-cpp-${{matrix.container.distro }}
uses: docker/build-push-action@v6
with:
context: .
file: ./dev/docker/ci/${{ matrix.container.file }}
file: ./dev/docker/ci/${{ matrix.container.distro }}.dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: aminya/${{ matrix.container.image }}:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}:latest
platforms: ${{ matrix.platform }}
tags: ${{ matrix.container.image }},aminya/${{ matrix.container.image }}:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}:latest
cache-from: type=registry,ref=user/app:latest
cache-to: type=inline
- name: Test
- name: Build setup-cpp-${{matrix.container.distro }}-llvm
uses: docker/build-push-action@v6
with:
context: .
file: ./dev/docker/examples/${{ matrix.container.file }}
file: ./dev/docker/ci/${{ matrix.container.distro }}-llvm.dockerfile
push: ${{ github.event_name != 'pull_request' }}
platforms: ${{ matrix.platform }}
tags: aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}-llvm:latest
cache-from: type=registry,ref=user/app:latest
cache-to: type=inline
- name: Test LLVM
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && !contains(matrix.platform, 'arm64') }}
uses: docker/build-push-action@v6
with:
context: .
file: ./dev/docker/examples/${{ matrix.container.distro }}-llvm.dockerfile
push: false
tags: aminya/test-${{ matrix.container.image }}:${{ matrix.container.tag }}
platforms: ${{ matrix.platform }}
tags: aminya/test-${{ matrix.container.image }}-llvm:${{ matrix.container.tag }}
- name: Build setup-cpp-${{matrix.container.distro }}-mingw
if: ${{ !contains(matrix.container.distro, 'fedora') }}
uses: docker/build-push-action@v6
with:
context: .
file: ./dev/docker/ci/${{ matrix.container.distro }}-mingw.dockerfile
push: ${{ github.event_name != 'pull_request' }}
platforms: ${{ matrix.platform }}
tags: aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}-mingw:latest
cache-from: type=registry,ref=user/app:latest
cache-to: type=inline
- name: Test Mingw
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && !contains(matrix.container.distro, 'fedora') && !contains(matrix.platform, 'arm64') }}
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 }}
Release:
if: startsWith(github.ref, 'refs/tags/')

View File

@ -20,10 +20,11 @@ words:
- armv
- bazel
- bazelisk
- binfmt
- biome
- mkdirp
- biomejs
- buildtools
- Buildx
- caxa
- ccache
- choco
@ -41,11 +42,13 @@ words:
- dearmor
- deps
- devel
- dpkg
- dprint
- DVCPKG
- dyld
- eabi
- envosman
- esac
- esmodule
- execa
- ftxui
@ -69,6 +72,7 @@ words:
- liuli
- mdimporterdir
- memoizee
- mkdirp
- msbuild
- msvc
- msvcrt
@ -102,6 +106,7 @@ words:
- SYSROOT
- Syuu
- terserrc
- tonistiigi
- Trofimovich
- tsbuildinfo
- ucrt

@ -1 +1 @@
Subproject commit c30589196b2c59a3055dfc7c24244b4a1f48b081
Subproject commit b3f3cd5726740baa888d9e71ec783ca22596c057

View File

@ -1,25 +1,8 @@
## base image
FROM archlinux:base AS setup-cpp-arch
FROM --platform=$BUILDPLATFORM setup-cpp-arch:latest AS setup-cpp-arch-llvm
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
RUN pacman -Syuu --noconfirm && \
pacman-db-upgrade && \
# install nodejs
pacman -S --noconfirm --needed nodejs npm && \
# install the compiler and tools
node /usr/lib/setup-cpp/setup-cpp.js \
--compiler llvm \
--cmake true \
--ninja true \
--task true \
--vcpkg true \
--python true \
--make true \
--cppcheck true \
--gcovr true \
--doxygen true \
--ccache true && \
# install llvm
RUN node /usr/lib/setup-cpp/setup-cpp.js \
--compiler llvm && \
# arch cleanup
pacman -Scc --noconfirm && \
rm -rf /var/cache/pacman/pkg/* && \

View File

@ -1,25 +1,9 @@
## base image
FROM archlinux:base AS setup-cpp-arch-mingw
FROM --platform=$BUILDPLATFORM setup-cpp-arch:latest AS setup-cpp-arch-mingw
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
RUN pacman -Syuu --noconfirm && \
pacman-db-upgrade && \
# install nodejs
pacman -S --noconfirm --needed nodejs npm && \
# install the compiler and tools
node /usr/lib/setup-cpp/setup-cpp.js \
--compiler mingw \
--cmake true \
--ninja true \
--task true \
--vcpkg true \
--python true \
--make true \
--cppcheck true \
--gcovr true \
--doxygen true \
--ccache true && \
# install mingw/powershell
RUN node /usr/lib/setup-cpp/setup-cpp.js \
--compiler mingw \
--powershell true && \
# arch cleanup
pacman -Scc --noconfirm && \
rm -rf /var/cache/pacman/pkg/* && \

View File

@ -0,0 +1,36 @@
## base image
FROM --platform=$BUILDPLATFORM archlinux:base AS arch-nodejs
RUN pacman -Syuu --noconfirm && \
pacman-db-upgrade && \
# install nodejs
pacman -S --noconfirm --needed nodejs npm && \
# cleanup
pacman -Scc --noconfirm && \
rm -rf /var/cache/pacman/pkg/* && \
rm -rf /tmp/*
FROM --platform=$BUILDPLATFORM arch-nodejs AS setup-cpp-arch
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
# install the cpp tools
RUN pacman -Syuu --noconfirm && \
pacman-db-upgrade && \
node /usr/lib/setup-cpp/setup-cpp.js \
--cmake true \
--ninja true \
--task true \
--vcpkg true \
--python true \
--make true \
--cppcheck true \
--gcovr true \
--doxygen true \
--ccache true && \
# arch cleanup
pacman -Scc --noconfirm && \
rm -rf /var/cache/pacman/pkg/* && \
rm -rf /tmp/*
ENTRYPOINT ["/bin/bash"]

View File

@ -1,23 +1,8 @@
## base image
FROM fedora:40 AS setup-cpp-fedora
FROM --platform=$BUILDPLATFORM setup-cpp-fedora:latest AS setup-cpp-fedora-llvm
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
# install nodejs
RUN dnf -y install nodejs npm && \
# install the compiler and tools
node /usr/lib/setup-cpp/setup-cpp.js \
--compiler llvm \
--cmake true \
--ninja true \
--task true \
--vcpkg true \
--python true \
--make true \
--cppcheck true \
--gcovr true \
--doxygen true \
--ccache true && \
# install llvm
RUN node /usr/lib/setup-cpp/setup-cpp.js \
--compiler llvm && \
# cleanup
dnf clean all && \
rm -rf /tmp/*

View File

@ -1,24 +1,9 @@
## base image
FROM fedora:40 AS setup-cpp-fedora-mingw
FROM --platform=$BUILDPLATFORM setup-cpp-fedora:latest AS setup-cpp-fedora-mingw
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
# install nodejs
RUN dnf -y install nodejs npm && \
# install the compiler and tools
node /usr/lib/setup-cpp/setup-cpp.js \
--compiler mingw \
--cmake true \
--ninja true \
--task true \
--vcpkg true \
--python true \
--make true \
--cppcheck true \
--gcovr true \
--doxygen true \
--ccache true \
--powershell true && \
# install mingw
RUN node /usr/lib/setup-cpp/setup-cpp.js \
--compiler mingw \
--powershell true && \
# cleanup
dnf clean all && \
rm -rf /tmp/*

View File

@ -0,0 +1,30 @@
## base image
FROM --platform=$BUILDPLATFORM fedora:40 AS fedora-nodejs
# install nodejs
RUN dnf -y install nodejs npm && \
# cleanup
dnf clean all && \
rm -rf /tmp/*
FROM --platform=$BUILDPLATFORM fedora-nodejs AS setup-cpp-fedora
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
# install the cpp tools
RUN node /usr/lib/setup-cpp/setup-cpp.js \
--cmake true \
--ninja true \
--task true \
--vcpkg true \
--python true \
--make true \
--cppcheck true \
--gcovr true \
--doxygen true \
--ccache true && \
# cleanup
dnf clean all && \
rm -rf /tmp/*
ENTRYPOINT ["/bin/bash"]

View File

@ -1,25 +1,8 @@
#### Base Image
FROM ubuntu:22.04 AS setup-cpp-ubuntu
FROM --platform=$BUILDPLATFORM setup-cpp-ubuntu:latest AS setup-cpp-ubuntu-llvm
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
RUN apt-get update -qq && \
# install nodejs
apt-get install -y --no-install-recommends nodejs npm && \
# install the compiler and tools
node /usr/lib/setup-cpp/setup-cpp.js \
--nala true \
--compiler llvm \
--cmake true \
--ninja true \
--task true \
--vcpkg true \
--python true \
--make true \
--cppcheck true \
--gcovr true \
--doxygen true \
--ccache true && \
# install llvm
RUN node /usr/lib/setup-cpp/setup-cpp.js \
--compiler llvm && \
# cleanup
nala autoremove -y && \
nala autopurge -y && \

View File

@ -1,26 +1,9 @@
#### Base Image
FROM ubuntu:22.04 AS setup-cpp-ubuntu-mingw
FROM --platform=$BUILDPLATFORM setup-cpp-ubuntu:latest AS setup-cpp-ubuntu-mingw
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
RUN apt-get update -qq && \
# install nodejs
apt-get install -y --no-install-recommends nodejs npm && \
# install the compiler and tools
node /usr/lib/setup-cpp/setup-cpp.js \
--nala true \
--compiler mingw \
--cmake true \
--ninja true \
--task true \
--vcpkg true \
--python true \
--make true \
--cppcheck true \
--gcovr true \
--doxygen true \
--ccache true \
--powershell true && \
# install mingw/powershell
RUN node /usr/lib/setup-cpp/setup-cpp.js \
--compiler mingw \
--powershell true && \
# cleanup
nala autoremove -y && \
nala autopurge -y && \

View File

@ -0,0 +1,46 @@
#### Base Image with Node.js
FROM --platform=$BUILDPLATFORM ubuntu:22.04 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 && \
apt-get update -qq && \
apt-get install -y --no-install-recommends nodejs && \
# cleanup
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/*
#### Base Image with Tools
FROM --platform=$BUILDPLATFORM ubuntu-nodejs AS setup-cpp-ubuntu
COPY "./dist/legacy" "/usr/lib/setup-cpp/"
# install the cpp tools
RUN node /usr/lib/setup-cpp/setup-cpp.js \
--nala true \
--cmake true \
--ninja true \
--task true \
--python true \
--make true \
--cppcheck true \
--gcovr true \
--doxygen true \
--ccache true && \
# install vcpkg if the architecture is amd64
dpkgArch="$(dpkg --print-architecture)" && \
case "${dpkgArch##*-}" in \
amd64) node /usr/lib/setup-cpp/setup-cpp.js --vcpkg true ;; \
*) echo >&2 "unsupported vcpkg architecture: ${dpkgArch}" ;; \
esac && \
# cleanup
nala autoremove -y && \
nala autopurge -y && \
apt-get clean && \
nala clean --lists && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/*

View File

@ -1,9 +1,14 @@
#### Base Image
FROM ubuntu:22.04 AS setup-cpp-ubuntu
# install latest nodejs
RUN apt-get update -qq && \
# install nodejs
apt-get install -y --no-install-recommends nodejs npm && \
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 && \
apt-get update -qq && \
apt-get install -y --no-install-recommends nodejs && \
# install setup-cpp
npm install -g setup-cpp@v0.46.2 && \
# install the compiler and tools

View File

@ -1,9 +1,14 @@
#### Base Image
FROM ubuntu:22.04 AS setup-cpp-ubuntu-mingw
# install latest nodejs
RUN apt-get update -qq && \
# install nodejs
apt-get install -y --no-install-recommends nodejs npm && \
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 && \
apt-get update -qq && \
apt-get install -y --no-install-recommends nodejs && \
# install setup-cpp
npm install -g setup-cpp@v0.46.2 && \
# install the compiler and tools

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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","linux":{"ubuntu":{"22":"8.0.0-1","20":"7.0.0-2","else":"7.0.0-2"},"else":""},"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.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"}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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","linux":{"ubuntu":{"22":"8.0.0-1","20":"7.0.0-2","else":"7.0.0-2"},"else":""},"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.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"}}

View File

@ -1,6 +1,6 @@
{
"name": "setup-apt",
"version": "3.0.0",
"version": "3.0.1",
"description": "Setup apt packages and repositories in Debian/Ubuntu-based distributions",
"repository": "https://github.com/aminya/setup-cpp",
"homepage": "https://github.com/aminya/setup-cpp/tree/master/packages/setup-apt",

View File

@ -8,7 +8,7 @@ import { updateAptReposMemoized } from "./update.js"
export async function addAptRepository(repo: string, apt = getApt()) {
await initAptMemoized(apt)
await installAddAptRepo(apt)
await installAddAptRepo()
execRootSync("add-apt-repository", ["-y", "--no-update", repo], { ...defaultExecOptions, env: getAptEnv(apt) })
// Update the repos
@ -16,10 +16,11 @@ export async function addAptRepository(repo: string, apt = getApt()) {
updateAptReposMemoized(apt)
}
export async function installAddAptRepo(apt: string) {
export async function installAddAptRepo() {
if (await isAptPackInstalled("software-properties-common")) {
return
}
const apt = "apt-get"
execRootSync(
apt,
["install", "-y", "--fix-broken", "-o", aptTimeout, "software-properties-common"],
@ -29,7 +30,7 @@ export async function installAddAptRepo(apt: string) {
export async function removeAptRepository(repo: string, apt = getApt()) {
await initAptMemoized(apt)
await installAddAptRepo(apt)
await installAddAptRepo()
execRootSync("add-apt-repository", ["-y", "--no-update", "--remove", repo], {
...defaultExecOptions,
env: getAptEnv(apt),

View File

@ -80,10 +80,12 @@ export async function installAptPack(packages: AptPackage[], update = false): Pr
info(`Installing ${name} ${version ?? ""} via ${apt}`)
}
// Update the repos if needed
if (update) {
updateAptReposMemoized(apt)
// Force update the repos
updateAptReposMemoized.clear()
}
// Update the repos if needed
updateAptReposMemoized(apt)
// Add the repos if needed
await addRepositories(apt, packages)

View File

@ -75,6 +75,11 @@ async function aptPackageType(apt: string, name: string, version: string | undef
return aptPackageType(apt, name, version)
}
if (version === undefined || version === "") {
// if the version is undefined or empty, return the name as a package name
return AptPackageType.Name
}
return AptPackageType.None
}
@ -87,12 +92,17 @@ async function getAptArg(apt: string, pack: AptPackage) {
return `${name}-${version}`
case AptPackageType.NameEqualsVersion:
return `${name}=${version}`
case AptPackageType.Name:
if (version !== undefined && version !== "" && fallBackToLatest) {
warning(`Could not find package ${name} with version ${version}. Installing the latest version.`)
case AptPackageType.Name: {
if (version === undefined || version === "") {
return name
}
return name
if (fallBackToLatest) {
warning(`Could not find package '${name}' with version '${version}'. Installing the latest version.`)
return name
}
throw new Error(`Could not find package '${name}' with version '${version}'`)
}
default:
throw new Error(`Could not find package ${name} ${version ?? ""}`)
throw new Error(`Could not find package '${name}' ${version ?? "with unspecified version"}`)
}
}

View File

@ -13,7 +13,7 @@ export let updatedRepos = false // eslint-disable-line import/no-mutable-exports
export function updateAptRepos(apt: string = getApt()) {
execRootSync(
apt,
apt !== "nala" ? ["update", "-y", "-o", aptTimeout] : ["update", "-o", aptTimeout],
["update", "-o", aptTimeout],
{ ...defaultExecOptions, env: getAptEnv(apt) },
)

View File

@ -44,14 +44,7 @@ export async function setupMingw(version: string, setupDir: string, arch: string
} else if (hasDnf()) {
installationInfo = await setupDnfPack([{ name: "mingw64-gcc", version }])
} else if (isUbuntu()) {
installationInfo = await installAptPack([
{
name: "mingw-w64",
version,
repository: "ppa:ubuntu-toolchain-r/test",
key: { key: "1E9377A2BA9EF27F", fileName: "ubuntu-toolchain-r-test.gpg" },
},
])
installationInfo = await installAptPack([{ name: "mingw-w64", version }])
} else {
throw new Error(`Unsupported Linux distro for ${arch}`)
}

View File

@ -1,7 +1,6 @@
import { join } from "path"
import { endGroup, startGroup } from "@actions/core"
import { error } from "ci-log"
import pTimeout from "p-timeout"
import { setupBrew } from "setup-brew"
import { getSuccessMessage, rcOptions } from "./cli-options.js"
import { type ToolName, llvmTools, setups } from "./tool.js"
@ -9,7 +8,7 @@ import type { InstallationInfo } from "./utils/setup/setupBin.js"
import { setupVCVarsall } from "./vcvarsall/vcvarsall.js"
import { getVersion } from "./versions/versions.js"
export const DEFAULT_TIMEOUT = 20 * 60 * 1000 // 20 minutes
export const DEFAULT_TIMEOUT = 60 * 60 * 1000 // 60 minutes
export async function installTool(
tool: ToolName,
@ -19,14 +18,11 @@ export async function installTool(
setupCppDir: string,
successMessages: string[],
errorMessages: string[],
timeout: number = DEFAULT_TIMEOUT,
_timeout: number = DEFAULT_TIMEOUT, // TODO: pass to execa
) {
startGroup(`Installing ${tool} ${version}`)
try {
await pTimeout(installToolImpl(tool, version, osVersion, arch, setupCppDir, successMessages), {
milliseconds: timeout,
message: `Timeout while installing ${tool} ${version}. You can increase the timeout from options`,
})
await installToolImpl(tool, version, osVersion, arch, setupCppDir, successMessages)
} catch (e) {
// push error message to the logger
error(e as string | Error)

View File

@ -5,7 +5,7 @@ import { execRoot } from "admina"
import { addPath } from "envosman"
import { chmod, readFile, writeFile } from "fs/promises"
import { DownloaderHelper } from "node-downloader-helper"
import { aptTimeout, hasNala, installAptPack, isAptPackRegexInstalled } from "setup-apt"
import { aptTimeout, hasNala, installAddAptRepo, installAptPack, isAptPackRegexInstalled } from "setup-apt"
import { rcOptions } from "../cli-options.js"
import { DEFAULT_TIMEOUT } from "../installTool.js"
import type { InstallationInfo } from "../utils/setup/setupBin.js"
@ -33,13 +33,14 @@ export async function setupLLVMApt(
const installerScript = await readFile(dl.getDownloadPath(), "utf-8")
const installerPath = join(tmpdir(), "llvm-setup-cpp.sh")
const neededPackages = await patchAptLLVMScript(
await patchAptLLVMScript(
installerScript,
installerPath,
majorVersion,
packages,
)
await installAptPack(neededPackages)
await installAddAptRepo()
await installAptPack([{ name: "lsb-release" }, { name: "wget" }, { name: "gnupg" }])
await chmod(installerPath, "755")
await execRoot(
"bash",
@ -73,9 +74,6 @@ async function patchAptLLVMScript(
script = useNalaScript(script)
await writeFile(target_path, script)
// the packages needed by the script
return [{ name: "lsb-release" }, { name: "wget" }, { name: "software-properties-common" }, { name: "gnupg" }]
}
function debugScript(script: string) {
@ -90,7 +88,7 @@ function nonInteractiveScript(script: string) {
return script.replace(
/add-apt-repository\s*(-y)?\s*"\${REPO_NAME}"/g,
`add-apt-repository -y -n "\${REPO_NAME}"
apt-get update -o ${aptTimeout} -y`,
apt-get update -o ${aptTimeout}`,
)
}

View File

@ -71,33 +71,36 @@ async function main(args: string[]): Promise<number> {
// loop over the tools and run their setup function
let failedFast = false
for (const tool of tools) {
// fail fast inside CI when any tool fails
if (isCI && errorMessages.length !== 0) {
failedFast = true
break
}
// get the version or "true" or undefined for this tool from the options
for (const tool of tools) { // get the version or "true" or undefined for this tool from the options
const version = opts[tool]
// skip if undefined
if (version !== undefined) {
// running the setup function for this tool
time1 = Date.now()
// eslint-disable-next-line no-await-in-loop
await installTool(
tool,
version,
osVersion,
arch,
setupCppDir,
successMessages,
errorMessages,
Number.parseFloat(opts.timeout ?? "20") * 60 * 1000,
)
time2 = Date.now()
info(`took ${timeFormatter.format(time1, time2) || "0 seconds"}`)
// skip if undefined or false
if (version === undefined || version === "false") {
continue
}
const timeout = opts.timeout !== undefined ? Number.parseFloat(opts.timeout) * 60 * 1000 : undefined
// running the setup function for this tool
time1 = Date.now()
// eslint-disable-next-line no-await-in-loop
await installTool(
tool,
version,
osVersion,
arch,
setupCppDir,
successMessages,
errorMessages,
timeout,
)
time2 = Date.now()
info(`took ${timeFormatter.format(time1, time2) || "0 seconds"}`)
// fail fast inside CI when any tool fails
if (errorMessages.length !== 0 && isCI) {
failedFast = true
break
}
}

View File

@ -1,13 +1,14 @@
import { dirname, join } from "path"
import { grantUserWriteAccess } from "admina"
import { info, notice } from "ci-log"
import { addPath } from "envosman"
import { addEnv, addPath } from "envosman"
import { execaSync } from "execa"
import { pathExists } from "path-exists"
import { addShExt, addShRelativePrefix } from "patha"
import { installAptPack } from "setup-apt"
import which from "which"
import { rcOptions } from "../cli-options.js"
import { arm64 } from "../utils/env/arch.js"
import { hasDnf } from "../utils/env/hasDnf.js"
import { isArch } from "../utils/env/isArch.js"
import { isUbuntu } from "../utils/env/isUbuntu.js"
@ -17,8 +18,7 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
let hasVCPKG = false
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupVcpkg(version: string, setupDir: string, _arch: string): Promise<InstallationInfo> {
export async function setupVcpkg(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) {
if (process.platform === "linux") {
// vcpkg download and extraction dependencies
@ -68,6 +68,11 @@ export async function setupVcpkg(version: string, setupDir: string, _arch: strin
})
}
// Add VCPKG_FORCE_SYSTEM_BINARIES=1 for Linux arm64
if (process.platform === "linux" && arch in arm64) {
await addEnv("VCPKG_FORCE_SYSTEM_BINARIES", "1")
}
// bootstrap vcpkg
execaSync(addShExt(addShRelativePrefix("bootstrap-vcpkg"), ".bat"), {
cwd: setupDir,

View File

@ -46,14 +46,6 @@
},
"mingw": {
"win32": "14.2.0posix-18.1.8-12.0.0-ucrt-r1",
"linux": {
"ubuntu": {
"22": "8.0.0-1",
"20": "7.0.0-2",
"else": "7.0.0-2"
},
"else": ""
},
"else": ""
},
"gcovr": {