-
Notifications
You must be signed in to change notification settings - Fork 19
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
Restructure tests #93
Changes from all commits
54e61e9
2c69354
ffb2ec2
18b8040
0baa789
5c5444f
507bb0c
c30da1b
cc380c3
c249d07
2c1c892
f1759b6
7d786ed
a1bc6a0
6622de8
2d298b6
c0ce6ee
d821378
8ea8fbe
1db4a8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Integration Contracts (Vendor, Examples) | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
integration_contracts_run_tests: | ||
name: Run Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@d64e0553100205688c0fb2fa16edb0fc8663c590 # v17 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
|
||
- name: Test | ||
run: nix develop -c make test-integration-contracts |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Integration Gauntlet | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
integration_gauntlet_run_tests: | ||
name: Run Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@d64e0553100205688c0fb2fa16edb0fc8663c590 # v17 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
|
||
- name: Test | ||
run: nix develop -c make test-integration-gauntlet | ||
|
||
- name: Test - Run Gauntlet CLI via Yarn | ||
run: nix develop -c yarn gauntlet |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
lint_format_check: | ||
name: Format Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@d64e0553100205688c0fb2fa16edb0fc8663c590 # v17 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
|
||
- name: Install | ||
run: nix develop -c yarn install --frozen-lockfile | ||
|
||
- name: Check | ||
run: nix develop -c make format-check |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,23 +15,17 @@ | |
"@nomiclabs/hardhat-ethers": "^2.0.5", | ||
"@nomiclabs/hardhat-waffle": "^2.0.3", | ||
"@shardlabs/starknet-hardhat-plugin": "^0.6.2", | ||
"@types/chai": "^4.2.22", | ||
"@types/chai": "^4.3.3", | ||
"@types/elliptic": "^6.4.14", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "^18.7.11", | ||
"bn.js": "^5.2.0", | ||
"@types/mocha": "^9.1.1", | ||
"cairo-ls": "^0.0.4", | ||
"chai": "^4.3.4", | ||
"chai": "^4.3.6", | ||
"ethereum-waffle": "^3.4.4", | ||
"ethers": "^5.6.8", | ||
"hardhat": "^2.10.2", | ||
"starknet": "3.9.0", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.5.2" | ||
Comment on lines
-29
to
-30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't these required for tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are declared as part of |
||
"hardhat": "^2.10.2" | ||
}, | ||
"dependencies": { | ||
"@chainlink/contracts": "^0.4.2", | ||
"@toruslabs/starkware-crypto": "^1.0.0", | ||
"axios": "^0.24.0" | ||
} | ||
} |
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.
Why not rely on the toplevel
yarn test
which uses the Jest config to run all the tests? I personally only use that and ignore theMakefile
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.
The version before this PR just ran Jest tests via root
package.json
test script.The problem was not all workspace packages use Jest for testing - our contracts, example project, and 2x integration projects (multisig, starkgate) use hardhat + mocha, so they wouldn't be run.
Then I updated the root
package.json
test script to iterate over all projects and run their test scripts via"yarn workspaces run test"
- but now the problem is Hardhat setup tests expect external network to be started already, and Gauntlet Jest tests run their own network (Integrated Devnet) onbeforeAll
. This was now a conflict because Integrated Devnet wouldn't start successfully if docker container was already running on the same 5050 port.So for now I've split the two category of tests as different target, and different CI workflows. Now there is no infra conflict, and all tests are finally ran.
This is enough for this PR I'd say, and the plan for the next one is to restructure how do we run local env in tests as dependencies. Every tests suite should start its own network programatically in test setup, and tear it down when finished. At that point we can just run all tests at once via
"yarn workspaces run test"
and they would be even more isolated.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.
tldr; I consider this a temp workaround, and will try to remove it as test runs are restructured to be idempotent.
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.
Extracted a GH Issue: