Skip to content

Commit

Permalink
Merge branch 'master' into fix-35910
Browse files Browse the repository at this point in the history
  • Loading branch information
LekoArts committed Jul 26, 2022
2 parents 76b2c4d + 922874d commit 494c821
Show file tree
Hide file tree
Showing 710 changed files with 33,612 additions and 21,963 deletions.
16 changes: 13 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ aliases:

e2e-executor: &e2e-executor
docker:
- image: cypress/browsers:node14.15.0-chrome86-ff82
- image: cypress/browsers:node14.15.0-chrome96-ff94
environment:
<<: *e2e-executor-env

Expand Down Expand Up @@ -320,6 +320,13 @@ jobs:
test_path: integration-tests/functions
test_command: yarn test

integration_tests_head_function_export:
executor: node
steps:
- e2e-test:
test_path: integration-tests/head-function-export
test_command: yarn test

e2e_tests_path-prefix:
<<: *e2e-executor
environment:
Expand Down Expand Up @@ -392,7 +399,7 @@ jobs:
steps:
- e2e-test:
test_path: e2e-tests/development-runtime
react_version: "^18.0.0"
react_version: "^18.2.0"

e2e_tests_production_runtime:
<<: *e2e_tests_production_runtime_alias
Expand All @@ -403,7 +410,7 @@ jobs:
- e2e-test:
test_path: e2e-tests/production-runtime
test_command: CYPRESS_PROJECT_ID=5k8zbj CYPRESS_RECORD_KEY=ec36ff6b-3db9-48a9-8f7b-2faf301ab800 yarn test && CYPRESS_PROJECT_ID=yvdct2 CYPRESS_RECORD_KEY=2a4f4f31-0dfb-4a56-80e0-9ed42a1131a4 yarn test:offline
react_version: "^18.0.0"
react_version: "^18.2.0"

themes_e2e_tests_development_runtime:
<<: *e2e-executor
Expand Down Expand Up @@ -550,6 +557,7 @@ jobs:
no_output_timeout: 15m
environment:
NODE_OPTIONS: --max-old-space-size=2048
GATSBY_EXPERIMENTAL_LMDB_STORE: 1
GENERATE_JEST_REPORT: "true"
JEST_JUNIT_OUTPUT_DIR: ./test-results/jest-node/
JEST_JUNIT_OUTPUT_NAME: results.xml
Expand Down Expand Up @@ -625,6 +633,8 @@ workflows:
<<: *e2e-test-workflow
- integration_tests_functions:
<<: *e2e-test-workflow
- integration_tests_head_function_export:
<<: *e2e-test-workflow
- integration_tests_gatsby_cli:
requires:
- bootstrap
Expand Down
9 changes: 8 additions & 1 deletion .github/ISSUE_TEMPLATE/BUG_REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ body:
attributes:
label: Reproduction Link
placeholder: "https://github.com/username/repository-name/"
description: "Link to a reproduction (GitHub repository, Codesandbox, etc.). **Do not link to your actual project**, but provide a minimal reproduction in a fresh project -- how to make a minimal reproduction: https://gatsby.dev/reproduction"
description: |
Link to a minimal reproduction (GitHub repository, CodeSandbox, StackBlitz, etc.).
**Do not link to your actual project**, but provide a minimal reproduction in a fresh project — how to make a minimal reproduction: https://gatsby.dev/reproduction
You can use these links to quickly set up a new reproduction:
- CodeSandbox: https://githubbox.com/gatsbyjs/gatsby-starter-minimal
- StackBlitz: https://githubblitz.com/gatsbyjs/gatsby-starter-minimal
validations:
required: true
- type: textarea
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM node:14-buster
ARG jemalloc
ENV NODE_ENV=production
ENV CI=1
ENV GATSBY_CPU_COUNT=4
RUN apt-get update -y && apt-get upgrade -y && apt-get install git curl npm -y
Expand All @@ -9,7 +8,7 @@ RUN npm i -g gatsby-cli gatsby-dev-cli
# set heap to 16gb just to catch all test cases
ENV NODE_OPTIONS="--max-old-space-size=16368"

RUN echo "\n\necho \"Welcome to the Gatsby Memory benchmark container!\\n - /usr/src/gatsby : Your local gatsby repo\\n - /usr/src/app : The memory benchmark gatsby site\\n\"" > /root/.bashrc
RUN echo "\n\necho \"Welcome to the Gatsby benchmark container!\\n - /usr/src/gatsby : Your local gatsby repo\\n - /usr/src/app : The benchmark gatsby site\\n\"" > /root/.bashrc

RUN if [ "$jemalloc" = "1" ]; then \
echo "Using jemalloc for memory allocation" && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,28 @@ It has ports 9000 (for hosting gatsby) and 9229 (for debugging) exposed.
Within the container, two points to your local filesystem are mounted:

- /usr/src/gatsby : Your local gatsby repo
- /usr/src/site : The memory benchmark gatsby site
- /usr/src/app : The benchmark gatsby site

If you'd like to configure `jemalloc` to run within the container, set the `JEMALLOC=1` env var when building the docker container.

## Commands

### Tests

