Skip to content

Commit d8f740e

Browse files
authored
Merge pull request #155 from aminya/retry
2 parents 17b183c + 3eac980 commit d8f740e

File tree

8 files changed

+30
-8
lines changed

8 files changed

+30
-8
lines changed

dist/node12/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/node12/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/node16/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/node16/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.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"path-exists": "^4.0.0",
7070
"patha": "^0.4.1",
7171
"quote-unquote": "^1.0.0",
72+
"retry-as-promised": "^7.0.3",
7273
"semver": "7.3.8",
7374
"setup-python": "github:actions/setup-python#v4.3.1",
7475
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",

pnpm-lock.yaml

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

src/doxygen/doxygen.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { setupBrewPack } from "../utils/setup/setupBrewPack"
66
import { setupChocoPack } from "../utils/setup/setupChocoPack"
77
import { addExeExt, join } from "patha"
88
import { extractTar, extractZip } from "../utils/setup/extract"
9-
import { notice } from "ci-log"
9+
import { info, notice } from "ci-log"
1010
import { setupGraphviz } from "../graphviz/graphviz"
1111
import { getVersion } from "../versions/versions"
1212

@@ -15,6 +15,7 @@ import { hasDnf } from "../utils/env/hasDnf"
1515
import { setupDnfPack } from "../utils/setup/setupDnfPack"
1616
import { isUbuntu } from "../utils/env/isUbuntu"
1717
import pathExists from "path-exists"
18+
import retry from "retry-as-promised"
1819

1920
/** Get the platform data for cmake */
2021
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -48,7 +49,13 @@ function getDoxygenPackageInfo(version: string, platform: NodeJS.Platform, _arch
4849
export async function setupDoxygen(version: string, setupDir: string, arch: string) {
4950
switch (process.platform) {
5051
case "win32": {
51-
await setupChocoPack("doxygen.install", version)
52+
// try to download the package 4 times with 2 seconds delay
53+
await retry(
54+
() => {
55+
return setupChocoPack("doxygen.install", version)
56+
},
57+
{ max: 4, backoffBase: 2000, report: (err) => info(err) }
58+
)
5259
const binDir = await activateWinDoxygen()
5360
const installationInfo = { binDir }
5461
await setupGraphviz(getVersion("graphviz", undefined), "", arch)
@@ -100,6 +107,7 @@ async function activateWinDoxygen() {
100107
"C:/Program Files/doxygen/bin",
101108
"C:/Program Files (x86)/doxygen",
102109
]) {
110+
// eslint-disable-next-line no-await-in-loop
103111
if (await pathExists(join(binDir, "doxygen.exe"))) {
104112
// eslint-disable-next-line no-await-in-loop
105113
await addPath(binDir)

src/utils/setup/setupBin.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { hasDnf } from "../env/hasDnf"
1212
import { setupDnfPack } from "./setupDnfPack"
1313
import { isUbuntu } from "../env/isUbuntu"
1414
import pathExists from "path-exists"
15+
import retry from "retry-as-promised"
1516

1617
/** A type that describes a package */
1718
export type PackageInfo = {
@@ -91,7 +92,13 @@ export async function setupBin(
9192
if ((await Promise.all([pathExists(binDir), pathExists(binFile)])).includes(false)) {
9293
try {
9394
info(`Download ${name} ${version}`)
94-
const downloaded = await downloadTool(url)
95+
// try to download the package 4 times with 2 seconds delay
96+
const downloaded = await retry(
97+
() => {
98+
return downloadTool(url)
99+
},
100+
{ max: 4, backoffBase: 2000, report: (err) => info(err) }
101+
)
95102

96103
if (!didInit) {
97104
info(`Installing extraction dependencies`)

0 commit comments

Comments
 (0)