diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 529de50f2..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,16 +0,0 @@ -orbs: - path-filtering: circleci/path-filtering@0.1.3 -setup: true -version: 2.1 -workflows: - check: - jobs: - - path-filtering/filter: - base-revision: master - config-path: .circleci/then.yml - mapping: | - node/.* node true - crates/.* crates true - pallets/.* pallets true - runtime/.* runtime true - name: check-updated-files diff --git a/.circleci/then.yml b/.circleci/then.yml deleted file mode 100644 index 7d0fd1f4a..000000000 --- a/.circleci/then.yml +++ /dev/null @@ -1,192 +0,0 @@ -commands: - fmt-lint: - steps: - - run: - name: Format and lint. - command: | - curl -LsSf https://github.com/tamasfe/taplo/releases/download/0.8.0/taplo-full-linux-x86_64.gz | gunzip -N -d - > ${CARGO_HOME:-~/.cargo}/bin/taplo && chmod +x ${CARGO_HOME:-~/.cargo}/bin/taplo - cargo fmt --check - taplo fmt --check - cargo clippy -- -D warnings - check-licenses: - steps: - - run: - name: Check licenses (`cargo-deny`). - command: | - cargo install --locked cargo-deny - cargo deny --all-features check license - increase-swap: - steps: - - run: - name: Increase swap. - command: | - sudo swapoff -a - sudo dd if=/dev/zero of=/swapfile bs=1G count=8 - sudo chmod 0600 /swapfile - sudo mkswap /swapfile - sudo swapon /swapfile - grep Swap /proc/meminfo - install-dependencies: - steps: - - run: - name: Install dependencies. - command: | - sudo sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf - sudo apt-get update - sudo apt install -y libssl-dev clang libclang-dev tor && sudo systemctl start tor && sudo systemctl enable tor - sudo apt install -y yarn - install-rust: - steps: - - run: - name: Install Rust. - command: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - source "$HOME/.cargo/env" - rustup update stable - rustup target add wasm32-unknown-unknown - rustup component add rust-src - install-wasm-pack: - steps: - - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - install-dependencies-and-checkout: - steps: - - install-dependencies - - checkout - - install-dependencies - - install-rust - - install-wasm-pack - new-cmd: - steps: - - run: echo test - build: - steps: - - run: cargo build --release - comment-on-pr: - steps: - - run: | - sudo apt-get install jq - pr_response=$(curl --location --request GET "https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls?head=$CIRCLE_PROJECT_USERNAME:$CIRCLE_BRANCH&state=open" \ - -u $GH_USER:$GH_TOKEN) - if [ $(echo $pr_response | jq length) -eq 0 ]; then - echo "No PR found to update" - else - pr_comment_url=$(echo $pr_response | jq -r ".[]._links.comments.href") - fi - echo curl --location --request POST "$pr_comment_url" \ - -u $GH_USER:$GH_TOKEN \ - --header 'Content-Type: application/json' \ - --data-raw "'{ - \"body\": \"$(cat pr-comment)\" - }'" - -jobs: - threshold-signature-server: - machine: - image: ubuntu-2204:2022.10.2 - resource_class: xlarge - steps: - - install-dependencies-and-checkout - - run: cd crates/threshold-signature-server && cargo test --release - fmt-lint-all: - machine: - image: ubuntu-2204:2022.10.2 - resource_class: xlarge - steps: - - install-dependencies-and-checkout - - fmt-lint - - check-licenses - node-benchmark: - machine: - image: ubuntu-2204:2022.10.2 - resource_class: xlarge - steps: - - install-dependencies-and-checkout - - run: pushd node && cargo check --features=runtime-benchmarks - node-test: - machine: - image: ubuntu-2204:2022.10.2 - resource_class: xlarge - steps: - - increase-swap - - install-dependencies-and-checkout - - run: - name: Build entropy-protocol nodejs package. - command: | - cd crates/protocol - make build-nodejs-testing - cd nodejs-test - yarn - cd ../../.. - - run: - command: | - pushd node - cargo build --all-targets --release -j $(nproc) - cargo test --all-targets --release - yarn --cwd ../crates/protocol/nodejs-test test - cargo test -p entropy-tss --release --features=test_helpers -F wasm_test test_wasm - no_output_timeout: 45m - build-and-release: - machine: - image: ubuntu-2204:2022.10.2 - resource_class: xlarge - steps: - - increase-swap - - install-dependencies-and-checkout - - build - - release - check-doc-build: - machine: - image: ubuntu-2204:2022.10.2 - resource_class: xlarge - steps: - - install-dependencies-and-checkout - - run: cargo doc --no-deps - check-chainspecs: - machine: - image: ubuntu-2204:2022.10.2 - resource_class: xlarge - steps: - - install-dependencies-and-checkout - - run: - command: | - cargo run -p entropy -- build-spec --raw --chain dev > chainspec-dev-raw.json - cargo run -p entropy -- build-spec --raw --chain integration-tests > chainspec-integration-raw.json - cargo run -p entropy -- build-spec --raw --chain testnet > chainspec-testnet-raw.json - - -parameters: - crates: - default: false - type: boolean - node: - default: false - type: boolean - pallets: - default: false - type: boolean - runtime: - default: false - type: boolean -version: 2.1 -workflows: - lint: - jobs: - - fmt-lint-all - test: - jobs: - - node-benchmark - build: - jobs: - - node-test - when: - or: - - << pipeline.parameters.node >> - - << pipeline.parameters.pallets >> - - << pipeline.parameters.runtime >> - - pipeline.parameters.crates - chainspecs: - jobs: - - check-chainspecs - documentation: - jobs: - - check-doc-build diff --git a/.github/actions/install-dependencies/action.yaml b/.github/actions/install-dependencies/action.yaml new file mode 100644 index 000000000..d20c73922 --- /dev/null +++ b/.github/actions/install-dependencies/action.yaml @@ -0,0 +1,20 @@ +--- +name: 'Install Dependencies' +description: 'Install the dependencies and Rust components used across jobs' +runs: + using: "composite" + steps: + - name: Install dependencies + run: | + sudo sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf + sudo apt-get update + sudo apt install -y libssl-dev clang libclang-dev protobuf-compiler + shell: bash + - name: Add Rust components + run: | + rustup target add wasm32-unknown-unknown + rustup component add rust-src + shell: bash + - name: Install wasm-pack + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + shell: bash diff --git a/.github/workflows/build-and-run-node-test.yaml b/.github/workflows/build-and-run-node-test.yaml new file mode 100644 index 000000000..0c28340f6 --- /dev/null +++ b/.github/workflows/build-and-run-node-test.yaml @@ -0,0 +1,39 @@ +--- +name: "Build and test" +on: + push: + paths: + - "node/**" + - "crates/**" + - "pallets/**" + - "runtime/**" + +jobs: + node-test: + runs-on: core-build-runner + steps: + - uses: actions/checkout@v4 + - name: Increase swap + run: | + sudo swapoff -a + sudo dd if=/dev/zero of=/swapfile bs=1G count=8 + sudo chmod 0600 /swapfile + sudo mkswap /swapfile + sudo swapon /swapfile + grep Swap /proc/meminfo + - name: Install dependencies + uses: ./.github/actions/install-dependencies/ + - name: Build entropy-protocol nodejs package + run: | + cd crates/protocol + make build-nodejs-testing + cd nodejs-test + yarn + cd ../../.. + - name: Run `cargo build && cargo test` + run: | + pushd node + cargo build --all-targets --release -j $(nproc) + cargo test --all-targets --release + yarn --cwd ../crates/protocol/nodejs-test test + cargo test -p entropy-tss --release --features=test_helpers -F wasm_test test_wasm diff --git a/.github/workflows/check-chainspecs.yaml b/.github/workflows/check-chainspecs.yaml new file mode 100644 index 000000000..998a127d3 --- /dev/null +++ b/.github/workflows/check-chainspecs.yaml @@ -0,0 +1,17 @@ +--- +name: "Check chainspecs" +on: ["push"] + +jobs: + check-chainspecs: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/install-dependencies/ + - name: Check chainspecs + run: | + cargo run -p entropy -- build-spec --raw --chain dev > chainspec-dev-raw.json + cargo run -p entropy -- build-spec --raw --chain integration-tests > chainspec-integration-raw.json + cargo run -p entropy -- build-spec --raw --chain testnet > chainspec-testnet-raw.json diff --git a/.github/workflows/check-doc-build.yaml b/.github/workflows/check-doc-build.yaml new file mode 100644 index 000000000..9dd989e75 --- /dev/null +++ b/.github/workflows/check-doc-build.yaml @@ -0,0 +1,14 @@ +--- +name: "Check documentation build" +on: ["push"] + +jobs: + check-doc-build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/install-dependencies/ + - name: Build documentation + run: cargo doc --no-deps \ No newline at end of file diff --git a/.github/workflows/lint-and-check-licenses.yaml b/.github/workflows/lint-and-check-licenses.yaml new file mode 100644 index 000000000..1fc0144a8 --- /dev/null +++ b/.github/workflows/lint-and-check-licenses.yaml @@ -0,0 +1,27 @@ +--- +name: "Lint and check licenses" +on: ["push"] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/install-dependencies/ + - name: Format and lint + run: | + curl -LsSf https://github.com/tamasfe/taplo/releases/download/0.8.0/taplo-full-linux-x86_64.gz | gunzip -N -d - > ${CARGO_HOME:-~/.cargo}/bin/taplo && chmod +x ${CARGO_HOME:-~/.cargo}/bin/taplo + cargo fmt --check + taplo fmt --check + cargo clippy -- -D warnings + check-licenses: + runs-on: ubuntu-22.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Check licenses with cargo deny + run: | + cargo install --locked cargo-deny + cargo deny --all-features check license diff --git a/.github/workflows/test-runtime-benchmarks.yaml b/.github/workflows/test-runtime-benchmarks.yaml new file mode 100644 index 000000000..c3978a559 --- /dev/null +++ b/.github/workflows/test-runtime-benchmarks.yaml @@ -0,0 +1,14 @@ +name: "Test: check runtime benchmarks" +on: ["push"] + +jobs: + test-runtime-benchmarks: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/install-dependencies/ + - name: Check runtime-benchmarks + run: | + pushd node && cargo check --features=runtime-benchmarks diff --git a/crates/README.md b/crates/README.md index e483180d7..217f848f9 100644 --- a/crates/README.md +++ b/crates/README.md @@ -2,7 +2,7 @@ This directory contains the [Threshold Signature Server](https://github.com/entropyxyz/entropy-core/tree/master/crates/threshold-signature-server) and some utility crates related to it: -- [`shared`](https://github.com/entropyxyz/entropy-core/tree/master/crates/shared) - Common types shared by both the chain node and TSS server +- [`shared`](https://github.com/entropyxyz/entropy-core/tree/master/crates/shared) - Common types shared by the chain node and TSS server - [`kvdb`](https://github.com/entropyxyz/entropy-core/tree/master/crates/kvdb) - An encrypted key-value datastore - [`protocol`](https://github.com/entropyxyz/entropy-core/tree/master/crates/protocol) - Transport logic for running the Entropy protocols - [`testing-utils`](https://github.com/entropyxyz/entropy-core/tree/master/crates/testing-utils) - Testing utility methods shared across the workspace