From 9c18557656068cb35048a8f713213570a4177bed Mon Sep 17 00:00:00 2001 From: Sorah Fukumori Date: Thu, 31 Oct 2024 08:14:28 +0900 Subject: [PATCH 1/2] rustls feature --- Cargo.lock | 17 ++++++++++++++++- Cargo.toml | 7 ++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3bbf71c..b52b4a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1171,7 +1171,7 @@ dependencies = [ "hyper 0.14.31", "log", "rustls 0.21.12", - "rustls-native-certs", + "rustls-native-certs 0.6.3", "tokio", "tokio-rustls 0.24.1", ] @@ -1187,6 +1187,7 @@ dependencies = [ "hyper 1.5.0", "hyper-util", "rustls 0.23.15", + "rustls-native-certs 0.8.0", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", @@ -2002,6 +2003,7 @@ dependencies = [ "pin-project-lite", "quinn", "rustls 0.23.15", + "rustls-native-certs 0.8.0", "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", @@ -2108,6 +2110,19 @@ dependencies = [ "security-framework", ] +[[package]] +name = "rustls-native-certs" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" +dependencies = [ + "openssl-probe", + "rustls-pemfile 2.2.0", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" diff --git a/Cargo.toml b/Cargo.toml index 243ef67..91171e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,11 @@ license = "Apache-2.0" [build-dependencies] tonic-build = "0.12.3" +[features] +default = ["native-tls"] +native-tls = ["reqwest/default-tls"] +rustls = ["reqwest/rustls-tls-native-roots"] + [dependencies] anyhow = { version = "1.0.91", features = ["backtrace"] } async-recursion = "1.0.5" @@ -38,7 +43,7 @@ process_path = "0.1.4" prost = "0.13.3" prost-types = "0.13.3" rand = "0.8.5" -reqwest = { version = "0.12.9", features = ["json"] } +reqwest = { version = "0.12.9", default-features = false, features = ["charset", "http2", "macos-system-configuration", "json"] } secrecy = { version = "0.10.0", features = ["serde"] } serde = { version = "1.0.214", features = ["derive"] } serde_json = "1.0.132" From 2a05bd8df7ff63a5568b6df99d3feece4e5f02f8 Mon Sep 17 00:00:00 2001 From: Sorah Fukumori Date: Thu, 31 Oct 2024 07:47:01 +0900 Subject: [PATCH 2/2] ci --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ced31db --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: ci +on: + push: + branches: [main,ci] + pull_request: + +jobs: + test: + name: cargo test + runs-on: ubuntu-latest + strategy: + matrix: + platform: + - target: x86_64-unknown-linux-gnu + features: "default" + - target: x86_64-unknown-linux-musl + features: "rustls" + steps: + - run: sudo apt-get install -y musl-tools + if: "${{ contains(matrix.platform.target, '-musl') }}" + - run: sudo apt-get install -y protobuf-compiler + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: "${{ matrix.platform.target }}" + - run: "cargo test --target ${{ matrix.platform.target }} --no-default-features --features ${{ matrix.platform.features }}" + - run: "cargo build --target ${{ matrix.platform.target }} --no-default-features --features ${{ matrix.platform.features }}"