Merge pull request #230 from NobodyXu/speedup-ci

Speedup ci by using liblzma-dev, libzip and libzstd provided by `apt`
This commit is contained in:
Jiahao XU 2022-07-23 22:48:51 +10:00 committed by GitHub
commit 00a56dc899
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 203 additions and 13 deletions

View file

@ -23,38 +23,46 @@ jobs:
output: cargo-binstall output: cargo-binstall
use-cross: false use-cross: false
test: true test: true
debug_build_args: --no-default-features --features rustls,pkg-config
- target: x86_64-apple-darwin - target: x86_64-apple-darwin
os: macos-latest os: macos-latest
output: cargo-binstall output: cargo-binstall
use-cross: false use-cross: false
test: true test: true
debug_build_args: --no-default-features --features rustls
- target: aarch64-apple-darwin - target: aarch64-apple-darwin
os: macos-latest os: macos-latest
output: cargo-binstall output: cargo-binstall
use-cross: false use-cross: false
test: false test: false
debug_build_args: --no-default-features --features rustls
- target: x86_64-pc-windows-msvc - target: x86_64-pc-windows-msvc
os: windows-latest os: windows-latest
output: cargo-binstall.exe output: cargo-binstall.exe
use-cross: false use-cross: false
test: 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 - target: x86_64-unknown-linux-musl
os: ubuntu-latest os: ubuntu-latest
output: cargo-binstall output: cargo-binstall
use-cross: false use-cross: false
test: true test: true
debug_build_args: --no-default-features --features rustls
- target: armv7-unknown-linux-musleabihf - target: armv7-unknown-linux-musleabihf
os: ubuntu-20.04 os: ubuntu-20.04
output: cargo-binstall output: cargo-binstall
use-cross: true use-cross: true
test: false test: false
debug_build_args: --no-default-features --features rustls
- target: aarch64-unknown-linux-musl - target: aarch64-unknown-linux-musl
os: ubuntu-latest os: ubuntu-latest
output: cargo-binstall output: cargo-binstall
use-cross: true use-cross: true
test: false test: false
runs-on: ${{ matrix.os }} debug_build_args: --no-default-features --features rustls
runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: FranzDiebold/github-env-vars-action@v1.2.1 - uses: FranzDiebold/github-env-vars-action@v1.2.1
@ -79,12 +87,16 @@ jobs:
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }} if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
run: sudo apt-get install -y musl-tools run: sudo apt-get install -y musl-tools
- name: Install deps
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && !startsWith(github.ref, 'refs/tags/v') }}
run: sudo ./ci-scripts/install-deps.sh
- name: Build release - name: Build release
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
if: ${{ startsWith(github.ref, 'refs/tags/v') }} if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with: with:
command: build command: build
args: --target ${{ matrix.target }} --release args: --target ${{ matrix.target }} --release ${{ matrix.release_build_args }}
use-cross: ${{ matrix.use-cross }} use-cross: ${{ matrix.use-cross }}
- name: Build debug - name: Build debug
@ -92,7 +104,7 @@ jobs:
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
with: with:
command: build command: build
args: --target ${{ matrix.target }} args: --target ${{ matrix.target }} ${{ matrix.debug_build_args }}
use-cross: ${{ matrix.use-cross }} use-cross: ${{ matrix.use-cross }}
- name: Copy and rename utility - name: Copy and rename utility

View file

@ -26,7 +26,10 @@ jobs:
path: | path: |
${{ env.HOME }}/.cargo ${{ env.HOME }}/.cargo
target target
- name: Install deps
run: sudo ./ci-scripts/install-deps.sh
- name: test - name: test
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: test command: test
args: --no-default-features --features pkg-config,native-tls

160
Cargo.lock generated
View file

