Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CodSpeed Benchmarks #4243

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"exclude": [
"src/**/index.ts",
"src/**/*-fuzz.ts",
"src/**/__benchmarks__/*.ts",
"src/jsutils/Maybe.ts",
"src/jsutils/ObjMap.ts",
"src/jsutils/PromiseOrValue.ts",
Expand Down
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@

# Ignore TS files inside integration test
/integrationTests/ts/*.ts

# Ignore config files
/vitest.config.ts
6 changes: 6 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,12 @@ module.exports = {
],
},
},
{
files: 'src/**/__benchmarks__/**',
rules: {
'import/no-nodejs-modules': 'off',
},
},
{
files: 'integrationTests/*',
env: {
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,17 @@ jobs:
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Check if commit contains files that should be ignored
run: |
git clone --depth 1 https://github.com/github/gitignore.git

rm gitignore/Global/ModelSim.gitignore
rm gitignore/Global/Images.gitignore
cat gitignore/Node.gitignore gitignore/Global/*.gitignore > all.gitignore

IGNORED_FILES=$(git ls-files --cached --ignored --exclude-from=all.gitignore)
IGNORED_FILES_UNPROCESSED=$(git ls-files --cached --ignored --exclude-from=all.gitignore)
IGNORED_FILES=$(grep -v -F "patches/@codspeed+core+3.1.0.patch" <<< "$IGNORED_FILES_UNPROCESSED" || true)

echo "IGNORED_FILES: $IGNORED_FILES"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can revert this as soon as codspeed doesn't require the patch anymore

if [[ "$IGNORED_FILES" != "" ]]; then
echo -e "::error::Please remove these files:\n$IGNORED_FILES" | sed -z 's/\n/%0A/g'
exit 1
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CodSpeed Benchmarks

on:
push:
branches:
- 'main' # or "master"
pull_request:
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:

jobs:
benchmarks:
name: Run benchmarks
runs-on: ubuntu-latest
steps:
- uses: 'actions/checkout@v4'
- uses: 'actions/setup-node@v3'
- name: Install dependencies
run: npm install
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
env:
CODSPEED_FORCE_OPTIMIZATION: true
with:
run: npm exec vitest bench
token: ${{ secrets.CODSPEED_TOKEN }}
5 changes: 4 additions & 1 deletion cspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ ignorePaths:
- package.json
- benchmark/github-schema.graphql
- benchmark/github-schema.json
- patches
- src/__benchmarks__/github-schema.json
- src/__benchmarks__/github-schema.graphql
Comment on lines +11 to +12
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could merge these two with the existing benchmark resource files into a shared folder

overrides:
- filename: '**/docs-old/APIReference-*.md'
ignoreRegExpList: ['/href="[^"]*"/']
Expand Down Expand Up @@ -34,7 +37,7 @@ ignoreRegExpList:

words:
- graphiql

- codspeed
# Different names used inside tests
- Skywalker
- Leia
Expand Down
Loading