Skip to content

Commit 533b4e1

Browse files
feat: Onboard benchmark-action/github-action-benchmark action
Signed-off-by: Anurag Rajawat <anurag@stepsecurity.io>
1 parent 9e0ffa4 commit 533b4e1

148 files changed

Lines changed: 62130 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.eslintrc.json‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"root": true,
3+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier", "plugin:prettier/recommended"],
4+
"env": {
5+
"es6": true,
6+
"node": true
7+
},
8+
"rules": {
9+
"prefer-spread": "off",
10+
"eqeqeq": "error"
11+
},
12+
"ignorePatterns": ["examples/**", "dist/**"],
13+
"overrides": [
14+
{
15+
"files": ["**/*.ts"],
16+
"parser": "@typescript-eslint/parser",
17+
"parserOptions": {
18+
"project": ["./tsconfig.build.json", "./tsconfig.spec.json"]
19+
},
20+
"plugins": ["@typescript-eslint", "prettier"],
21+
"rules": {
22+
"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^_" }],
23+
"@typescript-eslint/naming-convention": "error",
24+
"@typescript-eslint/no-floating-promises": "error",
25+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
26+
"@typescript-eslint/no-non-null-assertion": "error",
27+
"@typescript-eslint/no-empty-interface": "error",
28+
"@typescript-eslint/restrict-plus-operands": "error",
29+
"@typescript-eslint/no-extra-non-null-assertion": "error",
30+
"@typescript-eslint/prefer-nullish-coalescing": "error",
31+
"@typescript-eslint/prefer-optional-chain": "error",
32+
"@typescript-eslint/ban-ts-comment": "error",
33+
"@typescript-eslint/prefer-includes": "error",
34+
"@typescript-eslint/prefer-for-of": "error",
35+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
36+
"@typescript-eslint/prefer-readonly": "error",
37+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
38+
"@typescript-eslint/await-thenable": "error",
39+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
40+
"@typescript-eslint/switch-exhaustiveness-check": "error"
41+
}
42+
},
43+
{
44+
"files": ["test/*.ts"],
45+
"plugins": ["jest"],
46+
"env": {
47+
"jest/globals": true
48+
},
49+
"rules": {
50+
"@typescript-eslint/no-explicit-any": "off",
51+
"@typescript-eslint/no-var-requires": "off",
52+
"@typescript-eslint/ban-ts-comment": "warn",
53+
"@typescript-eslint/naming-convention": "off"
54+
}
55+
},
56+
{
57+
"files": ["**/*.js"],
58+
"env": {
59+
"browser": true
60+
},
61+
"rules": {}
62+
}
63+
]
64+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release GitHub Actions
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Tag for the release'
8+
required: true
9+
node_version:
10+
description: 'Node.js version to use'
11+
required: false
12+
default: '24'
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
release:
19+
permissions:
20+
actions: read
21+
id-token: write
22+
contents: write
23+
24+
uses: step-security/reusable-workflows/.github/workflows/actions_release.yaml@v1
25+
with:
26+
tag: '${{ github.event.inputs.tag }}'
27+
node_version: ${{ inputs.node_version || '24' }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: NPM Audit Fix Run
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
force:
7+
description: 'Use --force flag for npm audit fix?'
8+
required: true
9+
type: boolean
10+
base_branch:
11+
description: 'Specify a base branch'
12+
required: false
13+
default: 'main'
14+
node_version:
15+
description: 'Node.js version to use'
16+
required: false
17+
default: '24'
18+
schedule:
19+
- cron: '0 0 * * 1'
20+
21+
jobs:
22+
audit-fix:
23+
uses: step-security/reusable-workflows/.github/workflows/audit_fix.yml@v1
24+
with:
25+
force: ${{ inputs.force || false }}
26+
base_branch: ${{ inputs.base_branch || 'main' }}
27+
node_version: ${{ inputs.node_version || '24' }}
28+
29+
permissions:
30+
contents: write
31+
pull-requests: write
32+
packages: read
33+
issues: write
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Auto Cherry-Pick from Upstream
2+
3+
on:
4+
workflow_run:
5+
workflows: ['Release GitHub Actions']
6+
types:
7+
- completed
8+
9+
workflow_dispatch:
10+
inputs:
11+
base_branch:
12+
description: 'Base branch to create the PR against'
13+
required: true
14+
default: 'main'
15+
mode:
16+
description: 'Run mode: cherry-pick or verify'
17+
required: false
18+
default: 'cherry-pick'
19+
node_version:
20+
description: 'Node.js version to use'
21+
required: false
22+
default: '24'
23+
24+
pull_request:
25+
types: [opened, synchronize, labeled]
26+
27+
permissions:
28+
contents: write
29+
pull-requests: write
30+
packages: read
31+
issues: write
32+
33+
jobs:
34+
cherry-pick:
35+
if: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'workflow_dispatch' || contains(fromJson(toJson(github.event.pull_request.labels)).*.name, 'review-required')
36+
uses: step-security/reusable-workflows/.github/workflows/auto_cherry_pick.yaml@v1
37+
with:
38+
original-owner: 'benchmark-action'
39+
repo-name: 'github-action-benchmark'
40+
base_branch: ${{ inputs.base_branch || 'main' }}
41+
mode: ${{ github.event_name == 'pull_request' && 'verify' || inputs.mode || 'cherry-pick' }}
42+
node_version: ${{ inputs.node_version || '24' }}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Benchmark.Net Example
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions:
8+
contents: write
9+
deployments: write
10+
11+
jobs:
12+
benchmark:
13+
name: Run Benchmark.Net benchmark example
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v7
17+
- uses: actions/setup-dotnet@v5
18+
with:
19+
dotnet-version: '6.0.101' # SDK Version to use. keep in line with examples/benchmarkdotnet/global.json
20+
- name: Run benchmark
21+
run: cd examples/benchmarkdotnet && dotnet run --exporters json --filter '*'
22+
23+
- name: Store benchmark result
24+
uses: step-security/github-action-benchmark@v1
25+
with:
26+
name: Benchmark.Net Benchmark
27+
tool: 'benchmarkdotnet'
28+
output-file-path: examples/benchmarkdotnet/BenchmarkDotNet.Artifacts/results/Sample.Benchmarks-report-full-compressed.json
29+
github-token: ${{ secrets.GITHUB_TOKEN }}
30+
auto-push: true
31+
# Show alert with commit comment on detecting possible performance regression
32+
alert-threshold: '200%'
33+
comment-on-alert: true
34+
fail-on-alert: true
35+
alert-comment-cc-users: '@anurag'
36+
37+
- name: Store benchmark result - separate results repo
38+
uses: step-security/github-action-benchmark@v1
39+
with:
40+
name: Benchmark.Net Benchmark
41+
tool: 'benchmarkdotnet'
42+
output-file-path: examples/benchmarkdotnet/BenchmarkDotNet.Artifacts/results/Sample.Benchmarks-report-full-compressed.json
43+
github-token: ${{ secrets.BENCHMARK_ACTION_BOT_TOKEN }}
44+
auto-push: true
45+
# Show alert with commit comment on detecting possible performance regression
46+
alert-threshold: '200%'
47+
comment-on-alert: true
48+
fail-on-alert: true
49+
alert-comment-cc-users: '@anurag'
50+
gh-repository: 'github.com/step-security/github-action-benchmark-results'

‎.github/workflows/benchmarkjs.yml‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Benchmark.js Example
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions:
8+
contents: write
9+
deployments: write
10+
11+
jobs:
12+
benchmark:
13+
name: Run JavaScript benchmark example
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v7
17+
- uses: actions/setup-node@v6
18+
with:
19+
node-version-file: '.nvmrc'
20+
cache: 'npm'
21+
- name: Run benchmark
22+
run: cd examples/benchmarkjs && npm install && node bench.js | tee output.txt
23+
24+
- name: Store benchmark result
25+
uses: step-security/github-action-benchmark@v1
26+
with:
27+
name: Benchmark.js Benchmark
28+
tool: 'benchmarkjs'
29+
output-file-path: examples/benchmarkjs/output.txt
30+
github-token: ${{ secrets.GITHUB_TOKEN }}
31+
auto-push: true
32+
# Show alert with commit comment on detecting possible performance regression
33+
alert-threshold: '200%'
34+
comment-on-alert: true
35+
fail-on-alert: true
36+
alert-comment-cc-users: '@anurag'
37+
38+
- name: Store benchmark result - separate results repo
39+
uses: step-security/github-action-benchmark@v1
40+
with:
41+
name: Benchmark.js Benchmark
42+
tool: 'benchmarkjs'
43+
output-file-path: examples/benchmarkjs/output.txt
44+
github-token: ${{ secrets.BENCHMARK_ACTION_BOT_TOKEN }}
45+
auto-push: true
46+
# Show alert with commit comment on detecting possible performance regression
47+
alert-threshold: '200%'
48+
comment-on-alert: true
49+
fail-on-alert: true
50+
alert-comment-cc-users: '@anurag'
51+
gh-repository: 'github.com/step-security/github-action-benchmark-results'

0 commit comments

Comments
 (0)