Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run E2E tests as part of CI #271

Merged
merged 20 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,25 @@ jobs:
- run:
name: Run tests
command: yarn test
test_e2e:
docker:
- image: "cimg/base:current"
resource_class: medium+
steps:
- checkout
- setup_remote_docker
- node/install:
install-yarn: true
node-version: "18.15"
- node/install-packages:
pkg-manager: yarn
- run: node --version
- run:
name: Run e2e tests
command: yarn test:e2e:ci

workflows:
run-ci:
jobs:
- test
- test_e2e
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
build
contracts
generated
tests
tests
!tests/e2e/setup-scripts/*
4 changes: 3 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ RUN apk add --no-cache curl
RUN apk add --no-cache git
WORKDIR /usr/subgraph
COPY . .
CMD [ "yarn" ]
COPY ./tests/e2e/setup-scripts /usr/subgraph/setup-scripts
CMD [ "yarn" ]

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"scripts": {
"build": "yarn codegen:generic && graph build",
"test": "yarn codegen:generic && graph test -r",
"test:e2e": "cd tests/e2e && docker compose -f docker-compose.yml -f docker-compose.test.yml up --exit-code-from runner",
"test:e2e": "cd tests/e2e && GRAPH_NODE_BASE_IMAGE=graphprotocol/graph-node:latest docker compose -f docker-compose.yml -f docker-compose.test.yml up --exit-code-from runner",
"test:e2e:m1": "cd tests/e2e && GRAPH_NODE_BASE_IMAGE=graph-node:latest docker compose -f docker-compose.yml -f docker-compose.test.yml up --exit-code-from runner",
"test:e2e:ci": "cd tests/e2e && GRAPH_NODE_BASE_IMAGE=graphprotocol/graph-node:latest docker compose -f docker-compose.yml -f docker-compose.ci.yml up --exit-code-from runner",
"run:local": "cd tests/e2e && docker compose -f docker-compose.yml -f docker-compose.local.yml up",
"coverage": "graph test -- -c",
"deploy:mainnet-hosted": "yarn prepare:mainnet && graph deploy --product hosted-service --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ artblocks/art-blocks",
Expand Down
11 changes: 11 additions & 0 deletions tests/e2e/docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "3.8"
services:
runner:
build: runner
environment:
- SUBGRAPH_GRAPHQL_URL=http://graph-node:8000/subgraphs/name/artblocks/art-blocks
depends_on:
subgraph:
condition: service_healthy
volumes:
- shared-data:/usr/runner/shared
5 changes: 4 additions & 1 deletion tests/e2e/docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ services:
- '8001:8001'
- '8020:8020'
- '8030:8030'
- '8040:8040'
- '8040:8040'
subgraph:
volumes:
- ./setup-scripts:/usr/subgraph/setup-scripts
3 changes: 3 additions & 0 deletions tests/e2e/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ services:
volumes:
- shared-data:/usr/runner/shared
- ./runner/__tests__:/usr/runner/__tests__
subgraph:
volumes:
- ./setup-scripts:/usr/subgraph/setup-scripts
9 changes: 6 additions & 3 deletions tests/e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ services:
build: seed
volumes:
- shared-data:/usr/seed/shared
- ./setup-scripts:/usr/seed/setup-scripts
depends_on:
hardhat:
condition: service_healthy
graph-node:
build: graph-node
build:
context: .
dockerfile_inline: |
FROM ${GRAPH_NODE_BASE_IMAGE}
RUN ["apt", "update"]
RUN ["apt-get", "install", "-y", "curl"]
depends_on:
- ipfs
- postgres
Expand Down Expand Up @@ -72,7 +76,6 @@ services:
IPFS: 'http://ipfs:5001'
volumes:
- shared-data:/usr/subgraph/shared
- ./setup-scripts:/usr/subgraph/setup-scripts
command: ./setup-scripts/subgraph.sh
# We create an empty file called `subgraph-complete` in the shared
# volume when the subgraph is deployed. We use this file as a
Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/graph-node/Dockerfile

This file was deleted.

Loading