Skip to content

Commit

Permalink
feat(infra): move to karnot self hosted runner (madara-alliance#273)
Browse files Browse the repository at this point in the history
Signed-off-by: Kratik Jain <[email protected]>
Signed-off-by: Madara <github>
Co-authored-by: Kratik Jain <[email protected]>
Co-authored-by: Madara <github>
  • Loading branch information
apoorvsadana and k4kratik authored Sep 27, 2024
1 parent 85fb08e commit 0be628b
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 23 deletions.
1 change: 0 additions & 1 deletion .env.test

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
changelog:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: dangoslen/changelog-enforcer@v3
with:
Expand Down
22 changes: 16 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,30 @@ name: Task - Integration Tests
on:
workflow_dispatch:
workflow_call:
secrets:
ETH_FORK_URL:
required: true

jobs:
coverage:
permissions:
pull-requests: write
runs-on: self-hosted
runs-on: karnot-arc-runner-set
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2 # use a different cache key as coverae uses custom rustc args
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.78
- name: Setup build deps
run: |
sudo apt-get update
sudo apt-get install -y clang llvm libudev-dev protobuf-compiler
sudo apt-get install -y clang llvm libudev-dev protobuf-compiler gcc g++ build-essential libssl-dev pkg-config curl wget git
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.78

- uses: Swatinem/rust-cache@v2 # use a different cache key as coverae uses custom rustc args
with:
cache-provider: buildjet
key: "coverage"

- uses: rui314/setup-mold@v1
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
Expand All @@ -32,6 +40,8 @@ jobs:
version: nightly

- name: Build and run tests
env:
ETH_FORK_URL: ${{ secrets.ETH_FORK_URL }}
run: |
source <(cargo llvm-cov show-env --export-prefix)
cargo build --bin madara --profile dev
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linters-cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
cargo-lint:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ on:

jobs:
prettier:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run prettier
run: |-
npx prettier --check .
markdown-lint:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: avto-dev/markdown-lint@v1
Expand All @@ -25,7 +25,7 @@ jobs:
ignore: "./target"

toml-lint:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- name: Checkout toml files
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
cleanup:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
1 change: 1 addition & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ jobs:
name: Run Coverage
uses: ./.github/workflows/coverage.yml
needs: changelog
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/rust-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
rust_check:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
rust_test:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
security_audit:
name: Security audit
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
stale:
name: 🧹 Clean up stale issues and PRs
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- name: 🚀 Run stale
uses: actions/stale@v3
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next release

- feat: move to karnot runner
- fix: docker file fixes for devnet
- fix(block-production): fix bouncer calculation and declared classes
- fix: Fix pending block sync and add real FGW tests
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/client/eth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ prometheus = { workspace = true }
httpmock = { workspace = true }
tracing-test = "0.2.5"
serial_test = { workspace = true }
lazy_static = { workspace = true }
7 changes: 5 additions & 2 deletions crates/client/eth/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,19 @@ pub mod eth_client_getter_test {
// https://etherscan.io/tx/0xcadb202495cd8adba0d9b382caff907abf755cd42633d23c4988f875f2995d81#eventlog
// The txn we are referring to it is here ^
const L1_BLOCK_NUMBER: u64 = 20395662;
const FORK_URL: &str = "https://eth.merkle.io";
const ANVIL_PORT: u16 = 8545;
const CORE_CONTRACT_ADDRESS: &str = "0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4";
const L2_BLOCK_NUMBER: u64 = 662703;
const L2_BLOCK_HASH: &str = "563216050958639290223177746678863910249919294431961492885921903486585884664";
const L2_STATE_ROOT: &str = "1456190284387746219409791261254265303744585499659352223397867295223408682130";

lazy_static::lazy_static! {
static ref FORK_URL: String = std::env::var("ETH_FORK_URL").expect("ETH_FORK_URL not set");
}

fn create_anvil_instance() -> AnvilInstance {
let anvil = Anvil::new()
.fork(FORK_URL)
.fork(FORK_URL.clone())
.fork_block_number(L1_BLOCK_NUMBER)
.port(ANVIL_PORT)
.try_spawn()
Expand Down
11 changes: 7 additions & 4 deletions crates/client/eth/src/l1_gas_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,16 @@ mod eth_client_gas_price_worker_test {
use tokio::time::{timeout, Duration};
const ANOTHER_ANVIL_PORT: u16 = 8546;
const L1_BLOCK_NUMBER: u64 = 20395662;
const FORK_URL: &str = "https://eth.merkle.io";

lazy_static::lazy_static! {
static ref FORK_URL: String = std::env::var("ETH_FORK_URL").expect("ETH_FORK_URL not set");
}

#[serial]
#[tokio::test]
async fn gas_price_worker_when_infinite_loop_true_works() {
let anvil = Anvil::new()
.fork(FORK_URL)
.fork(FORK_URL.clone())
.fork_block_number(L1_BLOCK_NUMBER)
.port(ANOTHER_ANVIL_PORT)
.try_spawn()
Expand Down Expand Up @@ -148,7 +151,7 @@ mod eth_client_gas_price_worker_test {
#[tokio::test]
async fn gas_price_worker_when_infinite_loop_false_works() {
let anvil = Anvil::new()
.fork(FORK_URL)
.fork(FORK_URL.clone())
.fork_block_number(L1_BLOCK_NUMBER)
.port(ANOTHER_ANVIL_PORT)
.try_spawn()
Expand Down Expand Up @@ -231,7 +234,7 @@ mod eth_client_gas_price_worker_test {
#[tokio::test]
async fn update_gas_price_works() {
let anvil = Anvil::new()
.fork(FORK_URL)
.fork(FORK_URL.clone())
.fork_block_number(L1_BLOCK_NUMBER)
.port(ANOTHER_ANVIL_PORT)
.try_spawn()
Expand Down

0 comments on commit 0be628b

Please sign in to comment.