Skip to content

Commit 9ef45b8

Browse files
authored
GitHub Actions inplemented
2 parents c5de54e + ad997c3 commit 9ef45b8

File tree

11 files changed

+1382
-1336
lines changed

11 files changed

+1382
-1336
lines changed

.github/workflows/rust.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Install Rust stable
20+
uses: actions-rs/toolchain@v1
21+
with:
22+
toolchain: stable
23+
override: true
24+
25+
- name: Install Rust nightly
26+
uses: actions-rs/toolchain@v1
27+
with:
28+
toolchain: nightly
29+
override: false
30+
31+
- name: Install rustfmt for nightly
32+
run: rustup component add --toolchain nightly rustfmt
33+
34+
- name: Install llvm-tools-preview for stable
35+
run: rustup component add llvm-tools-preview --toolchain stable-x86_64-unknown-linux-gnu
36+
37+
- name: Install dependencies
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y protobuf-compiler
41+
42+
- name: Install Rust dependencies
43+
run: cargo fetch
44+
45+
- name: Build
46+
run: cargo +nightly build --verbose
47+
48+
- name: Run cargo fmt
49+
run: cargo +nightly fmt -- --check
50+
51+
- name: Run cargo clippy
52+
run: cargo +nightly clippy -- -D warnings
53+
54+
- name: Install llvm-cov
55+
uses: taiki-e/install-action@cargo-llvm-cov
56+
57+
- name: Install nextest
58+
uses: taiki-e/install-action@nextest
59+
60+
- name: Run Tests
61+
run: cargo +nightly llvm-cov --cobertura --output-path cobertura.xml nextest
62+
63+
- name: Generate Code Coverage Summary
64+
uses: irongut/CodeCoverageSummary@v1.3.0
65+
with:
66+
filename: cobertura.xml
67+
badge: true
68+
fail_below_min: false
69+
thresholds: '70 85'
70+
output: both
71+
format: markdown
72+
73+
- name: Export Job Summary
74+
run: echo "$(<code-coverage-results.md)" >> $GITHUB_STEP_SUMMARY

indexer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ byte-unit = "4.0.19"
1919
serde = { version = "1.0.162", features = ["derive"] }
2020
zerocopy = "0.7.8"
2121
tracing-log = "0.2.0"
22-
acuity-index-substrate = { path = "../../idn-acuity-index-substrate" }
22+
acuity-index-substrate = { git = "https://github.com/ideal-lab5/idn-acuity-index-substrate", version = "=0.6.2" }

indexer/src/ideal.rs

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use ideal_network_local_metadata::ideal_network_local_metadata::{
2-
runtime_types::{
3-
frame_system::pallet::Event as SystemEvent,
4-
pallet_balances::pallet::Event as BalancesEvent,
5-
// Add other relevant event imports for your ideal network
6-
},
7-
Event,
2+
runtime_types::{
3+
frame_system::pallet::Event as SystemEvent,
4+
pallet_balances::pallet::Event as BalancesEvent,
5+
// Add other relevant event imports for your ideal network
6+
},
7+
Event,
88
};
99

1010
use crate::*;
@@ -14,41 +14,41 @@ use hex_literal::hex;
1414
pub struct IdealIndexer;
1515

1616
impl acuity_index_substrate::shared::RuntimeIndexer for IdealIndexer {
17-
type RuntimeConfig = subxt::PolkadotConfig; // You might need to adjust this based on your chain's configuration
18-
type ChainKey = ChainKey;
19-
20-
fn get_name() -> &'static str {
21-
"ideal"
22-
}
23-
24-
fn get_genesis_hash() -> <Self::RuntimeConfig as subxt::Config>::Hash {
25-
// Replace with your chain's genesis hash
26-
hex!["af97825bf72091072a08b9dbff88d6664e2061bcb4e28a90f17bd85572d8f8ae"].into() // Temporary placeholder
27-
}
28-
29-
fn get_versions() -> &'static [u32] {
30-
&[0]
31-
}
32-
33-
fn get_default_url() -> &'static str {
34-
"ws://127.0.0.1:1234" // Replace with your actual endpoint
35-
}
36-
37-
fn process_event(
38-
indexer: &acuity_index_substrate::substrate::Indexer<Self>,
39-
block_number: u32,
40-
event_index: u16,
41-
event: subxt::events::EventDetails<Self::RuntimeConfig>,
42-
) -> Result<u32, IndexError> {
43-
Ok(match event.as_root_event::<Event>()? {
44-
Event::System(event) => {
45-
index_system_event![SystemEvent, event, indexer, block_number, event_index]
46-
}
47-
Event::Balances(event) => {
48-
index_balances_event![BalancesEvent, event, indexer, block_number, event_index]
49-
}
50-
// Add other event handlers as needed
51-
_ => 0,
52-
})
53-
}
17+
type RuntimeConfig = subxt::PolkadotConfig; // You might need to adjust this based on your chain's configuration
18+
type ChainKey = ChainKey;
19+
20+
fn get_name() -> &'static str {
21+
"ideal"
22+
}
23+
24+
fn get_genesis_hash() -> <Self::RuntimeConfig as subxt::Config>::Hash {
25+
// Replace with your chain's genesis hash
26+
hex!["af97825bf72091072a08b9dbff88d6664e2061bcb4e28a90f17bd85572d8f8ae"].into() // Temporary placeholder
27+
}
28+
29+
fn get_versions() -> &'static [u32] {
30+
&[0]
31+
}
32+
33+
fn get_default_url() -> &'static str {
34+
"ws://127.0.0.1:1234" // Replace with your actual endpoint
35+
}
36+
37+
fn process_event(
38+
indexer: &acuity_index_substrate::substrate::Indexer<Self>,
39+
block_number: u32,
40+
event_index: u16,
41+
event: subxt::events::EventDetails<Self::RuntimeConfig>,
42+
) -> Result<u32, IndexError> {
43+
Ok(match event.as_root_event::<Event>()? {
44+
Event::System(event) => {
45+
index_system_event![SystemEvent, event, indexer, block_number, event_index]
46+
},
47+
Event::Balances(event) => {
48+
index_balances_event![BalancesEvent, event, indexer, block_number, event_index]
49+
},
50+
// Add other event handlers as needed
51+
_ => 0,
52+
})
53+
}
5454
}

0 commit comments

Comments
 (0)