Преглед изворни кода

Merge branch 'feature/build-script' into feature/proposals-test-coverage

Gleb Urvanov пре 4 година
родитељ
комит
3c35b7deb1
6 измењених фајлова са 54 додато и 6 уклоњено
  1. 11 2
      README.md
  2. 5 0
      devops/git-hooks/pre-commit
  3. 10 0
      devops/git-hooks/pre-push
  4. 10 1
      package.json
  5. 14 0
      scripts/run-test-chain.sh
  6. 4 3
      setup.sh

+ 11 - 2
README.md

@@ -79,14 +79,23 @@ This will build and run a fresh new local development chain purging existing one
 cargo test
 ```
 
-### API integration tests
+### Network tests
 
 ```bash
-./scripts/run-dev-chain.sh
+./scripts/run-test-chain.sh
 yarn test
 ```
 
 To run the integration tests with a different chain, you can omit step running the local development chain and set the node URL using `NODE_URL` environment variable.
+Proposal grace periods should be set to 0, otherwise proposal network tests will fail.
+
+### Rome-Constantinople migration network test
+
+Ensure Rome node is up and running, and node URL is set using `NODE_URL` environment variable (default value is `localhost:9944`).
+
+```bash
+yarn test-migration
+```
 
 ## Joystream Runtime
 

+ 5 - 0
devops/git-hooks/pre-commit

@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+
+echo 'cargo fmt --all -- --check'
+cargo fmt --all -- --check

+ 10 - 0
devops/git-hooks/pre-push

@@ -0,0 +1,10 @@
+#!/bin/sh
+set -e
+
+export BUILD_DUMMY_WASM_BINARY=1
+
+echo '+cargo test --all'
+cargo test --all
+
+echo '+cargo clippy --all -- -D warnings'
+cargo clippy --all -- -D warnings

+ 10 - 1
package.json

@@ -8,5 +8,14 @@
 	},
 	"workspaces": [
 		"tests/network-tests"
-	]
+	],
+	"devDependencies": {
+		"husky": "^4.2.5"
+	},
+	"husky": {
+	  "hooks": {
+		"pre-commit": "devops/git-hooks/pre-commit",
+		"pre-push": "devops/git-hooks/pre-push"
+	  }
+	}
 }

+ 14 - 0
scripts/run-test-chain.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+cargo build --release -p joystream-node
+cargo run --release -p joystream-node build-spec --chain dev > chainspec.json
+sed -i 's/"setValidatorCountProposalGracePeriod":.*/"setValidatorCountProposalGracePeriod": 0,/' chainspec.json
+sed -i 's/"runtimeUpgradeProposalGracePeriod":.*/"runtimeUpgradeProposalGracePeriod": 0,/' ./chainspec.json
+sed -i 's/"setElectionParametersProposalGracePeriod":.*/"setElectionParametersProposalGracePeriod": 0,/' ./chainspec.json
+sed -i 's/"textProposalGracePeriod":.*/"textProposalGracePeriod": 0,/' chainspec.json
+sed -i 's/"setContentWorkingGroupMintCapacityProposalGracePeriod":.*/"setContentWorkingGroupMintCapacityProposalGracePeriod": 0,/' chainspec.json
+sed -i 's/"setLeadProposalGracePeriod":.*/"setLeadProposalGracePeriod": 0,/' chainspec.json
+sed -i 's/"spendingProposalGracePeriod":.*/"spendingProposalGracePeriod": 0,/' chainspec.json
+sed -i 's/"evictStorageProviderProposalGracePeriod":.*/"evictStorageProviderProposalGracePeriod": 0,/' chainspec.json
+sed -i 's/"setStorageRoleParametersProposalGracePeriod":.*/"setStorageRoleParametersProposalGracePeriod": 0,/' chainspec.json
+yes | cargo run --release -p joystream-node -- purge-chain --dev
+cargo run --release -p joystream-node -- --dev

+ 4 - 3
setup.sh

@@ -7,8 +7,9 @@ set -e
 #  - rustup - rust insaller
 #  - rust compiler and toolchains
 #  - skips installing substrate and subkey
-curl https://getsubstrate.io -sSf | bash -s -- --fast \
-    && rustup component add rustfmt
+curl https://getsubstrate.io -sSf | bash -s -- --fast
+
+rustup component add rustfmt clippy
 
 # TODO: Install additional tools...
-# - b2sum
+# - b2sum