Skip to content

Commit

Permalink
ci: use k8 self-hosted runners
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksuss committed Nov 13, 2024
1 parent 6562440 commit 2dc25bc
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 47 deletions.
70 changes: 41 additions & 29 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,61 @@ on:

name: Lints
jobs:
fmt:
name: Format
runs-on: [ self-hosted, light ]
rust:
name: Run ${{ matrix.command }}
runs-on: k8s-infrastructure-native
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
- 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: k8s-infrastructure-native
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: 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
33 changes: 23 additions & 10 deletions .github/workflows/scheduled_lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
on:
schedule:
- cron: '0 9 * * 1-5'

name: Scheduled checks
jobs:
tests:
Expand All @@ -15,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 @@ -41,11 +39,11 @@ jobs:
- name: Setup Node and cache
uses: actions/setup-node@v4
with:
node-version: 16
cache: 'yarn'
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 @@ -62,13 +60,28 @@ jobs:

checks:
name: Run checks
runs-on: [ self-hosted, heavy ]
runs-on: k8s-infrastructure-native
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: 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()
Expand Down
31 changes: 26 additions & 5 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: k8s-infrastructure-dind
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 @@ -35,10 +43,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
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: k8s-infrastructure-native
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: 3 additions & 2 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ args = [

[tasks.udeps]
category = "Check"
env = { "CARGO_MAKE_RUST_CHANNEL" = "nightly", "CARGO_MAKE_CRATE_INSTALLATION_LOCKED" = "true" }
install_crate = { crate_name = "cargo-udeps", binary = "cargo", min_version = "0.1.41", test_arg = ["udeps", "-h"], force = true }
env = { "CARGO_MAKE_CRATE_INSTALLATION_LOCKED" = "true" }
toolchain = "nightly"
install_crate = { crate_name = "cargo-udeps", binary = "cargo", min_version = "0.1.52", test_arg = ["udeps", "-h"], force = true }
command = "${CARGO}"
args = [
"udeps",
Expand Down
1 change: 1 addition & 0 deletions engine-tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(stable_features)]
#![feature(lazy_cell)]
#![deny(clippy::pedantic, clippy::nursery)]
#![allow(clippy::unreadable_literal, clippy::module_name_repetitions)]
Expand Down
2 changes: 1 addition & 1 deletion engine/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ impl<'env, I: IO + Copy, E: Env, H: ReadOnlyPromiseHandler> StackExecutorParams<
) -> executor::stack::StackExecutor<
'static,
'a,
executor::stack::MemoryStackState<Engine<'env, I, E, M>>,
executor::stack::MemoryStackState<'a, 'static, Engine<'env, I, E, M>>,
Precompiles<'env, I, E, H>,
> {
let metadata = executor::stack::StackSubstateMetadata::new(self.gas_limit, CONFIG);
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

0 comments on commit 2dc25bc

Please sign in to comment.