Skip to content

Commit

Permalink
feat(benchmarks): add circleci job
Browse files Browse the repository at this point in the history
Co-authored-by: Dustin Schau <dustinschau@gmail.com>
  • Loading branch information
nicholascapo and DSchau committed Jan 9, 2020
1 parent 242ff89 commit 6b6a3af
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,26 @@ jobs:
paths:
- "*"

run_benchmarks:
docker:
- image: circleci/node:12
steps:
- checkout
- run: ./scripts/build-benchmark.sh

workflows:
version: 2

run_benchmarks:
jobs: [run_benchmarks]
triggers:
- schedule:
cron: "12 3 * * *" # every day at 03:12
filters:
branches:
only:
- master

nightly-react-next:
triggers:
- schedule:
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/markdown_id/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1",
"bench": "rm -r markdown-pages; NUM_PAGES=${NUM_PAGES:-2000} node md.generate.js; gatsby clean; node --max_old_space_size=2000 node_modules/.bin/gatsby build",
"benchnb": "gatsby clean; node --max_old_space_size=2000 node_modules/.bin/gatsby build",
"postinstall": "NUM_PAGES=${NUM_PAGES:-2000} node md.generate.js"
"postinstall": "rm -rf markdown-pages && gatsby clean && NUM_PAGES=${NUM_PAGES:-2000} node md.generate.js"
}
}
2 changes: 1 addition & 1 deletion benchmarks/markdown_slug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1",
"bench": "rm -r markdown-pages; NUM_PAGES=${NUM_PAGES:-2000} node md.generate.js; gatsby clean; node --max_old_space_size=2000 node_modules/.bin/gatsby build",
"benchnb": "gatsby clean; node --max_old_space_size=2000 node_modules/.bin/gatsby build",
"postinstall": "NUM_PAGES=${NUM_PAGES:-2000} node md.generate.js"
"postinstall": "rm -rf markdown-pages && gatsby clean && NUM_PAGES=${NUM_PAGES:-2000} node md.generate.js"
}
}
33 changes: 33 additions & 0 deletions scripts/build-benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash -eux

set -e
set -u
set -x

BENCHMARKS=(
# create-pages
# image-processing
markdown_id
markdown_slug
markdown_table
# plugin-manifest
# query
)

SIZES=(
1000
5000
10000
25000
100000
)

cd benchmarks
for benchmark in "${BENCHMARKS[@]}"; do
cd "${benchmark}"
for num in "${SIZES[@]}"; do
NUM_PAGES=${num} npm install
NUM_PAGES=${num} ./node_modules/.bin/gatsby build
done
cd ..
done

0 comments on commit 6b6a3af

Please sign in to comment.