#### yarn test --memory X --num-nodes Y --node-size Z
#### yarn test --memory X --num-nodes Y --node-size Z --command [build, develop]

Runs a test build within a docker container with the given memory allotment.
Within our gatsby-node, we'll create X nodes with a string property of size Y.

Example: running a build with 1000 nodes of 1mb each, in a docker container with 8gb of memory.

```
$ yarn test --memory 8g --num-nodes 500 --node-size 1m
$ yarn test --memory 8g --num-nodes 500 --node-size 1m --command build
```

You may optionally pass a `--site` flag as well to test a specific site at the given path. This will, however,
not respond to the `num-nodes` or `node-size` arguments, as those are configured in the benchmark's gatsby-node.

#### yarn test-suite --name some-name --suite [incremental|exhaustive]

Runs through test suites defined in `scripts/test-suite.js` and outputs results to `output/some-name`.
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "memory-usage-benchmark",
"name": "gatsby-generic-benchmark",
"private": true,
"version": "1.0.0",
"description": "Test site stress testing memory usage",
Expand All @@ -10,8 +10,8 @@
"gatsby:develop": "NODE_ENV=development yarn gatsby develop -H 0.0.0.0 -p 9000",
"gatsby:build:debug": "node --nolazy --inspect-brk=0.0.0.0:9229 node_modules/.bin/gatsby build",
"gatsby:develop:debug": "NODE_ENV=development node --nolazy --inspect-brk=0.0.0.0:9229 node_modules/.bin/gatsby develop -H 0.0.0.0 -p 9000",
"docker:build": "docker build -t gatsby-memory . --build-arg jemalloc=$JEMALLOC",
"docker:remove": "docker image rm -f gatsby-memory",
"docker:build": "docker build -t gatsby-generic-benchmark . --build-arg jemalloc=$JEMALLOC",
"docker:remove": "docker image rm -f gatsby-generic-benchmark",
"docker:rebuild": "yarn docker:stop; yarn docker:remove && yarn docker:build",
"docker:start": "./scripts/docker-start",
"docker:connect": "./scripts/docker-connect",
Expand All @@ -23,7 +23,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby/tree/master/benchmarks/memory"
"url": "https://github.com/gatsbyjs/gatsby/tree/master/benchmarks/generic"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DOCKER_ID=$(./scripts/docker-get-id)

if [ -z "$DOCKER_ID" ]; then
echo "\nNo gatsby-memory is running. Start one with \`yarn docker:start\`.\n"
echo "\nNo gatsby-generic-benchmark is running. Start one with \`yarn docker:start\`.\n"
return 1
fi

Expand Down
8 changes: 8 additions & 0 deletions benchmarks/docker-runner/scripts/docker-get-id
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DOCKER_ID=$(\
docker ps --format '{{.Image}}:{{.ID}}' | \
grep "gatsby-generic-benchmark" | \
head -n 1 | \
sed 's/gatsby\-generic\-benchmark://'\
)

echo $DOCKER_ID
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
DOCKER_ID=$(./scripts/docker-get-id)
if [ -n "$DOCKER_ID" ]; then
echo "\nA gatsby-memory container is already running with id $DOCKER_ID."
echo "\nA gatsby-generic-benchmark container is already running with id $DOCKER_ID."
echo "Please use that container, or run \`yarn docker:stop\` to stop it.\n"
return 1
fi

MEMORY_LIMIT="${DOCKER_MEMORY_LIMIT:-2g}"
BENCHMARK_SITE="${DOCKER_BENCHMARK_SITE:-$(pwd)}"

DOCKER_ID=$(\
docker run -td \
--mount type=bind,source="$(pwd)/../..",target=/usr/src/gatsby \
--mount type=bind,source="$(pwd)",target=/usr/src/app \
--mount type=bind,source="${BENCHMARK_SITE}",target=/usr/src/app \
--publish 9229:9229 \
--publish 9000:9000 \
--memory="${MEMORY_LIMIT}" \
--memory-swap="${MEMORY_LIMIT}" \
gatsby-memory \
gatsby-generic-benchmark \
| head -c 12 \
)

sleep 1
docker exec $DOCKER_ID bash -c "/usr/src/app/scripts/docker-write-memory &"
docker exec $DOCKER_ID bash -c "/usr/src/gatsby/benchmarks/docker-runner/scripts/docker-write-memory &"

echo "\nStarted container id ${DOCKER_ID} with ${MEMORY_LIMIT} of memory! Run \`yarn docker:connect\` to connect to the container.\n"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DOCKER_ID=$(./scripts/docker-get-id)
if [ -z "$DOCKER_ID" ]; then
echo -e "\nNo gatsby-memory container was found. Run \`yarn docker:start\` to start one.\n"
echo -e "\nNo gatsby-generic-benchmark container was found. Run \`yarn docker:start\` to start one.\n"
exit 1
fi

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DOCKER_ID=$(./scripts/docker-get-id)

if [ -z "$DOCKER_ID" ]; then
echo "\nNo gatsby-memory is running.\n"
echo "\nNo gatsby-generic-benchmark is running.\n"
return 1
fi

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 494c821

Please sign in to comment.