-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
major: initial implementation of retry step
- Loading branch information
Nick Fields
committed
Feb 13, 2020
1 parent
a6a097a
commit d4e983a
Showing
14 changed files
with
8,341 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
rules: { | ||
'type-enum': [ | ||
2, | ||
'always', | ||
['feat', 'fix', 'docs', 'style', 'refactor', 'test', 'revert', 'patch', 'minor', 'major'], | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: CI/CD | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
jobs: | ||
# runs on branch pushes only | ||
ci: | ||
name: Run Tests | ||
if: startsWith(github.ref, 'refs/heads') | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Test | ||
uses: ./ | ||
continue-on-error: true | ||
with: | ||
timeout_minutes: 1 | ||
max_attempts: 3 | ||
command: npm install this-isnt-a-real-package-name-zzz | ||
- name: happy-path | ||
uses: ./ | ||
with: | ||
timeout_minutes: 1 | ||
max_attempts: 2 | ||
command: npm -v | ||
- name: sad-path (error) | ||
uses: ./ | ||
continue-on-error: true | ||
with: | ||
timeout_minutes: 1 | ||
max_attempts: 2 | ||
command: node -e "process.exit(1)" | ||
- name: sad-path (timeout) | ||
uses: ./ | ||
continue-on-error: true | ||
with: | ||
timeout_minutes: 1 | ||
max_attempts: 2 | ||
command: node -e "(async()=>await new Promise(r => setTimeout(r, 120000)))()" | ||
|
||
# runs on push to master only | ||
cd: | ||
name: Publish Action | ||
needs: ci | ||
if: github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Release | ||
id: release | ||
uses: cycjimmy/semantic-release-action@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Tag | ||
run: git tag -f zzz && git push origin zzz | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,7 +80,6 @@ typings/ | |
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
tabWidth: 2, | ||
printWidth: 100, | ||
semi: true, | ||
singleQuote: true, | ||
trailingComma: 'es5', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module.exports = { | ||
plugins: [ | ||
[ | ||
'@semantic-release/commit-analyzer', | ||
{ | ||
releaseRules: [ | ||
{ type: 'docs', scope: 'README', release: 'patch' }, | ||
{ type: 'minor', release: 'minor' }, | ||
{ type: 'major', release: 'major' }, | ||
{ type: 'patch', release: 'patch' }, | ||
{ scope: 'no-release', release: false }, | ||
], | ||
}, | ||
], | ||
'@semantic-release/release-notes-generator', | ||
'@semantic-release/github', | ||
], | ||
branches: [ | ||
{ name: 'master' }, | ||
{ name: 'develop', channel: 'develop', prerelease: 'develop' }, // `prerelease` is set to `beta` as it is the value of `name` | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"prettier.requireConfig": true, | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"editor.tabSize": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,35 @@ | ||
# retry-step | ||
Retries a GitHub Action step on failure or timeout | ||
# retry | ||
|
||
Retries an Action step on failure or timeout. This is currently intended to replace the `run` step for moody commands. | ||
|
||
## Inputs | ||
|
||
### `timeout_minutes` | ||
|
||
**Required** Minutes to wait before attempt times out | ||
|
||
### `max_attempts` | ||
|
||
**Required** Number of attempts to make before failing the step | ||
|
||
### `command` | ||
|
||
**Required** The command to run | ||
|
||
### `retry_wait_seconds` | ||
|
||
**Optional** Number of seconds to wait before attempting the next retry. Defaults to `10` | ||
|
||
### `polling_interval_seconds` | ||
|
||
**Optional** Number of seconds to wait while polling for command result. Defaults to `1` | ||
|
||
## Example usage | ||
|
||
```yaml | ||
uses: nick-invision/retry@v1 | ||
with: | ||
timeout_minutes: 10 | ||
max_attempts: 3 | ||
command: npm install | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Retry Step | ||
description: 'Retry a step on failure or timeout' | ||
inputs: | ||
timeout_minutes: | ||
description: Minutes to wait before attempt times out | ||
required: true | ||
max_attempts: | ||
description: Number of attempts to make before failing the step | ||
required: true | ||
default: 3 | ||
command: | ||
description: The command to run | ||
required: true | ||
retry_wait_seconds: | ||
description: Number of seconds to wait before attempting the next retry | ||
required: false | ||
default: 10 | ||
polling_interval_seconds: | ||
description: Number of seconds to wait for each check that command has completed running | ||
required: false | ||
default: 1 | ||
runs: | ||
using: 'node12' | ||
main: 'dist/index.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const { execSync } = require('child_process'); | ||
const COMMAND = process.argv.splice(2)[0]; | ||
|
||
function run() { | ||
execSync(COMMAND, { stdio: 'inherit' }); | ||
} | ||
|
||
run(); |
Oops, something went wrong.