Skip to content

Commit

Permalink
Fixing CI (#693)
Browse files Browse the repository at this point in the history
* Delete workflows

* Revert "Delete workflows"

This reverts commit bb84ec3.

* Disable cache

* Remove cargo-sort + re-enable cache

* Update RUST_VERSION - this should invalidate cache

* Fixes

* Fix stuck tests
  • Loading branch information
Dzejkop authored Feb 13, 2024
1 parent 0181a3c commit 326be75
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- main

env:
RUST_VERSION: "1.73"
RUST_VERSION: "1.74.0-nightly"
NIGHTLY_VERSION: nightly-2023-08-29
CARGO_TERM_COLOR: always
# Skip incremental build and debug info generation in CI
Expand Down Expand Up @@ -48,18 +48,11 @@ jobs:
target/
key: ${{ env.RUST_VERSION }}-${{ env.NIGHTLY_VERSION }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ env.RUST_VERSION }}-${{ env.NIGHTLY_VERSION }}-cargo-lint-
- name: Install cargo-sort
uses: actions-rs/[email protected]
with:
crate: cargo-sort
version: latest
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Check Cargo.toml formatting
run: cargo sort --check --check-format
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::Arc;

use ethers::types::transaction::eip2718::TypedTransaction;
use ethers::types::Address;
pub use read::{EventError, ReadProvider};
pub use read::ReadProvider;
use tracing::instrument;
pub use write::TxError;

Expand Down
6 changes: 5 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ async fn list_batch_sizes(
Ok((result.to_response_code(), Json(result)))
}

async fn health() -> Result<(), Error> {
Ok(())
}

/// # Errors
///
/// Will return `Err` if `options.server` URI is not http, incorrectly includes
Expand Down Expand Up @@ -164,7 +168,7 @@ pub async fn bind_from_listener(
.route("/removeBatchSize", post(remove_batch_size))
.route("/listBatchSizes", get(list_batch_sizes))
// Health check, return 200 OK
.route("/health", get(()))
.route("/health", get(health))
.layer(middleware::from_fn(
custom_middleware::api_metrics_layer::middleware,
))
Expand Down
8 changes: 6 additions & 2 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ mod chain_mock;
mod prover_mock;
pub mod test_config;

#[allow(unused)]
pub mod prelude {
pub use std::time::Duration;

Expand Down Expand Up @@ -598,14 +599,13 @@ pub async fn spawn_app(config: Config) -> anyhow::Result<(JoinHandle<()>, Socket
let listener = TcpListener::bind(server_config.address).expect("Failed to bind random port");
let local_addr = listener.local_addr()?;

info!("Waiting for tree initialization");
// For our tests to work we need the tree to be initialized.
while app.tree_state().is_err() {
trace!("Waiting for the tree to be initialized");
tokio::time::sleep(Duration::from_millis(250)).await;
}

check_health(&local_addr).await?;

let app = spawn({
async move {
info!("App thread starting");
Expand All @@ -616,6 +616,10 @@ pub async fn spawn_app(config: Config) -> anyhow::Result<(JoinHandle<()>, Socket
}
});

info!("Checking app health");
check_health(&local_addr).await?;
info!("App ready");

Ok((app, local_addr))
}

Expand Down

0 comments on commit 326be75

Please sign in to comment.