Skip to content

Commit

Permalink
Merge branch 'add-registry-validate' into add-ipfs-uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
warittornc committed Oct 3, 2024
2 parents d62bd01 + 44fb651 commit 3522c4e
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 2,622 deletions.
File renamed without changes.
Empty file.
31 changes: 31 additions & 0 deletions .github/scripts/validate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env rust-script
//! ```cargo
//! [dependencies]
//! serde_json = "1.0.128"
//! bothan-core = "0.0.1-alpha.3"
//! ```
use std::env;
use std::fs::File;
use std::io::BufReader;
use std::path::Path;

use bothan_core::registry::{Invalid, Registry};

fn main() {
let args = env::args().collect::<Vec<String>>();
if args.len() != 2 {
eprintln!("unexpected arguments: {:?}", args);
std::process::exit(1);
}

let path = Path::new(args[1].as_str());
let registry: Registry<Invalid> = {
let file = File::open(path).expect("Failed to open registry file");
let reader = BufReader::new(file);
serde_json::from_reader(reader).expect("Failed to parse registry file")
};
registry.validate().expect("Registry is invalid");

println!("Registry is valid");
}
50 changes: 50 additions & 0 deletions .github/workflows/aggregate_signals.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Aggregate Signals

on:
push:

jobs:
aggregate-signal:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11.2'

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml
- name: Aggregate Signals
run: python .github/scripts/merge_all.py ./signals .

- name: Cache Rust-Script
uses: actions/cache@v4
with:
path: ~/.cache/rust-script
key: ${{ runner.os }}-rust-script-${{ hashFiles('.github/scripts/validate.rs') }}
restore-keys: |
${{ runner.os }}-rust-script-${{ hashFiles('.github/scripts/validate.rs') }}
- name: Setup Rust Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install Rust Script
run: cargo install rust-script

- name: Install Dependencies
run: sudo apt update && sudo apt-get install clang -y

- name: Validate Aggregated Signals
run: .github/scripts/validate.rs registry.json

- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: aggregated signals
4 changes: 0 additions & 4 deletions CS.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -9456,10 +9456,6 @@
{
"source_id": "coinmarketcap",
"id": "2563"
},
{
"source_id": "kraken",
"id": "TUSD/USD"
}
],
"processor": {
Expand Down
1 change: 0 additions & 1 deletion registry_validator/.gitignore

This file was deleted.

Loading

0 comments on commit 3522c4e

Please sign in to comment.