diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 16bc1c6..06dabc3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,6 +6,9 @@ on: permissions: contents: write +env: + CARGO_TARGET_DIR: output + jobs: create-release: name: Create release @@ -18,7 +21,7 @@ jobs: uses: actions/checkout@v3 - name: Get version from manifest - uses: SebRollen/toml-action@0ad94c4a52c402aaa76e14e8a43551163b6cedf9 + uses: SebRollen/toml-action@9062fbef52816d61278d24ce53c8070440e1e8dd id: get_version with: file: Cargo.toml @@ -26,12 +29,12 @@ jobs: - name: Create release id: create_release - uses: actions/create-release@v1 + uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: + name: ${{ steps.get_version.outputs.value }} tag_name: v${{ steps.get_version.outputs.value }} - release_name: ${{ steps.get_version.outputs.value }} draft: true assets: @@ -85,31 +88,37 @@ jobs: runner-os: windows-latest artifact-name: lune-${{ needs.create-release.outputs.manifest_version }}-windows-x86_64 cargo-target: x86_64-pc-windows-msvc + cargo-features: reqwest/rustls-tls - name: Windows aarch64 runner-os: windows-latest artifact-name: lune-${{ needs.create-release.outputs.manifest_version }}-windows-aarch64 cargo-target: aarch64-pc-windows-msvc + cargo-features: reqwest/default-tls - name: Linux x86_64 runner-os: ubuntu-latest artifact-name: lune-${{ needs.create-release.outputs.manifest_version }}-linux-x86_64 cargo-target: x86_64-unknown-linux-gnu + cargo-features: reqwest/rustls-tls - name: Linux aarch64 runner-os: ubuntu-latest artifact-name: lune-${{ needs.create-release.outputs.manifest_version }}-linux-aarch64 cargo-target: aarch64-unknown-linux-gnu + cargo-features: reqwest/rustls-tls - name: macOS x86_64 runner-os: macos-latest artifact-name: lune-${{ needs.create-release.outputs.manifest_version }}-macos-x86_64 cargo-target: x86_64-apple-darwin + cargo-features: reqwest/rustls-tls - name: macOS aarch64 runner-os: macos-latest artifact-name: lune-${{ needs.create-release.outputs.manifest_version }}-macos-aarch64 cargo-target: aarch64-apple-darwin + cargo-features: reqwest/rustls-tls name: Build - ${{ matrix.name }} runs-on: ${{ matrix.runner-os }} @@ -122,7 +131,7 @@ jobs: with: targets: ${{ matrix.cargo-target }} - - name: Install tooling + - name: Install tooling (aarch64-unknown-linux-gnu) if: matrix.cargo-target == 'aarch64-unknown-linux-gnu' run: | sudo apt-get update -y @@ -130,9 +139,11 @@ jobs: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - name: Build binary - run: cargo build --package lune-cli --locked --release --all-features --target ${{ matrix.cargo-target }} - env: - CARGO_TARGET_DIR: output + run: | + cargo build \ + --locked --release --all-features \ + --target ${{ matrix.cargo-target }} \ + --features ${{ matrix.cargo-features }} - name: Create binary archive shell: bash diff --git a/.justfile b/.justfile index b2f904a..c247ba6 100644 --- a/.justfile +++ b/.justfile @@ -1,18 +1,18 @@ # Run an individual test using the Lune CLI run-test TEST_NAME: - cargo run -- "tests/{{TEST_NAME}}" + cargo run --features reqwest/rustls-tls -- "tests/{{TEST_NAME}}" # Run an individual file using the Lune CLI run-file FILE_NAME: - cargo run -- "{{FILE_NAME}}" + cargo run --features reqwest/rustls-tls -- "{{FILE_NAME}}" # Run tests for the Lune library test: - cargo test --package lune -- --test-threads 1 + cargo test --features reqwest/rustls-tls --package lune -- --test-threads 1 # Run tests for the Lune CLI test-cli: - cargo test --package lune-cli + cargo test --features reqwest/rustls-tls --package lune-cli # Generate gitbook directory generate-gitbook: diff --git a/Cargo.lock b/Cargo.lock index cfc941b..e605eac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -875,19 +875,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" -dependencies = [ - "http", - "hyper", - "rustls", - "tokio", - "tokio-rustls", -] - [[package]] name = "hyper-tungstenite" version = "0.9.0" @@ -1605,7 +1592,6 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-rustls", "ipnet", "js-sys", "log", @@ -1613,37 +1599,18 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls", - "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", - "tokio-rustls", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", "winreg", ] -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - [[package]] name = "rmp" version = "0.8.11" @@ -1716,27 +1683,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "rustls" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" -dependencies = [ - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" -dependencies = [ - "base64 0.21.0", -] - [[package]] name = "ryu" version = "1.0.13" @@ -1755,16 +1701,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "semver" version = "0.9.0" @@ -1927,12 +1863,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "standback" version = "0.2.17" @@ -2192,17 +2122,6 @@ dependencies = [ "syn 2.0.15", ] -[[package]] -name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls", - "tokio", - "webpki", -] - [[package]] name = "tokio-tungstenite" version = "0.18.0" @@ -2354,12 +2273,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "url" version = "2.3.1" @@ -2505,25 +2418,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/packages/lib/Cargo.toml b/packages/lib/Cargo.toml index 706a975..2d0643e 100644 --- a/packages/lib/Cargo.toml +++ b/packages/lib/Cargo.toml @@ -46,14 +46,17 @@ hyper-tungstenite = { version = "0.9" } tokio-tungstenite = { version = "0.18" } # Using rustls instead of the default OpenSSL allows us to have much more portable binaries -reqwest = { version = "0.11", default-features = false, features = [ - "rustls-tls", -] } - -# Rustls does not yet compile on windows aarch64, so we use default tls there -# https://github.com/briansmith/ring/issues/1167 -[target.aarch64-pc-windows-msvc.dependencies] -reqwest = "0.11" +# +# Notes: +# +# - Rustls does not yet compile on windows aarch64, so we use default tls there +# https://github.com/briansmith/ring/issues/1167 +# +# - Cargo does not support per-target features, we have to add the feature in the build command itself +# https://github.com/rust-lang/cargo/issues/1197 +[dependencies.reqwest] +version = "0.11" +default-features = false [dev-dependencies] anyhow = "1.0"