mirror of
https://github.com/nick-fields/retry.git
synced 2026-02-11 07:35:26 +00:00
Compare commits
1 Commits
nrf/pnpm
...
snyk-upgra
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8af748072c |
15
.github/actions/setup/action.yml
vendored
15
.github/actions/setup/action.yml
vendored
@@ -1,15 +0,0 @@
|
|||||||
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
|
|
||||||
190
.github/workflows/ci_cd.yml
vendored
190
.github/workflows/ci_cd.yml
vendored
@@ -1,88 +1,26 @@
|
|||||||
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:
|
||||||
setup:
|
|
||||||
# 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
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ env.BRANCH }}
|
|
||||||
- name: Setup and cache for later jobs
|
|
||||||
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:
|
ci_unit:
|
||||||
name: Run Unit Tests
|
name: Run Unit 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
- name: Run Unit Tests
|
- name: Run Unit Tests
|
||||||
run: npm test
|
run: npm test
|
||||||
- uses: codecov/codecov-action@v5
|
- uses: codecov/codecov-action@v5
|
||||||
@@ -93,12 +31,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
- name: happy-path
|
- name: happy-path
|
||||||
id: happy_path
|
id: happy_path
|
||||||
@@ -200,12 +141,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
- name: env-vars-passed-through
|
- name: env-vars-passed-through
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
@@ -218,12 +162,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
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
|
||||||
@@ -246,12 +193,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
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: ./
|
||||||
@@ -291,12 +241,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
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: ./
|
||||||
@@ -335,12 +288,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
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
|
||||||
@@ -368,12 +324,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
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
|
||||||
@@ -408,12 +367,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
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
|
||||||
@@ -435,12 +397,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
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
|
||||||
@@ -463,12 +428,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
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
|
||||||
@@ -495,12 +463,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
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
|
||||||
@@ -522,12 +493,15 @@ 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
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
- name: Powershell test
|
- name: Powershell test
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -598,8 +572,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup
|
uses: actions/setup-node@v4
|
||||||
|
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
12610
package-lock.json
generated
Normal file
12610
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -3,14 +3,12 @@
|
|||||||
"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": "pnpm lint:base -- .",
|
"lint": "npm run lint:base -- .",
|
||||||
"local": "pnpm prepare && node -r dotenv/config ./dist/index.js",
|
"local": "npm run prepare && node -r dotenv/config ./dist/index.js",
|
||||||
"preinstall": "npx only-allow pnpm",
|
"prepare": "ncc build src/index.ts && husky install",
|
||||||
"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": "pnpm style:base -- .",
|
"style": "npm run style:base -- .",
|
||||||
"test": "jest -c ./.config/jest.config.js"
|
"test": "jest -c ./.config/jest.config.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -25,7 +23,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/nick-fields/retry#readme",
|
"homepage": "https://github.com/nick-fields/retry#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.11.1",
|
||||||
"milliseconds": "^1.0.3",
|
"milliseconds": "^1.0.3",
|
||||||
"tree-kill": "^1.2.2"
|
"tree-kill": "^1.2.2"
|
||||||
},
|
},
|
||||||
|
|||||||
8334
pnpm-lock.yaml
generated
8334
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -14,8 +14,6 @@ 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