Skip to content

Commit a910f0d

Browse files
authored
Merge pull request #100 from aminya/fedora [skip ci]
2 parents 09018b0 + 834fea8 commit a910f0d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+249
-90
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
- "ubuntu_node.dockerfile"
9393
- "ubuntu_20.04_node.dockerfile"
9494
- "arch_node.dockerfile"
95+
- "fedora_node.dockerfile"
9596
node:
9697
- 14
9798
pnpm:

dev/docker/arch_node.dockerfile

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,13 @@
22
FROM archlinux as base
33

44
RUN pacman -Syuu --noconfirm
5+
RUN pacman-db-upgrade
56

6-
# Install packages available from standard repos
7-
RUN pacman-db-upgrade && \
8-
pacman -S --noconfirm --needed \
9-
wget curl pkg-config zip unzip tar git && \
10-
pacman -S --noconfirm \
11-
nodejs && \
12-
pacman -Scc --noconfirm
7+
# nodejs
8+
RUN pacman -S --noconfirm --needed nodejs
139

14-
# install yay
15-
#RUN useradd -m -G nobody -s /bin/bash yay && passwd -d yay && echo "yay ALL=(ALL) ALL" >> /etc/sudoers
16-
#RUN git clone --depth 1 https://aur.archlinux.org/yay.git /opt/yay && cd /opt/yay && \
17-
# chown -R yay:root . && chmod -R 775 . && \
18-
# runuser -l yay -c "cd /opt/yay && makepkg -si --noprogressbar --noconfirm"
10+
# curl for downloading setup-cpp
11+
RUN pacman -S --noconfirm --needed curl
1912

2013
# add setup_cpp.js
2114
COPY "./dist/" "/"
@@ -26,7 +19,6 @@ RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck tru
2619

