Skip to content

Commit

Permalink
feat: codspeed using vitest (#2)
Browse files Browse the repository at this point in the history
* experiment: add codspeed

* fix: make esm loader happy

* fix: use correct node command

* chore: trigger codspeed run

* experiment: add codspeed using vitest

* chore: lint

* fix: revert import broken by lint

* experiment: try out patching

* chore: enable         env:
                        CODSPEED_FORCE_OPTIMIZATION: true

* trigger codspeed

* fix: adjust ci & lint to new benchmarks

* refactor: remove types/chai to prevent type conflicts. they now come bundled with vite

* chore: prettier

* fix: commonly ignored files

* chore: prettier

* chore: add codspeed to spellcheck
  • Loading branch information
erikwrede committed Oct 17, 2024
1 parent 9f69832 commit 8d2f93f
Show file tree
Hide file tree
Showing 23 changed files with 78,944 additions and 37 deletions.
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"
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
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

0 comments on commit 8d2f93f

Please sign in to comment.