Skip to content

Commit

Permalink
feat: Fix nightly builds and add to CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsantell committed Oct 31, 2023
1 parent b5640b2 commit ade2f21
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 12 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/run_test_suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,33 +39,43 @@ jobs:
run-linting-linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- toolchain: stable
- toolchain: nightly
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: 'Setup Rust'
run: |
curl -sSf https://sh.rustup.rs | sh -s -- -y
rustup component add clippy
rustup component add rustfmt
rustup toolchain install ${{matrix.toolchain}}
rustup +${{matrix.toolchain}} component add clippy
rustup +${{matrix.toolchain}} component add rustfmt
- name: 'Install environment packages'
run: |
sudo apt-get update -qqy
sudo apt-get install jq protobuf-compiler cmake
- name: 'Check Format'
run: cargo fmt --all -- --check
run: cargo +${{matrix.toolchain}} fmt --all -- --check
- name: 'Run Linter'
run: cargo clippy --all -- -D warnings
run: cargo +${{matrix.toolchain}} clippy --all -- -D warnings

run-rust-test-suite:
name: 'Run Rust test suite'
strategy:
matrix:
features: ['test-kubo,headers', 'test-kubo,headers,rocksdb']
platform: ['ubuntu-latest', 'windows-latest', 'macos-13']
toolchain: ['stable']
toolchain: ['stable', 'nightly']
exclude:
- platform: 'windows-latest'
features: 'test-kubo,headers,rocksdb'
- platform: 'macos-13'
toolchain: 'nightly'
- platform: 'windows-latest'
toolchain: 'nightly'
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
Expand Down
9 changes: 5 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion rust/noosphere-gateway/src/handlers/v0alpha2/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub async fn push_route<C, S>(
stream: BodyStream,
) -> Result<StreamBody<impl Stream<Item = Result<Bytes, std::io::Error>>>, GatewayErrorResponse>
where
C: HasMutableSphereContext<S>,
for<'a> C: HasMutableSphereContext<S> + 'a,
S: Storage + 'static,
{
debug!("Invoking push route...");
Expand Down
3 changes: 2 additions & 1 deletion rust/noosphere/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ features = [
]

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
safer-ffi = { version = "0.1.2", features = ["proc_macros", "python-headers"] }
safer-ffi = { version = "0.1.4", features = ["proc_macros", "python-headers"] }
tokio = { workspace = true, features = ["full"] }

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
Expand All @@ -92,3 +92,4 @@ gloo-timers = { workspace = true }

[build-dependencies]
cfg_aliases = "0.1.0"
rustc_version = "0.4.0"
20 changes: 20 additions & 0 deletions rust/noosphere/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
use cfg_aliases::cfg_aliases;
use rustc_version::{version_meta, Channel};

fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-env-changed=RUSTC");

// Enables `#[cfg(channel = "nightly")]` configuration.
match version_meta().unwrap().channel {
Channel::Stable => {
println!("cargo:rustc-cfg=channel=\"stable\"");
}
Channel::Beta => {
println!("cargo:rustc-cfg=channel=\"beta\"");
}
Channel::Nightly => {
println!("cargo:rustc-cfg=channel=\"nightly\"");
}
Channel::Dev => {
println!("cargo:rustc-cfg=channel=\"dev\"");
}
}

cfg_aliases! {
// Platforms
wasm: { target_arch = "wasm32" },
Expand Down
10 changes: 9 additions & 1 deletion rust/noosphere/src/ffi/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
// TODO(getditto/safer_ffi#181): Re-enable this lint
#![allow(clippy::incorrect_clone_impl_on_copy_type, non_snake_case)]
// Note different linting rules in nightly.
#![cfg_attr(
not(channel = "nightly"),
allow(clippy::incorrect_clone_impl_on_copy_type, non_snake_case)
)]
#![cfg_attr(
channel = "nightly",
allow(clippy::non_canonical_clone_impl, non_snake_case)
)]

//! This module defins a C FFI for Noosphere, suitable for cross-language
//! embedding on many different targets
Expand Down

0 comments on commit ade2f21

Please sign in to comment.