-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Add e2e testing #34
Open
mj52951
wants to merge
12
commits into
main
Choose a base branch
from
mj52951/add-e2e-testing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+751
−149
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a878abc
feat: Add e2e tests
mj52951 77b1b2c
Align with api changes
mj52951 c108eb8
Remove unused const
mj52951 8eb7df6
Merge branch 'main' into mj52951/add-e2e-testing
mj52951 f95671f
Merge branch 'main' into mj52951/add-e2e-testing
mj52951 8600e12
Align tests with Route changes
mj52951 b4dd9d4
Add e2e testing workflow
mj52951 42b117b
Install dependencies in workflow
mj52951 6ffc35a
Detach docker logs
mj52951 b9770d5
Merge branch 'main' into mj52951/add-e2e-testing
mj52951 a93207c
Update envs
mj52951 08a8ec9
Remove example
mj52951 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
DB_NAME=squid | ||
DB_PASS=squid | ||
DB_PORT=5432 | ||
DB_USERNAME=postgres | ||
DB_HOST=localhost | ||
|
||
SHARED_CONFIG_URL="https://ipfs.io/ipfs/bafkreiasnla2ya55of6nwm3swjstip4q2ixfa3t6tvixyibclfovxnerte" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: E2E Tests | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
- name: Install Node.js ${{ matrix.node-version }} | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Run Docker | ||
run: docker compose up --build -d | ||
- name: Wait | ||
run: sleep 80s | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Run tests | ||
run: yarn run test:e2e | ||
- name: Clean up Docker containers | ||
if: always() | ||
run: docker compose down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,73 @@ | ||
{ | ||
"$schema": "https://cdn.subsquid.io/schemas/commands.json", | ||
"commands": { | ||
"clean": { | ||
"description": "delete all build artifacts", | ||
"cmd": ["npx", "--yes", "rimraf", "lib"] | ||
}, | ||
"build": { | ||
"description": "Build the squid project", | ||
"deps": ["clean"], | ||
"cmd": ["tsc"] | ||
}, | ||
"up": { | ||
"description": "Start indexer", | ||
"cmd": [ | ||
"docker", | ||
"compose", | ||
"up", | ||
"-d" | ||
] | ||
}, | ||
"down": { | ||
"description": "Drop indexer", | ||
"cmd": [ | ||
"docker", | ||
"compose", | ||
"down" | ||
] | ||
}, | ||
"migration:apply": { | ||
"description": "Apply the DB migrations", | ||
"cmd": ["squid-typeorm-migration", "apply"] | ||
}, | ||
"migration:generate": { | ||
"description": "Generate a DB migration matching the TypeORM entities", | ||
"deps": ["migration:clean"], | ||
"cmd": ["squid-typeorm-migration", "generate"] | ||
}, | ||
"migration:clean": { | ||
"description": "Clean the migrations folder", | ||
"cmd": ["npx", "--yes", "rimraf", "./db/migrations/*.js"] | ||
}, | ||
"migration": { | ||
"cmd": ["squid-typeorm-migration", "generate"], | ||
"hidden": true | ||
}, | ||
"codegen": { | ||
"description": "Generate TypeORM entities from the schema file", | ||
"cmd": ["squid-typeorm-codegen"] | ||
}, | ||
"evm-typegen": { | ||
"description": "Generate data access classes for an ABI file(s) in the ./abi folder", | ||
"cmd": ["squid-evm-typegen", "./src/abi", {"glob": "./src/abi/*.json"}, "--multicall"] | ||
}, | ||
"substrate-typegen": { | ||
"description": "Generate data access classes for an substrate metadata", | ||
"cmd": ["squid-substrate-typegen", "./typegen.json"] | ||
}, | ||
"start-sepolia":{ | ||
"description": "Start Sepolia indexer", | ||
"deps": ["build", "migration:apply"], | ||
"cmd": ["node", "--require=dotenv/config", "lib/main.js", "dotenv_config_path=envs/.env.sepolia"] | ||
}, | ||
"start-holesky":{ | ||
"description": "Start Holesky indexer", | ||
"deps": ["build", "migration:apply"], | ||
"cmd": ["node", "--require=dotenv/config", "lib/main.js", "dotenv_config_path=envs/.env.holesky"] | ||
}, | ||
"process": { | ||
"description": "Load .env and start the squid processor", | ||
"deps": ["build", "migration:apply"], | ||
"cmd": ["node", "--require=dotenv/config", "lib/main.js"] | ||
}, | ||
"start-init": { | ||
"description": "Initialize the database and load config data", | ||
"deps": ["build", "migration:apply"], | ||
"cmd": ["node", "--require=dotenv/config", "lib/main_init.js"] | ||
}, | ||
"process:prod": { | ||
"description": "Start the squid processor", | ||
"cmd": ["node", "lib/main.js"], | ||
"hidden": true | ||
}, | ||
"check-updates": { | ||
"cmd": ["npx", "--yes", "npm-check-updates", "--filter=/subsquid/", "--upgrade"], | ||
"hidden": true | ||
}, | ||
"bump": { | ||
"description": "Bump @subsquid packages to the latest versions", | ||
"deps": ["check-updates"], | ||
"cmd": ["npm", "i", "-f"] | ||
}, | ||
"open": { | ||
"description": "Open a local browser window", | ||
"cmd": ["npx", "--yes", "opener"] | ||
} | ||
"$schema": "https://cdn.subsquid.io/schemas/commands.json", | ||
"commands": { | ||
"clean": { | ||
"description": "delete all build artifacts", | ||
"cmd": ["npx", "--yes", "rimraf", "lib"] | ||
}, | ||
"build": { | ||
"description": "Build the squid project", | ||
"deps": ["clean"], | ||
"cmd": ["tsc"] | ||
}, | ||
"up": { | ||
"description": "Start indexer", | ||
"cmd": [ | ||
"docker", | ||
"compose", | ||
"up", | ||
"-d" | ||
] | ||
}, | ||
"down": { | ||
"description": "Drop indexer", | ||
"cmd": [ | ||
"docker", | ||
"compose", | ||
"down" | ||
] | ||
}, | ||
"migration:apply": { | ||
"description": "Apply the DB migrations", | ||
"cmd": ["squid-typeorm-migration", "apply"] | ||
}, | ||
"migration:generate": { | ||
"description": "Generate a DB migration matching the TypeORM entities", | ||
"deps": ["migration:clean"], | ||
"cmd": ["squid-typeorm-migration", "generate"] | ||
}, | ||
"migration:clean": { | ||
"description": "Clean the migrations folder", | ||
"cmd": ["npx", "--yes", "rimraf", "./db/migrations/*.js"] | ||
}, | ||
"migration": { | ||
"cmd": ["squid-typeorm-migration", "generate"], | ||
"hidden": true | ||
}, | ||
"codegen": { | ||
"description": "Generate TypeORM entities from the schema file", | ||
"cmd": ["squid-typeorm-codegen"] | ||
}, | ||
"evm-typegen": { | ||
"description": "Generate data access classes for an ABI file(s) in the ./abi folder", | ||
"cmd": ["squid-evm-typegen", "./src/abi", {"glob": "./src/abi/*.json"}, "--multicall"] | ||
}, | ||
"substrate-typegen": { | ||
"description": "Generate data access classes for an substrate metadata", | ||
"cmd": ["squid-substrate-typegen", "./typegen.json"] | ||
}, | ||
"check-updates": { | ||
"cmd": ["npx", "--yes", "npm-check-updates", "--filter=/subsquid/", "--upgrade"], | ||
"hidden": true | ||
}, | ||
"bump": { | ||
"description": "Bump @subsquid packages to the latest versions", | ||
"deps": ["check-updates"], | ||
"cmd": ["npm", "i", "-f"] | ||
}, | ||
"open": { | ||
"description": "Open a local browser window", | ||
"cmd": ["npx", "--yes", "opener"] | ||
} | ||
} | ||
} |
10 changes: 7 additions & 3 deletions
10
db/migrations/1734354978596-Data.js → db/migrations/1734434955039-Data.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DB_NAME=squid | ||
DB_PASS=squid | ||
DB_PORT=5432 | ||
DB_USERNAME=postgres | ||
DB_HOST=db |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DB_NAME=squid | ||
DB_PASS=squid | ||
DB_PORT=5432 | ||
DB_USERNAME=postgres | ||
DB_HOST=db | ||
START_SCRIPT_ENV=index | ||
|
||
PROCESSOR_PROMETHEUS_PORT=3000 | ||
|
||
SHARED_CONFIG_URL="https://ipfs.io/ipfs/bafkreiasnla2ya55of6nwm3swjstip4q2ixfa3t6tvixyibclfovxnerte" | ||
|
||
DOMAIN_ID=1 | ||
1_METADATA='{"rpcUrl": "http://evm1:8545"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DB_NAME=squid | ||
DB_PASS=squid | ||
DB_PORT=5432 | ||
DB_USERNAME=postgres | ||
DB_HOST=db | ||
START_SCRIPT_ENV=index | ||
|
||
PROCESSOR_PROMETHEUS_PORT=3002 | ||
|
||
SHARED_CONFIG_URL="https://ipfs.io/ipfs/bafkreiasnla2ya55of6nwm3swjstip4q2ixfa3t6tvixyibclfovxnerte" | ||
|
||
DOMAIN_ID=2 | ||
2_METADATA='{"rpcUrl": "http://evm2:8545"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add .env to gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.env
is used for interpolation indocker-compose.yml
so it is needed. Same as./envs
files are needed inside containers.