mirror of
https://github.com/nick-fields/retry.git
synced 2026-02-10 07:05:29 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe62d592e5 | ||
|
|
ba8a013d7c | ||
|
|
12ca35256f | ||
|
|
82da33c127 | ||
|
|
a8fec9e69d | ||
|
|
197f6abf5a | ||
|
|
fd45cc91d8 | ||
|
|
7082f1b92e | ||
|
|
d4bdaeed19 | ||
|
|
6513c5eede | ||
|
|
c95842ec20 | ||
|
|
9417ab4993 | ||
|
|
07cd61dba6 | ||
|
|
d6b241c90e | ||
|
|
8d92921684 |
15
.github/actions/setup/action.yml
vendored
Normal file
15
.github/actions/setup/action.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
name: Setup Node, PNPM, cache, and install dependencies
|
||||||
|
description: Sets up job to use the nodejs version in .nvmrc, pnpm, cache, and install dependencies
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- uses: pnpm/action-setup@v3
|
||||||
|
with:
|
||||||
|
version: 9.5.0
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: ./.nvmrc
|
||||||
|
cache: 'pnpm'
|
||||||
|
- run: pnpm install
|
||||||
|
shell: bash
|
||||||
194
.github/workflows/ci_cd.yml
vendored
194
.github/workflows/ci_cd.yml
vendored
@@ -1,29 +1,91 @@
|
|||||||
name: CI/CD
|
name: CI/CD
|
||||||
|
|
||||||
|
# PRs come in via the GitHub UI that skip pre-commit hooks which bundle the code. So we have to check that the code is bundled properly here and potentially re-commit if changes are found
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref_name }}
|
||||||
|
cancel-in-progress: ${{ github.ref_name == 'master' && false || true}}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# only on PRs into and merge to default branch
|
# only on PRs into and merge to default branch
|
||||||
pull_request:
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- labeled
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
|
env:
|
||||||
|
BRANCH: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
|
||||||
|
PR_TRIGGERED: ${{ github.event_name == 'pull_request' && github.event.action != 'labeled' }}
|
||||||
jobs:
|
jobs:
|
||||||
ci_unit:
|
setup:
|
||||||
name: Run Unit Tests
|
# Skip running if labeled event but not rerun, otehrwise its a supported trigger event
|
||||||
|
if: ${{ github.event.label.name == 'rerun' || github.event.action != 'labeled' }}
|
||||||
|
name: Setup
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
ref: ${{ env.BRANCH }}
|
||||||
- name: Install dependencies
|
- name: Setup and cache for later jobs
|
||||||
run: npm ci
|
uses: ./.github/actions/setup
|
||||||
|
# GHA requires bundled code to be commited so we bundle automatically via pre-commit hook. However, most contributions come in through the GH UI which skips hooks.
|
||||||
|
# So bundle again here just in case, and if changes are found then commit them to ensure we're testing the correct code.
|
||||||
|
# But GHA does not trigger on changes made via the default GH token, so we need to label the PR to re-run CI.
|
||||||
|
# Alternatives could be using a PAT (rotation/security burden), GH App (overkill/maintenance), or something like pre-commit.ci (not convincing). Lets try this first though
|
||||||
|
- name: Check for bundle changes after install
|
||||||
|
# Only run if not a push event since we only trigger this on the default branch and we don't want to make any non-PR changes there
|
||||||
|
if: ${{ github.event_name != 'push' }}
|
||||||
|
id: changes
|
||||||
|
run: |
|
||||||
|
if [[ -n "$(git status --porcelain)" ]]; then
|
||||||
|
echo "CHANGES_FOUND=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "No changes detected."
|
||||||
|
echo "CHANGES_FOUND=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
- name: Commit and push changes if found
|
||||||
|
if: ${{ steps.changes.outputs.CHANGES_FOUND == 'true' }}
|
||||||
|
run: |
|
||||||
|
git config --global user.name "github-actions[bot]"
|
||||||
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add .
|
||||||
|
git commit -m "patch: regenerated bundle"
|
||||||
|
git push
|
||||||
|
- name: Label PR to re-trigger CI
|
||||||
|
if: ${{ steps.changes.outputs.CHANGES_FOUND == 'true' }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
gh pr edit ${{ github.event.pull_request.number }} --add-label "rerun"
|
||||||
|
- name: Remove label after clean re-run
|
||||||
|
# Only remove label if the PR was labeled with rerun and no changes were found. Changes found indicate a problem since they should have been previously committed
|
||||||
|
if: ${{ steps.changes.outputs.CHANGES_FOUND == 'false' && github.event.label.name == 'rerun' }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
gh pr edit ${{ github.event.pull_request.number }} --remove-label "rerun"
|
||||||
|
|
||||||
|
ci_unit:
|
||||||
|
name: Run Unit Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup
|
||||||
|
uses: ./.github/actions/setup
|
||||||
- name: Run Unit Tests
|
- name: Run Unit Tests
|
||||||
run: npm test
|
run: npm test
|
||||||
- uses: codecov/codecov-action@v3
|
- uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
directory: ./coverage/
|
directory: ./coverage/
|
||||||
verbose: true
|
verbose: true
|
||||||
@@ -31,15 +93,12 @@ jobs:
|
|||||||
ci_integration:
|
ci_integration:
|
||||||
name: Run Integration Tests
|
name: Run Integration Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: happy-path
|
- name: happy-path
|
||||||
id: happy_path
|
id: happy_path
|
||||||
@@ -141,15 +200,12 @@ jobs:
|
|||||||
ci_integration_envvar:
|
ci_integration_envvar:
|
||||||
name: Run Integration Env Var Tests
|
name: Run Integration Env Var Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
- name: env-vars-passed-through
|
- name: env-vars-passed-through
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
@@ -162,15 +218,12 @@ jobs:
|
|||||||
ci_integration_large_output:
|
ci_integration_large_output:
|
||||||
name: Run Integration Large Output Tests
|
name: Run Integration Large Output Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
- name: Test 100MiB of output can be processed
|
- name: Test 100MiB of output can be processed
|
||||||
id: large-output
|
id: large-output
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -193,15 +246,12 @@ jobs:
|
|||||||
ci_integration_retry_on_exit_code:
|
ci_integration_retry_on_exit_code:
|
||||||
name: Run Integration retry_on_exit_code Tests
|
name: Run Integration retry_on_exit_code Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
- name: retry_on_exit_code (with expected error code)
|
- name: retry_on_exit_code (with expected error code)
|
||||||
id: retry_on_exit_code_expected
|
id: retry_on_exit_code_expected
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -241,15 +291,12 @@ jobs:
|
|||||||
ci_integration_continue_on_error:
|
ci_integration_continue_on_error:
|
||||||
name: Run Integration continue_on_error Tests
|
name: Run Integration continue_on_error Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
- name: happy-path (continue_on_error)
|
- name: happy-path (continue_on_error)
|
||||||
id: happy_path_continue_on_error
|
id: happy_path_continue_on_error
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -288,15 +335,12 @@ jobs:
|
|||||||
ci_integration_retry_wait_seconds:
|
ci_integration_retry_wait_seconds:
|
||||||
name: Run Integration Tests (retry_wait_seconds)
|
name: Run Integration Tests (retry_wait_seconds)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: sad-path (retry_wait_seconds)
|
- name: sad-path (retry_wait_seconds)
|
||||||
id: sad_path_wait_sec
|
id: sad_path_wait_sec
|
||||||
@@ -324,15 +368,12 @@ jobs:
|
|||||||
ci_integration_on_retry_cmd:
|
ci_integration_on_retry_cmd:
|
||||||
name: Run Integration Tests (on_retry_command)
|
name: Run Integration Tests (on_retry_command)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: new-command-on-retry
|
- name: new-command-on-retry
|
||||||
id: new-command-on-retry
|
id: new-command-on-retry
|
||||||
@@ -367,15 +408,12 @@ jobs:
|
|||||||
ci_integration_timeout_seconds:
|
ci_integration_timeout_seconds:
|
||||||
name: Run Integration Timeout Tests (seconds)
|
name: Run Integration Timeout Tests (seconds)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: sad-path (timeout)
|
- name: sad-path (timeout)
|
||||||
id: sad_path_timeout
|
id: sad_path_timeout
|
||||||
@@ -397,15 +435,12 @@ jobs:
|
|||||||
ci_integration_timeout_retry_on_timeout:
|
ci_integration_timeout_retry_on_timeout:
|
||||||
name: Run Integration Timeout Tests (retry_on timeout)
|
name: Run Integration Timeout Tests (retry_on timeout)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: retry_on (timeout)
|
- name: retry_on (timeout)
|
||||||
id: retry_on_timeout
|
id: retry_on_timeout
|
||||||
@@ -428,15 +463,12 @@ jobs:
|
|||||||
ci_integration_timeout_retry_on_error:
|
ci_integration_timeout_retry_on_error:
|
||||||
name: Run Integration Timeout Tests (retry_on error)
|
name: Run Integration Timeout Tests (retry_on error)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: retry_on (error) fails early if timeout encountered
|
- name: retry_on (error) fails early if timeout encountered
|
||||||
id: retry_on_error_fail
|
id: retry_on_error_fail
|
||||||
@@ -463,15 +495,12 @@ jobs:
|
|||||||
ci_integration_timeout_minutes:
|
ci_integration_timeout_minutes:
|
||||||
name: Run Integration Timeout Tests (minutes)
|
name: Run Integration Timeout Tests (minutes)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: sad-path (timeout minutes)
|
- name: sad-path (timeout minutes)
|
||||||
id: sad_path_timeout_minutes
|
id: sad_path_timeout_minutes
|
||||||
@@ -493,15 +522,12 @@ jobs:
|
|||||||
ci_windows:
|
ci_windows:
|
||||||
name: Run Windows Tests
|
name: Run Windows Tests
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
- name: Powershell test
|
- name: Powershell test
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -572,12 +598,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js
|
- name: Setup
|
||||||
uses: actions/setup-node@v4
|
uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
- name: Release
|
- name: Release
|
||||||
id: semantic
|
id: semantic
|
||||||
uses: cycjimmy/semantic-release-action@v4
|
uses: cycjimmy/semantic-release-action@v4
|
||||||
|
|||||||
3616
dist/index.js
vendored
3616
dist/index.js
vendored
File diff suppressed because one or more lines are too long
12602
package-lock.json
generated
12602
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@@ -3,12 +3,14 @@
|
|||||||
"version": "0.0.0-managed-by-semantic-release",
|
"version": "0.0.0-managed-by-semantic-release",
|
||||||
"description": "Retries a GitHub Action step on failure or timeout.",
|
"description": "Retries a GitHub Action step on failure or timeout.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"bundle": "ncc build src/index.ts",
|
||||||
"lint:base": "eslint --config ./.config/.eslintrc.js ",
|
"lint:base": "eslint --config ./.config/.eslintrc.js ",
|
||||||
"lint": "npm run lint:base -- .",
|
"lint": "pnpm lint:base -- .",
|
||||||
"local": "npm run prepare && node -r dotenv/config ./dist/index.js",
|
"local": "pnpm prepare && node -r dotenv/config ./dist/index.js",
|
||||||
"prepare": "ncc build src/index.ts && husky install",
|
"preinstall": "npx only-allow pnpm",
|
||||||
|
"prepare": "pnpm bundle && husky install",
|
||||||
"style:base": "prettier --config ./.config/.prettierrc.yml --ignore-path ./.config/.prettierignore --write ",
|
"style:base": "prettier --config ./.config/.prettierrc.yml --ignore-path ./.config/.prettierignore --write ",
|
||||||
"style": "npm run style:base -- .",
|
"style": "pnpm style:base -- .",
|
||||||
"test": "jest -c ./.config/jest.config.js"
|
"test": "jest -c ./.config/jest.config.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
8334
pnpm-lock.yaml
generated
Normal file
8334
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,8 @@ const OUTPUT_EXIT_ERROR_KEY = 'exit_error';
|
|||||||
let exit: number;
|
let exit: number;
|
||||||
let done: boolean;
|
let done: boolean;
|
||||||
|
|
||||||
|
info('test');
|
||||||
|
|
||||||
function getExecutable(inputs: Inputs): string {
|
function getExecutable(inputs: Inputs): string {
|
||||||
if (!inputs.shell) {
|
if (!inputs.shell) {
|
||||||
return OS === 'win32' ? 'powershell' : 'bash';
|
return OS === 'win32' ? 'powershell' : 'bash';
|
||||||
|
|||||||
Reference in New Issue
Block a user