Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 15191bb

Browse files
authored
test: setup for real-world performance testing (typescript-eslint#458)
1 parent 8141f01 commit 15191bb

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

tests/performance/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Temp README (intended for maintainers only at this time)
2+
3+
Run:
4+
5+
```sh
6+
docker-compose -f tests/performance/docker-compose.yml up --build
7+
```
8+
9+
It will build the docker container, create volumes for the local files, and will clone the real world project repo ready for experimentation.
10+
11+
The docker container is configured to run forever, so you just need to attach a shell to it,
12+
13+
e.g. by running
14+
15+
```sh
16+
docker exec -it {{ RUNNING_CONTAINER_ID_HERE }} bash
17+
```
18+
19+
Or by using the docker extension in VSCode and right clicking on the running container.
20+
21+
Every time you make an update to the local built packages (e.g. parser or eslint-plugin), you need to rerun
22+
the utility script _within_ the running container.
23+
24+
For example, you will run something like the following (where `root@a91d93f9ffc3` refers to what's running in your container):
25+
26+
```sh
27+
root@a91d93f9ffc3:/usr/vega-lite# ../linked/install-local-packages.sh
28+
```

tests/performance/docker-compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: '3'
2+
3+
services:
4+
lint-real-repo:
5+
build: ./fixtures/lint-real-repo
6+
container_name: "lint-real-repo"
7+
volumes:
8+
# Runtime link to the relevant built @typescript-eslint packages and test utils,
9+
# but apply an empty volume for the package tests, we don't need those.
10+
- ../../package.json/:/usr/root-package.json
11+
- ./utils/:/usr/utils
12+
- ../../packages/parser/:/usr/parser
13+
- /usr/parser/tests
14+
- ../../packages/typescript-estree/:/usr/typescript-estree
15+
- /usr/typescript-estree/tests
16+
- ../../packages/eslint-plugin/:/usr/eslint-plugin
17+
- /usr/eslint-plugin/tests
18+
- ../../packages/eslint-plugin-tslint/:/usr/eslint-plugin-tslint
19+
- /usr/eslint-plugin-tslint/tests
20+
# Runtime link to all the specific integration test files, so that most updates don't require a rebuild.
21+
- ./fixtures/lint-real-repo:/usr/linked
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:carbon
2+
3+
WORKDIR /usr
4+
5+
# Clone the repo and checkout the relevant commit
6+
RUN git clone https://github.com/typescript-eslint/vega-lite
7+
WORKDIR /usr/vega-lite
8+
RUN git checkout f1e4c1ebe50fdf3b9131ba5dde915e6efbe4bd87
9+
10+
# Run the equivalent of the project's travis build before linting starts
11+
RUN yarn install --frozen-lockfile && yarn cache clean
12+
RUN yarn build
13+
14+
# Keep the container alive forever
15+
CMD [ "tail", "-f", "/dev/null"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This script should be run by attaching a shell to the running docker
2+
# container, and then running `../linked/install-local-packages.sh` from
3+
# that shell.
4+
#
5+
# Use the local volumes for our own packages
6+
# NOTE: You need to rerun this script every time the local packages change
7+
# in order to apply the changes to the node_modules of the repo under test
8+
yarn add @typescript-eslint/typescript-estree@file:///usr/typescript-estree
9+
yarn add @typescript-eslint/parser@file:///usr/parser
10+
yarn add @typescript-eslint/eslint-plugin@file:///usr/eslint-plugin

0 commit comments

Comments
 (0)