Skip to content

Commit

Permalink
Merge pull request #28 from willemolding/willem/migrate-to-reqwest
Browse files Browse the repository at this point in the history
add pages deployment action
  • Loading branch information
willemolding authored Apr 15, 2024
2 parents f3dc07b + 1ef6a5f commit 517d624
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 4 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Deploy

on:
workflow_dispatch:
release:
types: [published]

permissions:
contents: write

defaults:
run:
working-directory: bridge-frontend


jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
yarn
yarn build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build # The folder the action should deploy.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ apt install -y --no-install-recommends \
ca-certificates=20230311ubuntu0.22.04.1 \
g++-riscv64-linux-gnu=4:11.2.0--1ubuntu1 \
wget=1.21.2-2ubuntu1 \
libclang-dev
libclang-dev \
libssl-dev pkg-config
EOF
# libclang needed to build rocksdb. Can remove once this is no longer needed.
# libssl-dev and pkg-config needed to use reqwest

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
Expand Down
5 changes: 4 additions & 1 deletion fullnode.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ apt install -y --no-install-recommends \
build-essential=12.9ubuntu3 \
ca-certificates=20230311ubuntu0.22.04.1 \
wget=1.21.2-2ubuntu1 \
libclang-dev
libclang-dev \
libssl-dev pkg-config
EOF
# libclang needed to build rocksdb. Can remove once this is no longer needed.
# libssl-dev and pkg-config needed to use reqwest

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async fn main() -> Result<(), anyhow::Error> {
.expect("Failed to start the rollup server");

#[cfg(feature = "listen-graphql")]
tower_cartesi::listen_graphql(&mut cartezcash_app, &server_addr, 10)
tower_cartesi::listen_graphql(&mut cartezcash_app, &server_addr, 10, std::time::Duration::from_secs(5))
.await
.expect("Failed to start the rollup server");

Expand Down
1 change: 1 addition & 0 deletions tower-cartesi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ reqwest = { version = "0.12.3", features = ["json"] }
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.115"
thiserror = "1.0.58"
tokio = { version = "1.32", features = ["time"] }
tower-service = "0.3.2"
tracing = "0.1.40"

Expand Down
6 changes: 5 additions & 1 deletion tower-cartesi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use thiserror::Error;
use tower_service::Service;
use tokio::time::interval;

mod messages;
mod request;
Expand Down Expand Up @@ -74,14 +75,16 @@ pub async fn listen_graphql<S>(
service: &mut S,
host_uri: &str,
page_size: usize,
frequency: std::time::Duration,
) -> Result<(), Error<S::Error>>
where
S: Service<Request, Response = Response>,
{
// let client = hyper::Client::new();
let client = reqwest::Client::new();
let mut cursor = None;

let mut interval = interval(frequency);

loop {
let request_body = InputsQuery::build_query(inputs_query::Variables {
first: page_size as i64,
Expand All @@ -97,5 +100,6 @@ where
.await
.map_err(Error::ServiceError)?;
}
interval.tick().await;
}
}

0 comments on commit 517d624

Please sign in to comment.