2720
# clean up
2821
RUN pacman -Scc --noconfirm
29-
#RUN rm -rf /home/yay/.cache/*
3022
RUN rm -rf /tmp/*
3123

3224
CMD source ~/.cpprc

dev/docker/fedora_node.dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## base image
2+
FROM fedora as base
3+
4+
# nodejs
5+
RUN dnf -y install nodejs
6+
7+
# curl for downloading setup-cpp
8+
RUN dnf -y install curl
9+
10+
# add setup_cpp.js
11+
COPY "./dist/" "/"
12+
WORKDIR "/"
13+
14+
# run installation
15+
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true
16+
17+
# clean up
18+
RUN rm -rf /tmp/*
19+
20+
CMD source ~/.cpprc
21+
ENTRYPOINT [ "/bin/bash" ]
22+
23+
#### Building
24+
FROM base AS builder
25+
COPY ./dev/cpp_vcpkg_project /home/app
26+
WORKDIR /home/app
27+
RUN bash -c 'source ~/.cpprc \
28+
&& task build'
29+
30+
### Running environment
31+
# use a distroless image or ubuntu:22.04 if you wish
32+
FROM gcr.io/distroless/cc
33+
# copy the built binaries and their runtime dependencies
34+
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
35+
WORKDIR /home/app/
36+
ENTRYPOINT ["./my_exe"]

dist/actions_python.239cf807.js renamed to dist/actions_python.3d426834.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions_python.239cf807.js.map renamed to dist/actions_python.3d426834.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions_python.aa574a9a.js renamed to dist/actions_python.a137bcdc.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions_python.aa574a9a.js.map renamed to dist/actions_python.a137bcdc.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/setup_cpp.mjs.map

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/ccache/ccache.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
33
import { setupBrewPack } from "../utils/setup/setupBrewPack"
44
import { setupChocoPack } from "../utils/setup/setupChocoPack"
55
import { isArch } from "../utils/env/isArch"
6+
import { hasDnf } from "../utils/env/hasDnf"
7+
import { setupDnfPack } from "../utils/setup/setupDnfPack"
8+
import { isUbuntu } from "../utils/env/isUbuntu"
69

710
// eslint-disable-next-line @typescript-eslint/no-unused-vars
811
export function setupCcache(version: string, _setupDir: string, _arch: string) {
@@ -16,8 +19,12 @@ export function setupCcache(version: string, _setupDir: string, _arch: string) {
1619
case "linux": {
1720
if (isArch()) {
1821
return setupPacmanPack("ccache", version)
22+
} else if (hasDnf()) {
23+
return setupDnfPack("ccache", version)
24+
} else if (isUbuntu()) {
25+
return setupAptPack("ccache", version)
1926
}
20-
return setupAptPack("ccache", version)
27+
throw new Error(`Unsupported linux distribution`)
2128
}
2229
default: {
2330
throw new Error(`Unsupported platform`)

src/cmake/__tests__/cmake.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { setupCmake } from "../cmake"
22
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
3-
import { isGitHubCI } from "../../utils/env/isci"
3+
import { isGitHubCI } from "../../utils/env/isCI"
44
import { getVersion } from "../../default_versions"
55

66
jest.setTimeout(300000)

src/cppcheck/cppcheck.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
44
import { setupBrewPack } from "../utils/setup/setupBrewPack"
55
import { setupChocoPack } from "../utils/setup/setupChocoPack"
66
import { isArch } from "../utils/env/isArch"
7+
import { hasDnf } from "../utils/env/hasDnf"
8+
import { setupDnfPack } from "../utils/setup/setupDnfPack"
9+
import { isUbuntu } from "../utils/env/isUbuntu"
710

811
// eslint-disable-next-line @typescript-eslint/no-unused-vars
912
export async function setupCppcheck(version: string | undefined, _setupDir: string, _arch: string) {
@@ -19,8 +22,12 @@ export async function setupCppcheck(version: string | undefined, _setupDir: stri
1922
case "linux": {
2023
if (isArch()) {
2124
return setupPacmanPack("cppcheck", version)
25+
} else if (hasDnf()) {
26+
return setupDnfPack("ccache", version)
27+
} else if (isUbuntu()) {
28+
return setupAptPack("cppcheck", version)
2229
}
23-
return setupAptPack("cppcheck", version)
30+
throw new Error(`Unsupported linux distribution`)
2431
}
2532
default: {
2633
throw new Error(`Unsupported platform`)

src/doxygen/doxygen.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import { getVersion } from "../default_versions"
1212
import { existsSync } from "fs"
1313
import { join } from "path"
1414
import { isArch } from "../utils/env/isArch"
15+
import { hasDnf } from "../utils/env/hasDnf"
16+
import { setupDnfPack } from "../utils/setup/setupDnfPack"
17+
import { isUbuntu } from "../utils/env/isUbuntu"
1518

1619
/** Get the platform data for cmake */
1720
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -58,25 +61,27 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
5861
}
5962
case "linux": {
6063
let installationInfo: InstallationInfo
61-
if (version === "") {
64+
if (version === "" || isArch() || hasDnf()) {
6265
if (isArch()) {
63-
installationInfo = setupPacmanPack("doxygen", undefined)
66+
installationInfo = setupPacmanPack("doxygen", version)
67+
} else if (hasDnf()) {
68+
return setupDnfPack("doxygen", version)
69+
} else if (isUbuntu()) {
70+
installationInfo = setupAptPack("doxygen", version)
6471
} else {
72+
throw new Error(`Unsupported linux distributions`)
73+
}
74+
} else if (isUbuntu()) {
75+
try {
76+
// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
77+
installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
78+
setupAptPack("libclang-cpp9")
79+
} catch (err) {
80+
notice(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
6581
installationInfo = setupAptPack("doxygen", undefined)
6682
}
6783
} else {
68-
if (isArch()) {
69-
installationInfo = setupPacmanPack("doxygen", version)
70-
} else {
71-
try {
72-
// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
73-
installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
74-
setupAptPack("libclang-cpp9")
75-
} catch (err) {
76-
notice(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
77-
installationInfo = setupAptPack("doxygen", undefined)
78-
}
79-
}
84+
throw new Error(`Unsupported linux distributions`)
8085
}
8186
await setupGraphviz(getVersion("graphviz", undefined), "", arch)
8287
return installationInfo

src/gcc/gcc.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ import semverCoerce from "semver/functions/coerce"
99
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
1010
import path from "path"
1111
import { warning, info } from "../utils/io/io"
12-
import { isGitHubCI } from "../utils/env/isci"
12+
import { isGitHubCI } from "../utils/env/isCI"
1313
import { addBinExtension } from "../utils/extension/extension"
1414
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
1515
import { extract7Zip } from "../utils/setup/extract"
1616
import { isArch } from "../utils/env/isArch"
1717
import { isUbuntu } from "../utils/env/isUbuntu"
18+
import { hasDnf } from "../utils/env/hasDnf"
19+
import { setupDnfPack } from "../utils/setup/setupDnfPack"
1820

1921
interface MingwInfo {
2022
releaseName: string
@@ -84,15 +86,19 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
8486
if (arch === "x64") {
8587
if (isArch()) {
8688
installationInfo = setupPacmanPack("gcc", version)
87-
} else {
89+
} else if (hasDnf()) {
90+
installationInfo = setupDnfPack("gcc", version)
91+
setupDnfPack("gcc-c++", version)
92+
setupDnfPack("libstdc++-devel", undefined)
93+
} else if (isUbuntu()) {
8894
setupAptPack("gcc", version, ["ppa:ubuntu-toolchain-r/test"])
8995
installationInfo = setupAptPack("g++", version, [])
9096
}
9197
} else {
9298
info(`Install g++-multilib because gcc for ${arch} was requested`)
9399
if (isArch()) {
94100
setupPacmanPack("gcc-multilib", version)
95-
} else {
101+
} else if (isUbuntu()) {
96102
setupAptPack("gcc-multilib", version, ["ppa:ubuntu-toolchain-r/test"])
97103
}
98104
}

src/graphviz/graphviz.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { InstallationInfo } from "../utils/setup/setupBin"
55
import { setupBrewPack } from "../utils/setup/setupBrewPack"
66
import { setupChocoPack } from "../utils/setup/setupChocoPack"
77
import { isArch } from "../utils/env/isArch"
8+
import { hasDnf } from "../utils/env/hasDnf"
9+
import { setupDnfPack } from "../utils/setup/setupDnfPack"
10+
import { isUbuntu } from "../utils/env/isUbuntu"
811

912
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1013
export async function setupGraphviz(version: string, _setupDir: string, _arch: string) {
@@ -19,8 +22,12 @@ export async function setupGraphviz(version: string, _setupDir: string, _arch: s
1922
case "linux": {
2023
if (isArch()) {
2124
return setupPacmanPack("graphviz", version)
25+
} else if (hasDnf()) {
26+
return setupDnfPack("graphviz", version)
27+
} else if (isUbuntu()) {
28+
return setupAptPack("graphviz", version)
2229
}
23-
return setupAptPack("graphviz", version)
30+
throw new Error(`Unsupported linux distribution`)
2431
}
2532
default: {
2633
throw new Error(`Unsupported platform`)

src/kcov/kcov.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import { setupAptPack } from "../utils/setup/setupAptPack"
1111
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
1212
import { PackageInfo, setupBin } from "../utils/setup/setupBin"
1313
import { isArch } from "../utils/env/isArch"
14+
import { hasDnf } from "../utils/env/hasDnf"
15+
import { setupDnfPack } from "../utils/setup/setupDnfPack"
16+
import { isUbuntu } from "../utils/env/isUbuntu"
1417

1518
function getKcovPackageInfo(version: string): PackageInfo {
1619
const version_number = parseInt(version.replace(/^v/, ""), 10)
@@ -47,7 +50,10 @@ async function buildKcov(file: string, dest: string) {
4750
if (isArch()) {
4851
setupPacmanPack("libdwarf")
4952
setupPacmanPack("libcurl-openssl")
50-
} else {
53+
} else if (hasDnf()) {
54+
setupDnfPack("libdwarf-devel")
55+
setupDnfPack("libcurl-devel")
56+
} else if (isUbuntu()) {
5157
setupAptPack("libdw-dev")
5258
setupAptPack("libcurl4-openssl-dev")
5359
}
@@ -61,14 +67,14 @@ async function buildKcov(file: string, dest: string) {
6167
export async function setupKcov(version: string, setupDir: string, arch: string) {
6268
switch (process.platform) {
6369
case "linux": {
70+
const installationInfo = await setupBin("kcov", version, getKcovPackageInfo, setupDir, arch)
6471
if (isArch()) {
65-
// TODO install kcov ? setupPacmanPack("kcov")
66-
const installationInfo = await setupBin("kcov", version, getKcovPackageInfo, setupDir, arch)
6772
setupPacmanPack("binutils")
68-
return installationInfo
73+
} else if (hasDnf()) {
74+
setupDnfPack("binutils")
75+
} else if (isUbuntu()) {
76+
setupAptPack("libbinutils")
6977
}
70-
const installationInfo = await setupBin("kcov", version, getKcovPackageInfo, setupDir, arch)
71-
setupAptPack("libbinutils")
7278
return installationInfo
7379
}
7480
default: {

src/llvm/__tests__/llvm.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { setupLLVM, VERSIONS, getUrl, setupClangTools, getLinuxUrl } from "../ll
22
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
33
import { isValidUrl } from "../../utils/http/validate_url"
44
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
5-
import { isGitHubCI } from "../../utils/env/isci"
5+
import { isGitHubCI } from "../../utils/env/isCI"
66
import execa from "execa"
77
import path from "path"
88
import { addBinExtension } from "../../utils/extension/extension"

src/llvm/llvm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { setOutput } from "@actions/core"
1717
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
1818
import { info, warning } from "../utils/io/io"
1919
import { existsSync } from "fs"
20-
import { isGitHubCI } from "../utils/env/isci"
20+
import { isGitHubCI } from "../utils/env/isCI"
2121
import { setupGcc } from "../gcc/gcc"
2222
import { getVersion } from "../default_versions"
2323
import { isArch } from "../utils/env/isArch"
@@ -290,7 +290,7 @@ async function _setupLLVM(version: string, setupDir: string, arch: string) {
290290
if (isArch()) {
291291
// setupPacmanPack("ncurses")
292292
// TODO: install libtinfo ?
293-
} else {
293+
} else if (isUbuntu()) {
294294
setupAptPack("libtinfo-dev")
295295
}
296296
}

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { setupOpencppcoverage } from "./opencppcoverage/opencppcoverage"
1717
import { setupPython } from "./python/python"
1818
import mri from "mri"
1919
import { untildify_user as untildify } from "./utils/path/untildify"
20-
import { isGitHubCI } from "./utils/env/isci"
20+
import { isGitHubCI } from "./utils/env/isCI"
2121
import * as timeDelta from "time-delta"
2222
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
2323
// @ts-ignore

src/make/make.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
44
import { setupBrewPack } from "../utils/setup/setupBrewPack"
55
import { setupChocoPack } from "../utils/setup/setupChocoPack"
66
import { isArch } from "../utils/env/isArch"
7+
import { hasDnf } from "../utils/env/hasDnf"
8+
import { setupDnfPack } from "../utils/setup/setupDnfPack"
9+
import { isUbuntu } from "../utils/env/isUbuntu"
710

811
// eslint-disable-next-line @typescript-eslint/no-unused-vars
912
export async function setupMake(version: string, _setupDir: string, _arch: string) {
@@ -19,8 +22,12 @@ export async function setupMake(version: string, _setupDir: string, _arch: strin
1922
case "linux": {
2023
if (isArch()) {
2124
return setupPacmanPack("make", version)
25+
} else if (hasDnf()) {
26+
return setupDnfPack("make", version)
27+
} else if (isUbuntu()) {
28+
return setupAptPack("make", version)
2229
}
23-
return setupAptPack("make", version)
30+
throw new Error(`Unsupported linux distribution`)
2431
}
2532
default: {
2633
throw new Error(`Unsupported platform`)

src/msvc/msvc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { setupVCVarsall } from "../vcvarsall/vcvarsall"
33
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
44
// @ts-ignore
55
import { vsversion_to_versionnumber, findVcvarsall } from "msvc-dev-cmd/lib.js"
6-
import { isGitHubCI } from "../utils/env/isci"
6+
import { isGitHubCI } from "../utils/env/isCI"
77
import path from "path"
88
import { existsSync } from "fs"
99
import { error, info, warning } from "../utils/io/io"

src/ninja/__tests__/ninja.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { setupNinja } from "../ninja"
22
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
3-
import { isGitHubCI } from "../../utils/env/isci"
3+
import { isGitHubCI } from "../../utils/env/isCI"
44
import { getVersion } from "../../default_versions"
55

66
jest.setTimeout(300000)

src/python/__tests__/python.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { setupPython } from "../python"
22
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
33
import { getVersion } from "../../default_versions"
44
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
5-
import { isGitHubCI } from "../../utils/env/isci"
5+
import { isGitHubCI } from "../../utils/env/isCI"
66
import { info } from "../../utils/io/io"
77

88
jest.setTimeout(300000)

src/python/actions_python.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { existsSync } from "fs"
44
import { info, warning } from "../utils/io/io"
55
import { debug } from "@actions/core"
66
import path from "path"
7-
import { isGitHubCI } from "../utils/env/isci"
7+
import { isGitHubCI } from "../utils/env/isCI"
88
import { isCacheFeatureAvailable, IS_LINUX, IS_WINDOWS } from "setup-python/src/utils"
99
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
1010

0 commit comments

Comments
 (0)