diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml index eb3dadade..c056930c8 100644 --- a/.github/workflows/lints.yml +++ b/.github/workflows/lints.yml @@ -8,64 +8,61 @@ on: name: Lints jobs: - fmt: - name: Format - runs-on: [ self-hosted, light ] + rust: + name: Run ${{ matrix.command }} + runs-on: selfhosted + container: ubuntu:20.04 + strategy: + fail-fast: false + matrix: + command: [ check-fmt, clippy, udeps ] steps: - name: Potential broken submodules fix run: | git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || : - name: Clone the repository uses: actions/checkout@v4 - - name: Run cargo fmt - run: cargo make check-fmt - clippy: - name: Clippy - runs-on: [ self-hosted, heavy ] - steps: - - name: Potential broken submodules fix - run: | - git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || : - - name: Clone the repository - uses: actions/checkout@v4 - - name: Update Node and Yarn - run: | - export NVM_DIR="$HOME/.nvm" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - nvm install 18 && nvm alias default 18 - npm install -g yarn - echo "$(dirname $(nvm which node))" >> $GITHUB_PATH - - name: Build contracts - run: cargo make build-contracts - - name: Run Contract cargo clippy - run: cargo make clippy - udeps: - name: Udeps - runs-on: [ self-hosted, heavy ] - steps: - - name: Potential broken submodules fix - run: | - git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || : - - name: Clone the repository - uses: actions/checkout@v4 - - name: Run udeps - run: cargo make udeps + - name: Install dependencies + run: scripts/ci-deps/native.sh + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + cache: false + toolchain: stable,nightly + override: false + - name: Install cargo-make + run: cargo +stable make -V || cargo +stable install cargo-make + - name: Run ${{ matrix.command }} + run: cargo make ${{ matrix.command }} + contracts: name: Contracts - runs-on: [ self-hosted, light ] + runs-on: selfhosted + container: ubuntu:20.04 steps: - name: Potential broken submodules fix run: | git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || : - name: Clone the repository uses: actions/checkout@v4 - - name: Update Node and Yarn - run: | - export NVM_DIR="$HOME/.nvm" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - nvm install 18 && nvm alias default 18 - npm install -g yarn - echo "$(dirname $(nvm which node))" >> $GITHUB_PATH + - name: Install dependencies + run: scripts/ci-deps/native.sh + - name: Setup Node and cache + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + cache-dependency-path: | + etc/eth-contracts/yarn.lock + etc/tests/uniswap/yarn.lock + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + cache: false + toolchain: stable + override: false + - name: Install cargo-make + run: cargo +stable make -V || cargo +stable install cargo-make - name: Run yarn lint run: cargo make check-contracts - name: Check committed EvmErc20.bin diff --git a/.github/workflows/scheduled_lints.yml b/.github/workflows/scheduled_lints.yml index b5ea54742..88e9433a0 100644 --- a/.github/workflows/scheduled_lints.yml +++ b/.github/workflows/scheduled_lints.yml @@ -7,7 +7,7 @@ name: Scheduled checks jobs: tests: name: Run tests - runs-on: github-hosted-heavy-runner + runs-on: selfhosted strategy: fail-fast: false matrix: @@ -16,13 +16,10 @@ jobs: - name: Potential broken submodules fix run: | git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || : - - name: Install dependencies - run: | - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list - sudo apt update && sudo apt install -y yarn build-essential pkg-config libclang-dev libssl-dev - name: Clone the repository uses: actions/checkout@v4 + - name: Install dependencies + run: scripts/ci-deps/dind.sh - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: @@ -45,8 +42,8 @@ jobs: node-version: 18 cache: yarn cache-dependency-path: | - etc/eth-contracts - etc/tests/uniswap + etc/eth-contracts/yarn.lock + etc/tests/uniswap/yarn.lock - name: Install cargo-make run: cargo +stable make -V || cargo +stable install cargo-make - name: Build actual neard-sandbox @@ -63,22 +60,29 @@ jobs: checks: name: Run checks - runs-on: [ self-hosted, heavy ] + runs-on: selfhosted + container: ubuntu:20.04 steps: - name: Potential broken submodules fix run: | git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || : - name: Clone the repository uses: actions/checkout@v4 - - name: Update Node and Yarn - run: | - export NVM_DIR="$HOME/.nvm" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - nvm install 18 && nvm alias default 18 - npm install -g yarn - echo "$(dirname $(nvm which node))" >> $GITHUB_PATH - - name: Run checks - run: cargo make check + - name: Install dependencies + run: scripts/ci-deps/native.sh + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + cache: false + toolchain: stable,nightly + override: false + - name: Install cargo-make + run: cargo +stable make -V || cargo +stable install cargo-make + - name: Setup Node and cache + uses: actions/setup-node@v4 + with: + node-version: 18 + - run: cargo make check - uses: 8398a7/action-slack@v3 if: failure() with: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4a50f44ff..ebc0289ee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ name: Tests jobs: test: name: Test suite ${{ matrix.profile }} - runs-on: github-hosted-heavy-runner + runs-on: selfhosted-heavy strategy: fail-fast: false matrix: @@ -21,6 +21,14 @@ jobs: git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || : - name: Clone the repository uses: actions/checkout@v4 + - name: Install dependencies + run: scripts/ci-deps/dind.sh + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + cache: false + toolchain: stable + override: false - name: Cargo Cache uses: actions/cache@v4 with: @@ -37,8 +45,8 @@ jobs: node-version: 18 cache: yarn cache-dependency-path: | - etc/eth-contracts - etc/tests/uniswap + etc/eth-contracts/yarn.lock + etc/tests/uniswap/yarn.lock - name: Install dependencies run: cargo +stable make -V || cargo +stable install cargo-make - name: Build main contract @@ -58,7 +66,8 @@ jobs: test_modexp: name: Test modexp suite ${{ matrix.profile }} - runs-on: github-hosted-heavy-runner + runs-on: selfhosted-heavy + container: ubuntu:20.04 strategy: fail-fast: false matrix: @@ -69,6 +78,14 @@ jobs: git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || : - name: Clone the repository uses: actions/checkout@v4 + - name: Install dependencies + run: scripts/ci-deps/native.sh + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + cache: false + toolchain: stable + override: false - name: Cargo Cache uses: actions/cache@v4 with: @@ -81,6 +98,10 @@ jobs: key: ${{ matrix.profile }}-cargo-modexp-test - name: Install dependencies run: cargo +stable make -V || cargo +stable install cargo-make + - name: Setup Node and cache + uses: actions/setup-node@v4 + with: + node-version: 18 - name: Test ${{ matrix.profile }} bench-modexp run: cargo make --profile ${{ matrix.profile }} bench-modexp diff --git a/scripts/ci-deps/dind.sh b/scripts/ci-deps/dind.sh new file mode 100755 index 000000000..d0e853148 --- /dev/null +++ b/scripts/ci-deps/dind.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - +echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list +sudo apt update && sudo apt install -y yarn build-essential pkg-config libclang-dev libssl-dev diff --git a/scripts/ci-deps/native.sh b/scripts/ci-deps/native.sh new file mode 100755 index 000000000..d74b916b0 --- /dev/null +++ b/scripts/ci-deps/native.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +export DEBIAN_FRONTEND=noninteractive + +apt update +apt install -y build-essential pkg-config libclang-dev libssl-dev gnupg curl git +curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - +echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list +apt update +apt install -y yarn +yarn install