diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 75615ce..07a80fb 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -28,7 +28,7 @@ # https://github.com/oxidize-rb/actions/blob/main/fetch-ci-data/evaluate.rb#L54 exclude: [arm-linux, x64-mingw32, x64-mingw-ucrt, aarch64-linux-musl] stable-ruby-versions: | - only: ['3.2', '3.3', '3.4'] + only: ['3.2', '3.3', '3.4', '4.0'] build: name: Build native gems diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a25da81..ad553f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: stable-ruby-versions: | # Explicitly include all Ruby versions we want to support # to ensure binaries are built for each version - only: ['3.2', '3.3', '3.4'] + only: ['3.2', '3.3', '3.4', '4.0'] rspec: runs-on: ${{ matrix.os }} needs: ci-data diff --git a/Cargo.lock b/Cargo.lock index d2859a0..02aa48e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -193,7 +193,7 @@ dependencies = [ "codeowners", "magnus", "rb-sys", - "rb-sys-env 0.2.2", + "rb-sys-env", "serde", "serde_magnus", ] @@ -494,21 +494,21 @@ dependencies = [ [[package]] name = "magnus" -version = "0.7.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d87ae53030f3a22e83879e666cb94e58a7bdf31706878a0ba48752994146dab" +checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012" dependencies = [ "magnus-macros", "rb-sys", - "rb-sys-env 0.1.2", + "rb-sys-env", "seq-macro", ] [[package]] name = "magnus-macros" -version = "0.6.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3" +checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892" dependencies = [ "proc-macro2", "quote", @@ -670,12 +670,6 @@ dependencies = [ "syn 2.0.106", ] -[[package]] -name = "rb-sys-env" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb" - [[package]] name = "rb-sys-env" version = "0.2.2" @@ -811,9 +805,9 @@ dependencies = [ [[package]] name = "serde_magnus" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b8b945a2dadb221f1c5490cfb411cab6c3821446b8eca50ee07e5a3893ec51" +checksum = "c4a5121544138e6a14036e48ecbe589fb63577f35620caaa32642257b412c317" dependencies = [ "magnus", "serde", diff --git a/ext/code_ownership/Cargo.toml b/ext/code_ownership/Cargo.toml index 5ec2816..6654191 100644 --- a/ext/code_ownership/Cargo.toml +++ b/ext/code_ownership/Cargo.toml @@ -14,9 +14,9 @@ rb-sys = { version = "0.9.111", features = [ "bindgen-deprecated-types", "stable-api-compiled-fallback", ] } -magnus = { version = "0.7.1" } +magnus = { version = "0.8" } serde = { version = "1.0.219", features = ["derive"] } -serde_magnus = "0.9.0" +serde_magnus = "0.10" codeowners = { git = "https://github.com/rubyatscale/codeowners-rs.git", tag = "v0.3.0" } [dev-dependencies] diff --git a/ext/code_ownership/src/lib.rs b/ext/code_ownership/src/lib.rs index 1e3ad14..ecea1e4 100644 --- a/ext/code_ownership/src/lib.rs +++ b/ext/code_ownership/src/lib.rs @@ -12,13 +12,13 @@ pub struct Team { pub reasons: Vec, } -fn for_team(team_name: String) -> Result { +fn for_team(ruby: &Ruby, team_name: String) -> Result { let run_config = build_run_config(); let team = runner::for_team(&run_config, &team_name); - validate_result(&team) + validate_result(ruby, &team) } -fn teams_for_files(file_paths: Vec) -> Result { +fn teams_for_files(ruby: &Ruby, file_paths: Vec) -> Result { let run_config = build_run_config(); let path_teams = runner::teams_for_files_from_codeowners(&run_config, &file_paths); match path_teams { @@ -35,14 +35,14 @@ fn teams_for_files(file_paths: Vec) -> Result { teams_map.insert(path, None); } } - let serialized: Value = serialize(&teams_map)?; + let serialized: Value = serialize(ruby, &teams_map)?; Ok(serialized) } - Err(e) => Err(Error::new(magnus::exception::runtime_error(), e.to_string())), + Err(e) => Err(Error::new(ruby.exception_runtime_error(), e.to_string())), } } -fn for_file(file_path: String) -> Result, Error> { +fn for_file(ruby: &Ruby, file_path: String) -> Result, Error> { let run_config = build_run_config(); match runner::file_owner_for_file(&run_config, &file_path) { @@ -57,14 +57,14 @@ fn for_file(file_path: String) -> Result, Error> { .map(|source| source.to_string()) .collect(), }; - let serialized: Value = serialize(&team)?; + let serialized: Value = serialize(ruby, &team)?; Ok(Some(serialized)) } else { Ok(None) } } Err(e) => Err(Error::new( - magnus::exception::runtime_error(), + ruby.exception_runtime_error(), e.to_string(), )), } @@ -74,33 +74,33 @@ fn version() -> String { runner::version() } -fn validate(files: Option>) -> Result { +fn validate(ruby: &Ruby, files: Option>) -> Result { let run_config = build_run_config(); let files_vec = files.unwrap_or_default(); let run_result = runner::validate(&run_config, files_vec); - validate_result(&run_result) + validate_result(ruby, &run_result) } -fn generate_and_validate(files: Option>, skip_stage: bool) -> Result { +fn generate_and_validate(ruby: &Ruby, files: Option>, skip_stage: bool) -> Result { let run_config = build_run_config(); let files_vec = files.unwrap_or_default(); let run_result = runner::generate_and_validate(&run_config, files_vec, skip_stage); - validate_result(&run_result) + validate_result(ruby, &run_result) } -fn validate_result(run_result: &runner::RunResult) -> Result { +fn validate_result(ruby: &Ruby, run_result: &runner::RunResult) -> Result { if !run_result.validation_errors.is_empty() { Err(Error::new( - magnus::exception::runtime_error(), + ruby.exception_runtime_error(), run_result.validation_errors.join("\n"), )) } else if !run_result.io_errors.is_empty() { Err(Error::new( - magnus::exception::runtime_error(), + ruby.exception_runtime_error(), run_result.io_errors.join("\n"), )) } else { - let serialized: Value = serialize(&run_result.info_messages)?; + let serialized: Value = serialize(ruby, &run_result.info_messages)?; Ok(serialized) } }