mirror of https://github.com/aminya/setup-cpp.git
Merge pull request #375 from aminya/ubuntu-base-versions
feat: add Ubuntu 20 and 24 docker builds
This commit is contained in:
commit
be9505b2e5
|
|
@ -228,7 +228,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:
|
||||
|
|
@ -239,13 +239,21 @@ jobs:
|
|||
platform:
|
||||
- linux/amd64
|
||||
container:
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04-1.2.2" }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", BASE_VERSION: "24.04", tag: "24.04-1.2.2" }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", BASE_VERSION: "22.04", tag: "22.04-1.2.2" }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", BASE_VERSION: "20.04", tag: "20.04-1.2.2" }
|
||||
- { distro: "fedora", image: "setup-cpp-fedora", tag: "40-1.2.2" }
|
||||
- { distro: "arch", image: "setup-cpp-arch", tag: "base-1.2.2" }
|
||||
include:
|
||||
- os: ubuntu-24.04-arm
|
||||
platform: linux/arm64
|
||||
container: { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04-1.2.2" }
|
||||
container: { distro: "ubuntu", image: "setup-cpp-ubuntu", BASE_VERSION: "24.04", tag: "24.04-1.2.2" }
|
||||
- os: ubuntu-24.04-arm
|
||||
platform: linux/arm64
|
||||
container: { distro: "ubuntu", image: "setup-cpp-ubuntu", BASE_VERSION: "22.04", tag: "22.04-1.2.2" }
|
||||
- os: ubuntu-24.04-arm
|
||||
platform: linux/arm64
|
||||
container: { distro: "ubuntu", image: "setup-cpp-ubuntu", BASE_VERSION: "20.04", tag: "20.04-1.2.2" }
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
|
@ -285,6 +293,7 @@ jobs:
|
|||
tags: aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-from: type=registry,ref=aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-${{ steps.platform.outputs.suffix }}
|
||||
cache-to: type=inline
|
||||
build-args: BASE_VERSION=${{ matrix.container.BASE_VERSION || '' }}
|
||||
|
||||
- name: Tag latest locally
|
||||
run: |
|
||||
|
|
@ -432,6 +441,14 @@ jobs:
|
|||
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: "22.04-1.2.2", suffix: "", latest: true }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04-1.2.2", suffix: "-llvm", latest: true }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04-1.2.2", suffix: "-gcc", latest: true }
|
||||
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04-1.2.2", suffix: "-mingw", latest: true }
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
|
@ -444,53 +461,16 @@ jobs:
|
|||
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu:22.04-1.2.2
|
||||
images: aminya/setup-cpp-ubuntu:22.04-1.2.2-amd64,aminya/setup-cpp-ubuntu:22.04-1.2.2-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.2.2-amd64,aminya/setup-cpp-ubuntu:22.04-1.2.2-arm64
|
||||
inputs: aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}
|
||||
images: aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-amd64,aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-arm64
|
||||
push: true
|
||||
amend: true
|
||||
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
if: ${{ matrix.container.latest }}
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu-llvm:22.04-1.2.2
|
||||
images: aminya/setup-cpp-ubuntu-llvm:22.04-1.2.2-amd64,aminya/setup-cpp-ubuntu-llvm:22.04-1.2.2-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.2.2-amd64,aminya/setup-cpp-ubuntu-llvm:22.04-1.2.2-arm64
|
||||
push: true
|
||||
amend: true
|
||||
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu-gcc:22.04-1.2.2
|
||||
images: aminya/setup-cpp-ubuntu-gcc:22.04-1.2.2-amd64,aminya/setup-cpp-ubuntu-gcc:22.04-1.2.2-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.2.2-amd64,aminya/setup-cpp-ubuntu-gcc:22.04-1.2.2-arm64
|
||||
push: true
|
||||
amend: true
|
||||
|
||||
- uses: Noelware/docker-manifest-action@0.4.3
|
||||
with:
|
||||
inputs: aminya/setup-cpp-ubuntu-mingw:22.04-1.2.2
|
||||
images: aminya/setup-cpp-ubuntu-mingw:22.04-1.2.2-amd64,aminya/setup-cpp-ubuntu-mingw:22.04-1.2.2-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.2.2-amd64,aminya/setup-cpp-ubuntu-mingw:22.04-1.2.2-arm64
|
||||
inputs: aminya/${{ matrix.container.image }}:latest
|
||||
images: aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-amd64,aminya/${{ matrix.container.image }}:${{ matrix.container.tag }}-arm64
|
||||
push: true
|
||||
amend: true
|
||||
|
||||
|
|
|
|||
|
|
@ -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,6 @@ 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 \
|
||||
--cmake true \
|
||||
--ninja true \
|
||||
--task true \
|
||||
|
|
@ -36,10 +37,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/*
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
|
@ -4,6 +4,7 @@ import { dirname, join, parse as pathParse } from "path"
|
|||
import { getExecOutput } from "@actions/exec"
|
||||
import ciInfo from "ci-info"
|
||||
const { GITHUB_ACTIONS } = ciInfo
|
||||
import { endGroup, startGroup } from "@actions/core"
|
||||
import { info, notice, warning } from "ci-log"
|
||||
import { addPath } from "envosman"
|
||||
import { execa } from "execa"
|
||||
|
|
@ -11,7 +12,7 @@ import { readdir } from "fs/promises"
|
|||
import memoize from "memoizee"
|
||||
import { pathExists } from "path-exists"
|
||||
import { addExeExt } from "patha"
|
||||
import { installAptPack } from "setup-apt"
|
||||
import { installAptPack, isAptPackInstalled } from "setup-apt"
|
||||
import { installBrewPack } from "setup-brew"
|
||||
import which from "which"
|
||||
import { rcOptions } from "../cli-options.js"
|
||||
|
|
@ -37,21 +38,34 @@ export async function setupPython(
|
|||
setupDir: string,
|
||||
arch: string,
|
||||
): Promise<InstallationInfo & { bin: string }> {
|
||||
startGroup("Setup Python")
|
||||
const installInfo = await findOrSetupPython(version, setupDir, arch)
|
||||
assert(installInfo.bin !== undefined)
|
||||
const foundPython = installInfo.bin
|
||||
endGroup()
|
||||
|
||||
// setup venv
|
||||
startGroup("Setup venv")
|
||||
await setupVenv(foundPython)
|
||||
endGroup()
|
||||
|
||||
// setup pip
|
||||
startGroup("Setup pip")
|
||||
const foundPip = await findOrSetupPip(foundPython)
|
||||
endGroup()
|
||||
if (foundPip === undefined) {
|
||||
throw new Error("pip was not installed correctly")
|
||||
}
|
||||
|
||||
// setup pipx
|
||||
startGroup("Setup pipx")
|
||||
await setupPipx(foundPython)
|
||||
endGroup()
|
||||
|
||||
// setup wheel
|
||||
startGroup("Setup wheel")
|
||||
await setupWheel(foundPython)
|
||||
endGroup()
|
||||
|
||||
return installInfo as InstallationInfo & { bin: string }
|
||||
}
|
||||
|
|
@ -59,27 +73,35 @@ export async function setupPython(
|
|||
async function setupPipx(foundPython: string) {
|
||||
try {
|
||||
if (!(await hasPipxModule(foundPython))) {
|
||||
// install pipx for the system-wide python
|
||||
try {
|
||||
// first try with the system-wide pipx
|
||||
await setupPipPackSystem("pipx", isArch())
|
||||
// then install with the system-wide pipx
|
||||
await setupPipPackWithPython(foundPython, "pipx", undefined, { upgrade: true, usePipx: false })
|
||||
} catch (err) {
|
||||
throw new Error(`pipx was not installed completely: ${err}`)
|
||||
notice(`pipx was not installed completely for the system-wide python: ${err}`)
|
||||
}
|
||||
|
||||
// install pipx for the given python if the system-wide pipx is different for the given python
|
||||
try {
|
||||
if (!(await hasPipxModule(foundPython))) {
|
||||
await setupPipPackWithPython(foundPython, "pipx", undefined, { upgrade: true, usePipx: false })
|
||||
}
|
||||
} catch (err) {
|
||||
notice(`pipx was not installed completely for ${foundPython}: ${err}`)
|
||||
}
|
||||
}
|
||||
|
||||
// install ensurepath for the given python
|
||||
if (await hasPipxModule(foundPython)) {
|
||||
await execa(foundPython, ["-m", "pipx", "ensurepath"], { stdio: "inherit" })
|
||||
return
|
||||
} else if (await hasPipxBinary()) {
|
||||
notice("pipx module not found. Trying to install with pipx binary...")
|
||||
// install ensurepath with the pipx binary
|
||||
notice(`pipx module not found for ${foundPython}. Trying to install with pipx binary...`)
|
||||
await execa("pipx", ["ensurepath"], { stdio: "inherit" })
|
||||
return
|
||||
} else {
|
||||
throw new Error("pipx module or pipx binary not found. Corrput pipx installation.")
|
||||
}
|
||||
} catch (err) {
|
||||
notice(`Failed to install pipx: ${(err as Error).toString()}. Ignoring...`)
|
||||
notice(`Failed to install pipx completely for ${foundPython}: ${(err as Error).toString()}. Ignoring...`)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,6 +122,12 @@ async function hasVenv(foundPython: string): Promise<boolean> {
|
|||
try {
|
||||
// check if venv module exits
|
||||
await execa(foundPython, ["-m", "venv", "-h"], { stdio: "ignore" })
|
||||
|
||||
// checking venv module is not enough on Ubuntu 20.04
|
||||
if (isUbuntu()) {
|
||||
return isAptPackInstalled("python3-venv")
|
||||
}
|
||||
|
||||
return true
|
||||
} catch {
|
||||
// if module not found, continue
|
||||
|
|
|
|||
Loading…
Reference in New Issue