mirror of
https://github.com/anthonyoteri/dredge.git
synced 2026-06-05 15:26:53 -04:00
fix: resolve CI check failures
- Replace serde_yml with serde_norway (RUSTSEC-2025-0068: serde_yml is unsound and archived; serde_norway is the recommended maintained fork) - Remove unused toml dependency (was resolving to v1.1.2 which requires edition2024/Rust 1.85, breaking the MSRV 1.80 check) - Run cargo fmt to fix formatting diffs caught by lint job - Fix cog commit check to use from_latest_tag so pre-conventional-commits history does not cause the check to fail - Remove semver job: dredge is a binary-only crate with no lib target, cargo-semver-checks cannot check it
This commit is contained in:
@@ -69,9 +69,9 @@ jobs:
|
|||||||
uses: cocogitto/cocogitto-action@v3
|
uses: cocogitto/cocogitto-action@v3
|
||||||
with:
|
with:
|
||||||
check: true
|
check: true
|
||||||
# On PRs check only the commits introduced by the PR.
|
# Only check commits reachable from the latest tag so that old
|
||||||
# On pushes to master check only commits since the previous HEAD.
|
# non-conventional commits in history do not fail the check.
|
||||||
from: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
|
from_latest_tag: true
|
||||||
|
|
||||||
deny:
|
deny:
|
||||||
name: Cargo deny
|
name: Cargo deny
|
||||||
@@ -99,23 +99,4 @@ jobs:
|
|||||||
- name: Check MSRV builds
|
- name: Check MSRV builds
|
||||||
run: cargo check
|
run: cargo check
|
||||||
|
|
||||||
semver:
|
|
||||||
name: Semver compatibility
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
# Only meaningful on PRs — compares the PR branch against the published
|
|
||||||
# crate version to catch accidental breaking API changes.
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install stable toolchain
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- name: Cache dependencies
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: Check semver compatibility
|
|
||||||
uses: obi1kenobi/cargo-semver-checks-action@v2
|
|
||||||
with:
|
|
||||||
package: dredge-tool
|
|
||||||
|
|||||||
+1
-2
@@ -33,11 +33,10 @@ indoc = "2.0"
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
reqwest = { version = "0.12", features = ["json", "gzip", "multipart", "native-tls-vendored"] }
|
reqwest = { version = "0.12", features = ["json", "gzip", "multipart", "native-tls-vendored"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_yml = "0.0.12"
|
|
||||||
thiserror = "2.0"
|
thiserror = "2.0"
|
||||||
toml = "1.0"
|
|
||||||
url = { version = "2.5", features = ["serde"] }
|
url = { version = "2.5", features = ["serde"] }
|
||||||
tokio = { version = "1.52", features = ["macros"] }
|
tokio = { version = "1.52", features = ["macros"] }
|
||||||
|
serde_norway = "0.9.42"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
mockito = "1.7"
|
mockito = "1.7"
|
||||||
|
|||||||
+5
-1
@@ -553,7 +553,11 @@ mod tests {
|
|||||||
let registry_url = Url::parse(&server.url()).expect("Failed to parse registry URL");
|
let registry_url = Url::parse(&server.url()).expect("Failed to parse registry URL");
|
||||||
server
|
server
|
||||||
.mock("GET", path)
|
.mock("GET", path)
|
||||||
.with_status(http::status::StatusCode::INTERNAL_SERVER_ERROR.as_u16().into())
|
.with_status(
|
||||||
|
http::status::StatusCode::INTERNAL_SERVER_ERROR
|
||||||
|
.as_u16()
|
||||||
|
.into(),
|
||||||
|
)
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
let url = registry_url.join(path).expect("Failed to join URL");
|
let url = registry_url.join(path).expect("Failed to join URL");
|
||||||
|
|||||||
+2
-4
@@ -192,9 +192,7 @@ pub async fn show_handler(
|
|||||||
let headers = resp.headers();
|
let headers = resp.headers();
|
||||||
let digest = headers
|
let digest = headers
|
||||||
.get("docker-content-digest")
|
.get("docker-content-digest")
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| ApiError::UnexpectedResponse("Missing docker-content-digest header".into()))?
|
||||||
ApiError::UnexpectedResponse("Missing docker-content-digest header".into())
|
|
||||||
})?
|
|
||||||
.to_str()?
|
.to_str()?
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
@@ -216,7 +214,7 @@ pub async fn show_handler(
|
|||||||
body.digest = digest;
|
body.digest = digest;
|
||||||
body.etag = etag;
|
body.etag = etag;
|
||||||
|
|
||||||
serde_yml::to_writer(buf, &body)?;
|
serde_norway::to_writer(buf, &body)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -77,7 +77,7 @@ pub enum ApiError {
|
|||||||
|
|
||||||
/// The manifest response body could not be serialized to YAML for output.
|
/// The manifest response body could not be serialized to YAML for output.
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
SerializerError(#[from] serde_yml::Error),
|
SerializerError(#[from] serde_norway::Error),
|
||||||
|
|
||||||
/// The registry returned `405 Method Not Allowed`, typically because
|
/// The registry returned `405 Method Not Allowed`, typically because
|
||||||
/// storage deletion has not been enabled on the registry.
|
/// storage deletion has not been enabled on the registry.
|
||||||
@@ -100,7 +100,10 @@ mod tests {
|
|||||||
fn test_dredge_error_from_api_error_not_found() {
|
fn test_dredge_error_from_api_error_not_found() {
|
||||||
let api_err = ApiError::NotFound;
|
let api_err = ApiError::NotFound;
|
||||||
let dredge_err = DredgeError::from(api_err);
|
let dredge_err = DredgeError::from(api_err);
|
||||||
assert!(matches!(dredge_err, DredgeError::ApiError(ApiError::NotFound)));
|
assert!(matches!(
|
||||||
|
dredge_err,
|
||||||
|
DredgeError::ApiError(ApiError::NotFound)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Test that `DredgeError::from(ApiError::AuthorizationFailed)` works.
|
/// Test that `DredgeError::from(ApiError::AuthorizationFailed)` works.
|
||||||
|
|||||||
Reference in New Issue
Block a user