Skip to content
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

ci: use k8 self-hosted runners #974

Draft
wants to merge 15 commits into
base: develop
Choose a base branch
from
Draft
85 changes: 41 additions & 44 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 22 additions & 18 deletions .github/workflows/scheduled_lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand Down
29 changes: 25 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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

Expand Down
5 changes: 5 additions & 0 deletions scripts/ci-deps/dind.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions scripts/ci-deps/native.sh
Original file line number Diff line number Diff line change
@@ -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
Loading