@ -223,6 +223,22 @@ dependencies = [
"cc", "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]] [[package]]
name = "crates_io_api" name = "crates_io_api"
version = "0.8.0" version = "0.8.0"
@ -360,6 +376,21 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 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]] [[package]]
name = "form_urlencoded" name = "form_urlencoded"
version = "1.0.1" version = "1.0.1"
@ -619,6 +650,19 @@ dependencies = [
"tokio-rustls", "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]] [[package]]
name = "idna" name = "idna"
version = "0.2.3" version = "0.2.3"
@ -826,6 +870,24 @@ dependencies = [
"windows-sys", "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]] [[package]]
name = "num-integer" name = "num-integer"
version = "0.1.45" version = "0.1.45"
@ -870,6 +932,51 @@ version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" 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]] [[package]]
name = "os_str_bytes" name = "os_str_bytes"
version = "6.1.0" version = "6.1.0"
@ -1010,11 +1117,13 @@ dependencies = [
"http-body", "http-body",
"hyper", "hyper",
"hyper-rustls", "hyper-rustls",
"hyper-tls",
"ipnet", "ipnet",
"js-sys", "js-sys",
"lazy_static", "lazy_static",
"log", "log",
"mime", "mime",
"native-tls",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rustls", "rustls",
@ -1023,6 +1132,7 @@ dependencies = [
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"tokio", "tokio",
"tokio-native-tls",
"tokio-rustls", "tokio-rustls",
"tokio-util", "tokio-util",
"tower-service", "tower-service",
@ -1096,6 +1206,16 @@ version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" 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]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.1.0" version = "1.1.0"
@ -1112,6 +1232,29 @@ dependencies = [
"untrusted", "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]] [[package]]
name = "semver" name = "semver"
version = "1.0.12" version = "1.0.12"
@ -1410,6 +1553,16 @@ dependencies = [
"winapi", "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]] [[package]]
name = "tokio-rustls" name = "tokio-rustls"
version = "0.23.4" version = "0.23.4"
@ -1530,6 +1683,12 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.4" version = "0.9.4"
@ -1789,4 +1948,5 @@ checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
"pkg-config",
] ]

View file

@ -21,12 +21,12 @@ pkg-fmt = "zip"
[dependencies] [dependencies]
async-trait = "0.1.56" async-trait = "0.1.56"
bytes = "1.1.0" bytes = "1.1.0"
bzip2 = { version = "0.4.3", features = ["static"] } bzip2 = "0.4.3"
cargo_toml = "0.11.4" cargo_toml = "0.11.4"
clap = { version = "3.2.12", features = ["derive"] } 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" 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" fs4 = "0.6.2"
futures-util = { version = "0.3.21", default-features = false } futures-util = { version = "0.3.21", default-features = false }
home = "0.5.3" home = "0.5.3"
@ -35,7 +35,7 @@ log = "0.4.14"
miette = { version = "5.1.1", features = ["fancy-no-backtrace"] } miette = { version = "5.1.1", features = ["fancy-no-backtrace"] }
mimalloc = { version = "0.1.29", default-features = false, optional = true } mimalloc = { version = "0.1.29", default-features = false, optional = true }
once_cell = "1.13.0" 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" scopeguard = "1.1.0"
semver = "1.0.12" semver = "1.0.12"
serde = { version = "1.0.139", features = ["derive"] } serde = { version = "1.0.139", features = ["derive"] }
@ -50,7 +50,7 @@ tinytemplate = "1.2.1"
tokio = { version = "1.20.0", features = ["rt-multi-thread", "process", "sync"], default-features = false } tokio = { version = "1.20.0", features = ["rt-multi-thread", "process", "sync"], default-features = false }
toml = "0.5.9" toml = "0.5.9"
url = "2.2.2" 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: # Disable all features of zip except for features of compression algorithms:
# Disabled features include: # Disabled features include:
@ -69,9 +69,18 @@ zstd = { version = "0.10.0", default-features = false }
guess_host_triple = "0.1.3" guess_host_triple = "0.1.3"
[features] [features]
default = [] default = ["static", "zlib-ng", "rustls"]
mimalloc = ["dep:mimalloc"] 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"]
[dev-dependencies] [dev-dependencies]
env_logger = "0.9.0" env_logger = "0.9.0"

View file

@ -1,11 +1,11 @@
[target.armv7-unknown-linux-gnueabihf] [target.armv7-unknown-linux-gnueabihf]
image = "ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf@sha256:379eee7aa254912a803b558fe0742450dd32ca9749bc8b931927dafa2ce6e8d3" zig = true
[target.armv7-unknown-linux-musleabihf] [target.armv7-unknown-linux-musleabihf]
image = "ghcr.io/cross-rs/armv7-unknown-linux-musleabihf@sha256:00088ebbb98f5d9895c2b6e7f713cd3028331185fe82f60d93efc03bdff8ea65" zig = true
[target.aarch64-unknown-linux-gnu] [target.aarch64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu@sha256:5db2a92c73d1251c5fb9de895928ef2551c08d0ec30b969cf7340ca3dd62ea81" zig = true
[target.aarch64-unknown-linux-musl] [target.aarch64-unknown-linux-musl]
image = "ghcr.io/cross-rs/aarch64-unknown-linux-musl@sha256:341256c185132fff9265ee7c8d94ba9b4fde3e8cfa8b39047c0e64ba4c1faf9a" zig = true

6
ci-scripts/install-deps.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
set -euxo pipefail
apt update
exec apt install -y --no-install-recommends liblzma-dev libzip-dev libzstd-dev