This is an automated email from the ASF dual-hosted git repository.
hdalsania pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-vscode.git
The following commit(s) were added to refs/heads/main by this push:
new e10d2663 add retry logic
e10d2663 is described below
commit e10d26633c939a4e65db7ba2b3493f34fd1f5a5f
Author: CoverRyan <[email protected]>
AuthorDate: Tue Aug 25 10:49:07 2026 -0400
add retry logic
fix issues
add retry to CI
switch to Apache approved action
switch to Apache approved action
add timeout
---
.github/workflows/CI.yml | 12 ++++++++++--
.github/workflows/nightly.yml | 12 ++++++++++--
src/tests/runTest.ts | 30 +++++++++++++++++++++++++++---
src/utils.ts | 1 +
vite.config.mjs | 29 +++++++++++++++++++++++------
5 files changed, 71 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 8895ec57..2a899424 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -168,11 +168,19 @@ jobs:
run: yarn install --frozen-lockfile
- name: Runs tests - Linux
- run: xvfb-run -a yarn test
+ uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 #
v4.0.0
+ with:
+ max_attempts: 3
+ timeout_minutes: 120
+ command: xvfb-run -a yarn test
if: runner.os == 'Linux'
- name: Runs tests - Windows/Mac
- run: yarn test
+ uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 #
v4.0.0
+ with:
+ max_attempts: 3
+ timeout_minutes: 120
+ command: yarn test
if: runner.os != 'Linux'
- name: Check for Errors in macOS
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index ef3394b8..5a24cd80 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -96,11 +96,19 @@ jobs:
run: yarn install --frozen-lockfile
- name: Runs tests - Linux
- run: xvfb-run -a yarn test
+ uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 #
v4.0.0
+ with:
+ max_attempts: 3
+ timeout_minutes: 120
+ command: xvfb-run -a yarn test
if: runner.os == 'Linux'
- name: Runs tests - Windows/Mac
- run: yarn test
+ uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 #
v4.0.0
+ with:
+ max_attempts: 3
+ timeout_minutes: 120
+ command: yarn test
if: runner.os != 'Linux'
- name: Check for Errors in macOS
diff --git a/src/tests/runTest.ts b/src/tests/runTest.ts
index 141c341e..7d46ea97 100644
--- a/src/tests/runTest.ts
+++ b/src/tests/runTest.ts
@@ -55,6 +55,29 @@ function resolveMacOSExecutable(executablePath: string):
string {
return executablePath
}
+async function downloadAndUnzipVSCodeRetry(
+ testVsCodeVersion,
+ retries = 5,
+ delay = 4000
+): Promise<string | undefined> {
+ let backoff = delay
+ for (let i = 1; i <= retries; i++) {
+ try {
+ const vscodeExecutablePath =
+ await downloadAndUnzipVSCode(testVsCodeVersion)
+ return vscodeExecutablePath
+ } catch (error) {
+ if (i === retries) {
+ throw error
+ } else {
+ console.warn(`Attempt ${i} failed. Retrying in ${backoff}ms...`)
+ await new Promise((r) => setTimeout(r, backoff))
+ backoff = backoff * 2
+ }
+ }
+ }
+}
+
async function main() {
const disable_cert_verification =
process.argv.includes('-k') ||
@@ -80,13 +103,14 @@ async function main() {
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, './suite/index')
+ // Download VS Code and retry upon error
const downloadedExecutablePath =
- await downloadAndUnzipVSCode(testVsCodeVersion)
+ await downloadAndUnzipVSCodeRetry(testVsCodeVersion)
const vscodeExecutablePath = resolveMacOSExecutable(
- downloadedExecutablePath
+ downloadedExecutablePath!
)
- // Download VS Code, unzip it and run the integration tests
+ // Run the integration tests
const runTestsResult = await runTests({
vscodeExecutablePath,
extensionDevelopmentPath,
diff --git a/src/utils.ts b/src/utils.ts
index b3f0e630..6ed8804c 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -532,6 +532,7 @@ export async function fetchRetry(
`Failed request to ${url}: ${res.status} ${res.statusText}`
)
} else {
+ console.warn(`Attempt ${i} failed. Retrying in ${backoff}ms...`)
await new Promise((r) => setTimeout(r, backoff))
backoff = backoff * 2
}
diff --git a/vite.config.mjs b/vite.config.mjs
index 8a634890..12fcae18 100644
--- a/vite.config.mjs
+++ b/vite.config.mjs
@@ -94,11 +94,23 @@ function copyDebuggerOutAfterBuild() {
async function downloadAndExtract(title, url, targetDir) {
console.log(pc.cyan(`\n▶ Starting download for ${title}...\n`))
- const res = await fetch(url)
- if (!res.ok || !res.body) {
- throw new Error(
- `Failed to download ${url}: ${res.status} ${res.statusText}`
- )
+ let res = undefined
+ let backoff = 4000
+ for (let i = 1; i <= 5; i++) {
+ res = await fetch(url)
+ if (!res.ok || !res.body) {
+ if (i === 5) {
+ throw new Error(
+ `Failed to download ${url}: ${res.status} ${res.statusText}`
+ )
+ } else {
+ console.warn(`Attempt ${i} failed. Retrying in ${backoff}ms...`)
+ await new Promise((r) => setTimeout(r, backoff))
+ backoff = backoff * 2
+ }
+ } else {
+ break
+ }
}
const totalBytes = Number(res.headers.get('content-length')) || 0
@@ -245,7 +257,12 @@ export default defineConfig(({ mode }) => {
input: {
extension: path.resolve(__dirname, 'src/adapter/extension.ts'),
},
- external: ['vscode', '@omega-edit/client', ...builtinModules,
/^node:.*/],
+ external: [
+ 'vscode',
+ '@omega-edit/client',
+ ...builtinModules,
+ /^node:.*/,
+ ],
output: {
entryFileNames: 'extension.js',
format: 'cjs',