From 818f4da5778aa42ca13a3e7807ac1d5b9393be58 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 19:21:45 +1000 Subject: [PATCH 01/31] Add new feature `static` that is enabled by default Signed-off-by: Jiahao XU --- Cargo.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2656b7ff..21bcb282 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ pkg-fmt = "zip" [dependencies] async-trait = "0.1.56" bytes = "1.1.0" -bzip2 = { version = "0.4.3", features = ["static"] } +bzip2 = "0.4.3" cargo_toml = "0.11.4" clap = { version = "3.2.12", features = ["derive"] } crates_io_api = { version = "0.8.0", default-features = false, features = ["rustls"] } @@ -50,7 +50,7 @@ tinytemplate = "1.2.1" tokio = { version = "1.20.0", features = ["rt-multi-thread", "process", "sync"], default-features = false } toml = "0.5.9" url = "2.2.2" -xz2 = { version = "0.1.6", features = ["static"] } +xz2 = "0.1.6" # Disable all features of zip except for features of compression algorithms: # Disabled features include: @@ -69,8 +69,9 @@ zstd = { version = "0.10.0", default-features = false } guess_host_triple = "0.1.3" [features] -default = [] +default = ["static"] mimalloc = ["dep:mimalloc"] +static = ["bzip2/static", "xz2/static"] [dev-dependencies] env_logger = "0.9.0" From 6c09cb05c9f633086a3f3af27bac613168fc15dd Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 19:26:12 +1000 Subject: [PATCH 02/31] Add new feature `pkg-config`: Enable linking with sys packages Signed-off-by: Jiahao XU --- Cargo.lock | 1 + Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 439ec66f..69cca037 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1789,4 +1789,5 @@ checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8" dependencies = [ "cc", "libc", + "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index 21bcb282..d4888739 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,6 +72,7 @@ guess_host_triple = "0.1.3" default = ["static"] mimalloc = ["dep:mimalloc"] static = ["bzip2/static", "xz2/static"] +pkg-config = ["zstd/pkg-config"] [dev-dependencies] env_logger = "0.9.0" From 997d4e4e9d50ac8ddb84b972deb1a0a0e5826a50 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 19:27:37 +1000 Subject: [PATCH 03/31] Run workflow unit-tests with feature pkg-config Signed-off-by: Jiahao XU --- .github/workflows/unit-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index b8bad484..122864c1 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -30,3 +30,4 @@ jobs: uses: actions-rs/cargo@v1 with: command: test + args: --no-default-features --features pkg-config From b22a55f08fb85630244a53ce010a11415da55f60 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 19:37:30 +1000 Subject: [PATCH 04/31] Install lzma, bzip and zstd lib in workflow unit-tests Signed-off-by: Jiahao XU --- .github/workflows/unit-tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 122864c1..3ffcaad1 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -26,6 +26,10 @@ jobs: path: | ${{ env.HOME }}/.cargo target + - name: Insall dependencies + run: | + apt update + apt install -y --no-install-recommends liblzma-dev libzip-dev libzstd-dev - name: test uses: actions-rs/cargo@v1 with: From 1499f5c2018f42aaaa1e7483e3944f1f1723e25d Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 19:40:22 +1000 Subject: [PATCH 05/31] Install lzma, bzip & zstd in integration test CI Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 280efa7e..09244ba1 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -79,6 +79,12 @@ jobs: if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }} run: sudo apt-get install -y musl-tools + - name: Install liblzma-dev, libzip-dev and libzstd-dev + if: ${{ startsWith(matrix.target, 'x86_64-unknown-linux-') }} + run: | + sudo apt update + sudo apt install -y --no-install-recommends liblzma-dev libzip-dev libzstd-dev + - name: Build release uses: actions-rs/cargo@v1 if: ${{ startsWith(github.ref, 'refs/tags/v') }} From 3dbec7718d3a115e7da68a654f2869ef5bdbe52f Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 19:40:56 +1000 Subject: [PATCH 06/31] Fix dep installation in workflow "unit-tests" Signed-off-by: Jiahao XU --- .github/workflows/unit-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 3ffcaad1..3a9b97b8 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -26,10 +26,10 @@ jobs: path: | ${{ env.HOME }}/.cargo target - - name: Insall dependencies + - name: Install liblzma-dev, libzip-dev and libzstd-dev run: | - apt update - apt install -y --no-install-recommends liblzma-dev libzip-dev libzstd-dev + sudo apt update + sudo apt install -y --no-install-recommends liblzma-dev libzip-dev libzstd-dev - name: test uses: actions-rs/cargo@v1 with: From c2349a15cbcc00f537eee65d6937adaf07c08081 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 19:42:18 +1000 Subject: [PATCH 07/31] Install lzma, bzip & zstd only on debug build in integration test CI Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 09244ba1..33689ba3 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -80,7 +80,7 @@ jobs: run: sudo apt-get install -y musl-tools - name: Install liblzma-dev, libzip-dev and libzstd-dev - if: ${{ startsWith(matrix.target, 'x86_64-unknown-linux-') }} + if: ${{ startsWith(matrix.target, 'x86_64-unknown-linux-') && !startsWith(github.ref, 'refs/tags/v') }} run: | sudo apt update sudo apt install -y --no-install-recommends liblzma-dev libzip-dev libzstd-dev From 74dd3b6c70911370eb30aea35bddb70918d294fc Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 19:42:50 +1000 Subject: [PATCH 08/31] Build debug with feature pkg-config in integration test CI Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 33689ba3..2ec73789 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -98,7 +98,7 @@ jobs: if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} with: command: build - args: --target ${{ matrix.target }} + args: --target ${{ matrix.target }} --no-default-features --features pkg-config use-cross: ${{ matrix.use-cross }} - name: Copy and rename utility From 8a32ab5dd3d5c5013eb0145ba307198fe10da2f2 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 19:47:02 +1000 Subject: [PATCH 09/31] Refactor: Extract `ci-scripts/install-deps.sh` Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 6 ++---- .github/workflows/unit-tests.yml | 6 ++---- ci-scripts/install-deps.sh | 6 ++++++ 3 files changed, 10 insertions(+), 8 deletions(-) create mode 100755 ci-scripts/install-deps.sh diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 2ec73789..9dc8f91b 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -79,11 +79,9 @@ jobs: if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }} run: sudo apt-get install -y musl-tools - - name: Install liblzma-dev, libzip-dev and libzstd-dev + - name: Install deps if: ${{ startsWith(matrix.target, 'x86_64-unknown-linux-') && !startsWith(github.ref, 'refs/tags/v') }} - run: | - sudo apt update - sudo apt install -y --no-install-recommends liblzma-dev libzip-dev libzstd-dev + run: sudo ./ci-scripts/install-deps.sh - name: Build release uses: actions-rs/cargo@v1 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 3a9b97b8..5b9a86b4 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -26,10 +26,8 @@ jobs: path: | ${{ env.HOME }}/.cargo target - - name: Install liblzma-dev, libzip-dev and libzstd-dev - run: | - sudo apt update - sudo apt install -y --no-install-recommends liblzma-dev libzip-dev libzstd-dev + - name: Install deps + run: sudo ./ci-scripts/install-deps.sh - name: test uses: actions-rs/cargo@v1 with: diff --git a/ci-scripts/install-deps.sh b/ci-scripts/install-deps.sh new file mode 100755 index 00000000..085c3286 --- /dev/null +++ b/ci-scripts/install-deps.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -euxo pipefail + +apt update +exec apt install -y --no-install-recommends liblzma-dev libzip-dev libzstd-dev From adbc2d4a110cba4d6030db031ce897bab2d0fc00 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 19:56:42 +1000 Subject: [PATCH 10/31] Disable feature `pkg-config` for cross compilation. Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 9dc8f91b..b450f0ef 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -91,13 +91,20 @@ jobs: args: --target ${{ matrix.target }} --release use-cross: ${{ matrix.use-cross }} + - name: Build debug with cross compilation + uses: actions-rs/cargo@v1 + if: ${{ ! startsWith(github.ref, 'refs/tags/v') && matrix.use-cross == 'true' }} + with: + command: build + args: --target ${{ matrix.target }} --no-default-features + use-cross: true + - name: Build debug uses: actions-rs/cargo@v1 if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} with: command: build args: --target ${{ matrix.target }} --no-default-features --features pkg-config - use-cross: ${{ matrix.use-cross }} - name: Copy and rename utility if: ${{ startsWith(github.ref, 'refs/tags/v') }} From f2d5d0291b38379948e4398f12a827073f9afeef Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 20:01:09 +1000 Subject: [PATCH 11/31] Always disable feature pkg-config in integration test CI Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index b450f0ef..b570a8eb 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -91,20 +91,13 @@ jobs: args: --target ${{ matrix.target }} --release use-cross: ${{ matrix.use-cross }} - - name: Build debug with cross compilation - uses: actions-rs/cargo@v1 - if: ${{ ! startsWith(github.ref, 'refs/tags/v') && matrix.use-cross == 'true' }} - with: - command: build - args: --target ${{ matrix.target }} --no-default-features - use-cross: true - - name: Build debug uses: actions-rs/cargo@v1 if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} with: command: build - args: --target ${{ matrix.target }} --no-default-features --features pkg-config + args: --target ${{ matrix.target }} --no-default-features + use-cross: ${{ matrix.use-cross }} - name: Copy and rename utility if: ${{ startsWith(github.ref, 'refs/tags/v') }} From 6fe2762f115ca591f8daa7d9d86dfc2c4cf1b599 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 20:26:28 +1000 Subject: [PATCH 12/31] Add new feature zlib-ng (enabeld by default) Signed-off-by: Jiahao XU --- Cargo.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d4888739..84e93bd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ cargo_toml = "0.11.4" clap = { version = "3.2.12", features = ["derive"] } crates_io_api = { version = "0.8.0", default-features = false, features = ["rustls"] } dirs = "4.0.0" -flate2 = { version = "1.0.24", features = ["zlib-ng"], default-features = false } +flate2 = { version = "1.0.24", default-features = false } fs4 = "0.6.2" futures-util = { version = "0.3.21", default-features = false } home = "0.5.3" @@ -69,10 +69,11 @@ zstd = { version = "0.10.0", default-features = false } guess_host_triple = "0.1.3" [features] -default = ["static"] +default = ["static", "zlib-ng"] mimalloc = ["dep:mimalloc"] static = ["bzip2/static", "xz2/static"] pkg-config = ["zstd/pkg-config"] +zlib-ng = ["flate2/zlib-ng"] [dev-dependencies] env_logger = "0.9.0" From 162e4838d8f1877382a1894308d96bd61bdfa22f Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 20:32:12 +1000 Subject: [PATCH 13/31] Add new feature rustls (enabled by default) Signed-off-by: Jiahao XU --- Cargo.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 84e93bd5..8df059e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ bytes = "1.1.0" bzip2 = "0.4.3" cargo_toml = "0.11.4" clap = { version = "3.2.12", features = ["derive"] } -crates_io_api = { version = "0.8.0", default-features = false, features = ["rustls"] } +crates_io_api = { version = "0.8.0", default-features = false } dirs = "4.0.0" flate2 = { version = "1.0.24", default-features = false } fs4 = "0.6.2" @@ -35,7 +35,7 @@ log = "0.4.14" miette = { version = "5.1.1", features = ["fancy-no-backtrace"] } mimalloc = { version = "0.1.29", default-features = false, optional = true } once_cell = "1.13.0" -reqwest = { version = "0.11.11", features = ["rustls-tls", "stream"], default-features = false } +reqwest = { version = "0.11.11", features = ["stream"], default-features = false } scopeguard = "1.1.0" semver = "1.0.12" serde = { version = "1.0.139", features = ["derive"] } @@ -69,11 +69,12 @@ zstd = { version = "0.10.0", default-features = false } guess_host_triple = "0.1.3" [features] -default = ["static", "zlib-ng"] +default = ["static", "zlib-ng", "rustls"] mimalloc = ["dep:mimalloc"] static = ["bzip2/static", "xz2/static"] pkg-config = ["zstd/pkg-config"] zlib-ng = ["flate2/zlib-ng"] +rustls = ["crates_io_api/rustls", "reqwest/rustls-tls"] [dev-dependencies] env_logger = "0.9.0" From 0150e229aa6de27eda50692c78e2b68fc5b81da6 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 20:33:41 +1000 Subject: [PATCH 14/31] Add new feature native-tls Signed-off-by: Jiahao XU --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 8df059e2..352a5278 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,6 +75,7 @@ static = ["bzip2/static", "xz2/static"] pkg-config = ["zstd/pkg-config"] zlib-ng = ["flate2/zlib-ng"] rustls = ["crates_io_api/rustls", "reqwest/rustls-tls"] +native-tls = ["reqwest/native-tls"] [dev-dependencies] env_logger = "0.9.0" From f7caeea0e66892bfc003521885e026016b38886b Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 20:34:13 +1000 Subject: [PATCH 15/31] Enable feature native-tls in unit-tests Signed-off-by: Jiahao XU --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 5b9a86b4..f385c1a4 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -32,4 +32,4 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --no-default-features --features pkg-config + args: --no-default-features --features pkg-config,native-tls From 8e10c0d3561fb4a9ee181d6900a66e661324e252 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 20:35:46 +1000 Subject: [PATCH 16/31] Enable feature `native-tls` in debug build in integration CI when not doing cross compilation Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index b570a8eb..2541c8d7 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -93,11 +93,18 @@ jobs: - name: Build debug uses: actions-rs/cargo@v1 - if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} + if: ${{ ! startsWith(github.ref, 'refs/tags/v') && use-cross == 'false' }} with: command: build - args: --target ${{ matrix.target }} --no-default-features - use-cross: ${{ matrix.use-cross }} + args: --target ${{ matrix.target }} --no-default-features --features native-tls + + - name: Build debug with cross compilation + uses: actions-rs/cargo@v1 + if: ${{ ! startsWith(github.ref, 'refs/tags/v') && use-cross == 'true' }} + with: + command: build + args: --target ${{ matrix.target }} --no-default-features --features rustls + use-cross: true - name: Copy and rename utility if: ${{ startsWith(github.ref, 'refs/tags/v') }} From 00f60c18b4bb70b9047432a4d2c1ffbb71116e89 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 20:36:23 +1000 Subject: [PATCH 17/31] Enable feature pkg-config in debug build of integration CI when not doing cross compilation. Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 2541c8d7..dd50ca78 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -96,7 +96,7 @@ jobs: if: ${{ ! startsWith(github.ref, 'refs/tags/v') && use-cross == 'false' }} with: command: build - args: --target ${{ matrix.target }} --no-default-features --features native-tls + args: --target ${{ matrix.target }} --no-default-features --features pkg-config,native-tls - name: Build debug with cross compilation uses: actions-rs/cargo@v1 From d3bd11c1823b89c8389dc6754c432281918d4d7b Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 20:36:46 +1000 Subject: [PATCH 18/31] Improve readability of features in `Cargo.toml` Signed-off-by: Jiahao XU --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 352a5278..b69d3385 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,10 +70,14 @@ guess_host_triple = "0.1.3" [features] default = ["static", "zlib-ng", "rustls"] + mimalloc = ["dep:mimalloc"] + static = ["bzip2/static", "xz2/static"] pkg-config = ["zstd/pkg-config"] + zlib-ng = ["flate2/zlib-ng"] + rustls = ["crates_io_api/rustls", "reqwest/rustls-tls"] native-tls = ["reqwest/native-tls"] From bdef2169a30129d6fb155917e1ad6acfa7258e6f Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 20:38:18 +1000 Subject: [PATCH 19/31] Fix typo in integration test CI Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index dd50ca78..e8cdd5c0 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -93,14 +93,14 @@ jobs: - name: Build debug uses: actions-rs/cargo@v1 - if: ${{ ! startsWith(github.ref, 'refs/tags/v') && use-cross == 'false' }} + if: ${{ ! startsWith(github.ref, 'refs/tags/v') && matrix.use-cross == 'false' }} with: command: build args: --target ${{ matrix.target }} --no-default-features --features pkg-config,native-tls - name: Build debug with cross compilation uses: actions-rs/cargo@v1 - if: ${{ ! startsWith(github.ref, 'refs/tags/v') && use-cross == 'true' }} + if: ${{ ! startsWith(github.ref, 'refs/tags/v') && matrix.use-cross == 'true' }} with: command: build args: --target ${{ matrix.target }} --no-default-features --features rustls From 272d049cf6c269a87e0619f24fd19b6574dcfeaf Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 20:40:24 +1000 Subject: [PATCH 20/31] Fix cond in integration test CI Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index e8cdd5c0..54c6d37d 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -93,14 +93,14 @@ jobs: - name: Build debug uses: actions-rs/cargo@v1 - if: ${{ ! startsWith(github.ref, 'refs/tags/v') && matrix.use-cross == 'false' }} + if: ${{ ! startsWith(github.ref, 'refs/tags/v') && matrix.use-cross }} with: command: build args: --target ${{ matrix.target }} --no-default-features --features pkg-config,native-tls - name: Build debug with cross compilation uses: actions-rs/cargo@v1 - if: ${{ ! startsWith(github.ref, 'refs/tags/v') && matrix.use-cross == 'true' }} + if: ${{ ! startsWith(github.ref, 'refs/tags/v') && matrix.use-cross }} with: command: build args: --target ${{ matrix.target }} --no-default-features --features rustls From 1df00e5ba873289d3b66e13cc5a41161b7534cbd Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 21:29:41 +1000 Subject: [PATCH 21/31] Enable native-tls on non-cross build & pkg-config on x86_64 linux gnu Signed-off-by: Jiahao XU --- .../workflows/build-and-integration-tests.yml | 16 +- Cargo.lock | 159 ++++++++++++++++++ 2 files changed, 165 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 54c6d37d..ffa44bad 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -23,21 +23,25 @@ jobs: output: cargo-binstall use-cross: false test: true + debug_build_args: --features pkg-config,native-tls - target: x86_64-apple-darwin os: macos-latest output: cargo-binstall use-cross: false test: true + debug_build_args: --features native-tls - target: aarch64-apple-darwin os: macos-latest output: cargo-binstall use-cross: false test: false + debug_build_args: --features native-tls - target: x86_64-pc-windows-msvc os: windows-latest output: cargo-binstall.exe use-cross: false test: false + debug_build_args: --features native-tls - target: x86_64-unknown-linux-musl os: ubuntu-latest output: cargo-binstall @@ -93,18 +97,10 @@ jobs: - name: Build debug uses: actions-rs/cargo@v1 - if: ${{ ! startsWith(github.ref, 'refs/tags/v') && matrix.use-cross }} + if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} with: command: build - args: --target ${{ matrix.target }} --no-default-features --features pkg-config,native-tls - - - name: Build debug with cross compilation - uses: actions-rs/cargo@v1 - if: ${{ ! startsWith(github.ref, 'refs/tags/v') && matrix.use-cross }} - with: - command: build - args: --target ${{ matrix.target }} --no-default-features --features rustls - use-cross: true + args: --target ${{ matrix.target }} --no-default-features ${{ matrix.debug_build_args }} - name: Copy and rename utility if: ${{ startsWith(github.ref, 'refs/tags/v') }} diff --git a/Cargo.lock b/Cargo.lock index 69cca037..410ea2e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -223,6 +223,22 @@ dependencies = [ "cc", ] +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + [[package]] name = "crates_io_api" version = "0.8.0" @@ -360,6 +376,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.0.1" @@ -619,6 +650,19 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "idna" version = "0.2.3" @@ -826,6 +870,24 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "native-tls" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -870,6 +932,51 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" +[[package]] +name = "openssl" +version = "0.10.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "os_str_bytes" version = "6.1.0" @@ -1010,11 +1117,13 @@ dependencies = [ "http-body", "hyper", "hyper-rustls", + "hyper-tls", "ipnet", "js-sys", "lazy_static", "log", "mime", + "native-tls", "percent-encoding", "pin-project-lite", "rustls", @@ -1023,6 +1132,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "tokio", + "tokio-native-tls", "tokio-rustls", "tokio-util", "tower-service", @@ -1096,6 +1206,16 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +[[package]] +name = "schannel" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +dependencies = [ + "lazy_static", + "windows-sys", +] + [[package]] name = "scopeguard" version = "1.1.0" @@ -1112,6 +1232,29 @@ dependencies = [ "untrusted", ] +[[package]] +name = "security-framework" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.12" @@ -1410,6 +1553,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.23.4" @@ -1530,6 +1683,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" From 450facd260c2441ce272aabd94350b35063f0718 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 21:31:19 +1000 Subject: [PATCH 22/31] Install deps only on x86_64 linux gnu Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index ffa44bad..d084adbf 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -84,7 +84,7 @@ jobs: run: sudo apt-get install -y musl-tools - name: Install deps - if: ${{ startsWith(matrix.target, 'x86_64-unknown-linux-') && !startsWith(github.ref, 'refs/tags/v') }} + if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && !startsWith(github.ref, 'refs/tags/v') }} run: sudo ./ci-scripts/install-deps.sh - name: Build release From 6e1f930c8eab39bbc134ef5598a2e4755ef449ff Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 21:38:58 +1000 Subject: [PATCH 23/31] Disable native-tls for x86_64 linux-gnu and apple-darwin Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index d084adbf..0da06e02 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -23,13 +23,12 @@ jobs: output: cargo-binstall use-cross: false test: true - debug_build_args: --features pkg-config,native-tls + debug_build_args: --features pkg-config - target: x86_64-apple-darwin os: macos-latest output: cargo-binstall use-cross: false test: true - debug_build_args: --features native-tls - target: aarch64-apple-darwin os: macos-latest output: cargo-binstall From 018196de453b72d67548145ca4121c5d571b8292 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 21:40:16 +1000 Subject: [PATCH 24/31] Disable default features only when debug_build_args is overriden Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 0da06e02..30a0a7c8 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -23,7 +23,7 @@ jobs: output: cargo-binstall use-cross: false test: true - debug_build_args: --features pkg-config + debug_build_args: --no-default-features --features pkg-config - target: x86_64-apple-darwin os: macos-latest output: cargo-binstall @@ -34,13 +34,13 @@ jobs: output: cargo-binstall use-cross: false test: false - debug_build_args: --features native-tls + debug_build_args: --no-default-features --features native-tls - target: x86_64-pc-windows-msvc os: windows-latest output: cargo-binstall.exe use-cross: false test: false - debug_build_args: --features native-tls + debug_build_args: --no-default-features --features native-tls - target: x86_64-unknown-linux-musl os: ubuntu-latest output: cargo-binstall @@ -99,7 +99,7 @@ jobs: if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} with: command: build - args: --target ${{ matrix.target }} --no-default-features ${{ matrix.debug_build_args }} + args: --target ${{ matrix.target }} ${{ matrix.debug_build_args }} - name: Copy and rename utility if: ${{ startsWith(github.ref, 'refs/tags/v') }} From 026aefb5a7410ab62a8677401052b074ce3d3138 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 21:40:38 +1000 Subject: [PATCH 25/31] Enable rustls for x86_64-unknown-linux-gnu Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 30a0a7c8..6c5b2842 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -23,7 +23,7 @@ jobs: output: cargo-binstall use-cross: false test: true - debug_build_args: --no-default-features --features pkg-config + debug_build_args: --no-default-features --features rustls,pkg-config - target: x86_64-apple-darwin os: macos-latest output: cargo-binstall From 291269f50f0ba27b86361d4cadbc79b096208e98 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 21:52:22 +1000 Subject: [PATCH 26/31] Fix "Build debug": Add back `use-cross` Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 6c5b2842..27044909 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -100,6 +100,7 @@ jobs: with: command: build args: --target ${{ matrix.target }} ${{ matrix.debug_build_args }} + use-cross: ${{ matrix.use-cross }} - name: Copy and rename utility if: ${{ startsWith(github.ref, 'refs/tags/v') }} From 82aa893306587999d9711e6c8861f8e14b0423c9 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 22:00:53 +1000 Subject: [PATCH 27/31] Disable feature static & zlib-ng on x86_64-apple-darwin Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 27044909..ad1a01e6 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -29,6 +29,7 @@ jobs: output: cargo-binstall use-cross: false test: true + debug_build_args: --no-default-features --features rustls - target: aarch64-apple-darwin os: macos-latest output: cargo-binstall From 23139e9db5a7d8cfda525f4de79e59a16f0cea2e Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 22:02:19 +1000 Subject: [PATCH 28/31] Use rustls on debug for aarch64-apple-darwin Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index ad1a01e6..1af3cfa0 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -35,7 +35,7 @@ jobs: output: cargo-binstall use-cross: false test: false - debug_build_args: --no-default-features --features native-tls + debug_build_args: --no-default-features --features rustls - target: x86_64-pc-windows-msvc os: windows-latest output: cargo-binstall.exe From b33a606109bf3dbe60be5bb43f785440f6f704ec Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 22:03:39 +1000 Subject: [PATCH 29/31] Use native-tls for x86_64-pc-windows-msvc on release Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index 1af3cfa0..ab8a90dd 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -42,6 +42,7 @@ jobs: use-cross: false test: false debug_build_args: --no-default-features --features native-tls + release_build_args: --no-default-features --features static,zlib-ng,native-tls - target: x86_64-unknown-linux-musl os: ubuntu-latest output: cargo-binstall @@ -92,7 +93,7 @@ jobs: if: ${{ startsWith(github.ref, 'refs/tags/v') }} with: command: build - args: --target ${{ matrix.target }} --release + args: --target ${{ matrix.target }} --release ${{ matrix.release_build_args }} use-cross: ${{ matrix.use-cross }} - name: Build debug From 18e0730afbf5689f0a0be193dab90da4a0363da6 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 22:12:00 +1000 Subject: [PATCH 30/31] Disable static and zlib-ng on cross compilation Signed-off-by: Jiahao XU --- .github/workflows/build-and-integration-tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-integration-tests.yml b/.github/workflows/build-and-integration-tests.yml index ab8a90dd..fb4ef2e9 100644 --- a/.github/workflows/build-and-integration-tests.yml +++ b/.github/workflows/build-and-integration-tests.yml @@ -48,18 +48,21 @@ jobs: output: cargo-binstall use-cross: false test: true + debug_build_args: --no-default-features --features rustls - target: armv7-unknown-linux-musleabihf os: ubuntu-20.04 output: cargo-binstall use-cross: true test: false + debug_build_args: --no-default-features --features rustls - target: aarch64-unknown-linux-musl os: ubuntu-latest output: cargo-binstall use-cross: true test: false - runs-on: ${{ matrix.os }} + debug_build_args: --no-default-features --features rustls + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - uses: FranzDiebold/github-env-vars-action@v1.2.1 From 788bb85b8f54540861b28f71fc4dfb22b1a238bf Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 23 Jul 2022 22:26:05 +1000 Subject: [PATCH 31/31] Use zig-cc for `cross` Signed-off-by: Jiahao XU --- Cross.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cross.toml b/Cross.toml index a384d49c..7b36bf82 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,11 +1,11 @@ [target.armv7-unknown-linux-gnueabihf] -image = "ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf@sha256:379eee7aa254912a803b558fe0742450dd32ca9749bc8b931927dafa2ce6e8d3" +zig = true [target.armv7-unknown-linux-musleabihf] -image = "ghcr.io/cross-rs/armv7-unknown-linux-musleabihf@sha256:00088ebbb98f5d9895c2b6e7f713cd3028331185fe82f60d93efc03bdff8ea65" +zig = true [target.aarch64-unknown-linux-gnu] -image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu@sha256:5db2a92c73d1251c5fb9de895928ef2551c08d0ec30b969cf7340ca3dd62ea81" +zig = true [target.aarch64-unknown-linux-musl] -image = "ghcr.io/cross-rs/aarch64-unknown-linux-musl@sha256:341256c185132fff9265ee7c8d94ba9b4fde3e8cfa8b39047c0e64ba4c1faf9a" +zig = true