diff --git a/tests/performance/README.md b/tests/performance/README.md new file mode 100644 index 000000000000..18dfdd118159 --- /dev/null +++ b/tests/performance/README.md @@ -0,0 +1,28 @@ +# Temp README (intended for maintainers only at this time) + +Run: + +```sh +docker-compose -f tests/performance/docker-compose.yml up --build +``` + +It will build the docker container, create volumes for the local files, and will clone the real world project repo ready for experimentation. + +The docker container is configured to run forever, so you just need to attach a shell to it, + +e.g. by running + +```sh +docker exec -it {{ RUNNING_CONTAINER_ID_HERE }} bash +``` + +Or by using the docker extension in VSCode and right clicking on the running container. + +Every time you make an update to the local built packages (e.g. parser or eslint-plugin), you need to rerun +the utility script _within_ the running container. + +For example, you will run something like the following (where `root@a91d93f9ffc3` refers to what's running in your container): + +```sh +root@a91d93f9ffc3:/usr/vega-lite# ../linked/install-local-packages.sh +``` diff --git a/tests/performance/docker-compose.yml b/tests/performance/docker-compose.yml new file mode 100644 index 000000000000..e47eb9581b7b --- /dev/null +++ b/tests/performance/docker-compose.yml @@ -0,0 +1,21 @@ +version: '3' + +services: + lint-real-repo: + build: ./fixtures/lint-real-repo + container_name: "lint-real-repo" + volumes: + # Runtime link to the relevant built @typescript-eslint packages and test utils, + # but apply an empty volume for the package tests, we don't need those. + - ../../package.json/:/usr/root-package.json + - ./utils/:/usr/utils + - ../../packages/parser/:/usr/parser + - /usr/parser/tests + - ../../packages/typescript-estree/:/usr/typescript-estree + - /usr/typescript-estree/tests + - ../../packages/eslint-plugin/:/usr/eslint-plugin + - /usr/eslint-plugin/tests + - ../../packages/eslint-plugin-tslint/:/usr/eslint-plugin-tslint + - /usr/eslint-plugin-tslint/tests + # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. + - ./fixtures/lint-real-repo:/usr/linked diff --git a/tests/performance/fixtures/lint-real-repo/Dockerfile b/tests/performance/fixtures/lint-real-repo/Dockerfile new file mode 100644 index 000000000000..f3002796ecbb --- /dev/null +++ b/tests/performance/fixtures/lint-real-repo/Dockerfile @@ -0,0 +1,15 @@ +FROM node:carbon + +WORKDIR /usr + +# Clone the repo and checkout the relevant commit +RUN git clone https://github.com/typescript-eslint/vega-lite +WORKDIR /usr/vega-lite +RUN git checkout f1e4c1ebe50fdf3b9131ba5dde915e6efbe4bd87 + +# Run the equivalent of the project's travis build before linting starts +RUN yarn install --frozen-lockfile && yarn cache clean +RUN yarn build + +# Keep the container alive forever +CMD [ "tail", "-f", "/dev/null"] diff --git a/tests/performance/fixtures/lint-real-repo/install-local-packages.sh b/tests/performance/fixtures/lint-real-repo/install-local-packages.sh new file mode 100755 index 000000000000..f38459f34552 --- /dev/null +++ b/tests/performance/fixtures/lint-real-repo/install-local-packages.sh @@ -0,0 +1,10 @@ +# This script should be run by attaching a shell to the running docker +# container, and then running `../linked/install-local-packages.sh` from +# that shell. +# +# Use the local volumes for our own packages +# NOTE: You need to rerun this script every time the local packages change +# in order to apply the changes to the node_modules of the repo under test +yarn add @typescript-eslint/typescript-estree@file:///usr/typescript-estree +yarn add @typescript-eslint/parser@file:///usr/parser +yarn add @typescript-eslint/eslint-plugin@file:///usr/eslint-plugin