diff --git a/.github/workflows/ci-multiplatform.yml b/.github/workflows/ci-multiplatform.yml index 221ece0..a36f595 100644 --- a/.github/workflows/ci-multiplatform.yml +++ b/.github/workflows/ci-multiplatform.yml @@ -27,7 +27,7 @@ jobs: - stable - beta - nightly - #- nightly-musl + - nightly-musl #- nightly-32 #- nightly-mips #- nightly-arm @@ -47,10 +47,10 @@ jobs: - build: nightly os: ubuntu-22.04 rust: nightly - #- build: nightly-musl - # os: ubuntu-22.04 - # rust: nightly - # target: x86_64-unknown-linux-musl + - build: nightly-musl + os: ubuntu-22.04 + rust: nightly + target: x86_64-unknown-linux-musl #- build: nightly-32 # os: ubuntu-22.04 # rust: nightly @@ -87,35 +87,64 @@ jobs: uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2.0.0 - - uses: actions-rs/toolchain@v1 - if: matrix.target == '' + - name: Install Rust + uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust }} - - uses: actions-rs/toolchain@v1 + - name: Use Cross if: matrix.target != '' - with: - toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} - use-cross: true - - uses: actions-rs/cargo@v1 - if: matrix.target != '' - with: - use-cross: true - command: build - args: --workspace --verbose --target ${{ matrix.target }} - - uses: actions-rs/cargo@v1 + run: | + cargo install cross + echo "CARGO=cross" >> $GITHUB_ENV + echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV + echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV + - name: Show command used for Cargo + run: | + echo "cargo command is: ${{ env.CARGO }}" + echo "target flag is: ${{ env.TARGET_FLAGS }}" + - name: Build + run: ${{ env.CARGO }} build --verbose --workspace ${{ env.TARGET_FLAGS }} + - name: Run tests (without cross) if: matrix.target == '' + run: ${{ env.CARGO }} test --verbose --workspace ${{ env.TARGET_FLAGS }} + #- name: Run tests (with cross) + # if: matrix.target != '' + # run: ${{ env.CARGO }} test --verbose --workspace ${{ env.TARGET_FLAGS }} + test_multi_platform: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-latest + - ubuntu-latest + #- windows-latest + steps: + - uses: actions/checkout@v3 + - name: Install packages (macOS) + if: matrix.os == 'macos-latest' + run: | + ci/scripts/macos-install-packages + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.0.0 + - name: Install Rust + uses: dtolnay/rust-toolchain@master with: - command: build - args: --workspace --verbose - - uses: actions-rs/cargo@v1 - if: matrix.target != '' + toolchain: nightly + - name: Run unit tests + run: cargo test --locked --all-targets --workspace --all-features + timeout-minutes: 10 + rustfmt: + name: rustfmt + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@master with: - use-cross: true - command: test - args: --all --verbose --target ${{ matrix.target }} - - uses: actions-rs/cargo@v1 - if: matrix.target == '' - with: - command: test - args: --all --verbose + toolchain: stable + components: rustfmt + - name: Check formatting + run: cargo fmt --all --check diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 24b1399..b66cb74 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -1,7 +1,7 @@ # Architecture -- `.` Root project mainly used for generating the CLI, which in turn is used to - bootstrap the code generation from `dagger` +- `crates/dagger-bootstrap` Root project mainly used for generating the CLI, + which in turn is used to bootstrap the code generation from `dagger` - `crates/dagger-core` Contains all base types used during actual usage. This is where the primary logic lives in which the user interacts (\*disclaimer: most stuff haven't moved in here yet.) diff --git a/Cargo.lock b/Cargo.lock index 3432006..12cb0cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,7 +31,7 @@ checksum = "86ea188f25f0255d8f92797797c97ebf5631fa88178beb1a46fdf5622c9a00e4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.0", + "syn 2.0.2", ] [[package]] @@ -67,6 +67,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5dd14596c0e5b954530d0e6f1fd99b89c03e313aa2086e8da4303701a09e1cf" + [[package]] name = "block-buffer" version = "0.10.4" @@ -119,11 +125,11 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.10" +version = "4.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce38afc168d8665cfc75c7b1dd9672e50716a137f433f070991619744a67342a" +checksum = "42dfd32784433290c51d92c438bb72ea5063797fc3cc9a21a8c4346bebbb2098" dependencies = [ - "bitflags", + "bitflags 2.0.1", "clap_lex", "is-terminal", "strsim", @@ -188,22 +194,6 @@ dependencies = [ "unicode-segmentation", ] -[[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 = "cpufeatures" version = "0.2.5" @@ -250,18 +240,9 @@ dependencies = [ "color-eyre", "dagger-codegen", "dagger-core", - "dirs", "eyre", - "graphql_client", - "hex", - "hex-literal", - "platform-info", - "reqwest", "serde", "serde_json", - "sha2", - "tar", - "tempfile", "tokio", ] @@ -288,7 +269,6 @@ dependencies = [ "dirs", "eyre", "flate2", - "gql_client", "graphql_client", "hex", "hex-literal", @@ -508,21 +488,6 @@ 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.1.0" @@ -670,18 +635,6 @@ version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" -[[package]] -name = "gql_client" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57f4862d3e5cd4ffe8df03fa2137e620e33578bbc1895e6f8f569630e17b1db" -dependencies = [ - "log", - "reqwest", - "serde", - "serde_json", -] - [[package]] name = "graphql-introspection-query" version = "0.2.0" @@ -870,19 +823,6 @@ 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 = "ident_case" version = "1.0.1" @@ -1056,24 +996,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1109,51 +1031,6 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" -[[package]] -name = "openssl" -version = "0.10.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd2523381e46256e40930512c7fd25562b9eae4812cb52078f155e87217c9d1e" -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 1.0.109", -] - -[[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.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176be2629957c157240f68f61f2d0053ad3a4ecfdd9ebf1e6521d18d9635cf67" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "os_str_bytes" version = "6.4.1" @@ -1222,12 +1099,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkg-config" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" - [[package]] name = "platform-info" version = "1.0.2" @@ -1310,7 +1181,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1370,12 +1241,10 @@ dependencies = [ "http-body", "hyper", "hyper-rustls", - "hyper-tls", "ipnet", "js-sys", "log", "mime", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite", @@ -1385,7 +1254,6 @@ dependencies = [ "serde_json", "serde_urlencoded", "tokio", - "tokio-native-tls", "tokio-rustls", "tokio-util", "tower-service", @@ -1425,7 +1293,7 @@ version = "0.36.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fe885c3a125aa45213b68cc1472a49880cb5923dc23f522ad2791b882228778" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -1460,15 +1328,6 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" -[[package]] -name = "schannel" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" -dependencies = [ - "windows-sys 0.42.0", -] - [[package]] name = "scopeguard" version = "1.1.0" @@ -1485,29 +1344,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "security-framework" -version = "2.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "serde" version = "1.0.157" @@ -1525,7 +1361,7 @@ checksum = "78997f4555c22a7971214540c4a661291970619afd56de19f77e0de86296e1e5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.0", + "syn 2.0.2", ] [[package]] @@ -1630,9 +1466,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cff13bb1732bccfe3b246f3fdb09edfd51c01d6f5299b7ccd9457c2e4e37774" +checksum = "59d3276aee1fa0c33612917969b5172b5be2db051232a6e4826f1a1a9191b045" dependencies = [ "proc-macro2", "quote", @@ -1689,7 +1525,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.0", + "syn 2.0.2", ] [[package]] @@ -1748,16 +1584,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.23.4" @@ -1956,12 +1782,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[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" diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..aa8bd5b --- /dev/null +++ b/Cross.toml @@ -0,0 +1,2 @@ +[target.x86_64-unknown-linux-musl] +image = "messense/rust-musl-cross:x86_64-musl" diff --git a/crates/dagger-bootstrap/Cargo.toml b/crates/dagger-bootstrap/Cargo.toml index ad7f7a9..2655e88 100644 --- a/crates/dagger-bootstrap/Cargo.toml +++ b/crates/dagger-bootstrap/Cargo.toml @@ -20,20 +20,4 @@ serde = { workspace = true } serde_json = { workspace = true } tokio = { workspace = true } -reqwest = { version = "0.11.14", features = [ - "stream", - "rustls", - "hyper-rustls", - "rustls-tls", -] } clap = "4.1.6" -dirs = "4.0.0" -graphql_client = { version = "0.12.0", features = [ - "reqwest-rustls", -], default_features = false } -hex = "0.4.3" -hex-literal = "0.3.4" -platform-info = "1.0.2" -sha2 = "0.10.6" -tar = "0.4.38" -tempfile = "3.3.0" diff --git a/crates/dagger-core/Cargo.toml b/crates/dagger-core/Cargo.toml index d82c691..5fe3822 100644 --- a/crates/dagger-core/Cargo.toml +++ b/crates/dagger-core/Cargo.toml @@ -18,7 +18,6 @@ tracing = { workspace = true } tracing-subscriber = { workspace = true } base64 = "0.21.0" -gql_client = "1.0.7" dirs = "4.0.0" flate2 = { version = "1.0.25", features = ["rust_backend"] } graphql_client = { version = "0.12.0", features = [ @@ -32,6 +31,7 @@ reqwest = { version = "0.11.14", features = [ "stream", "rustls-tls", ], default-features = false } + sha2 = "0.10.6" tar = "0.4.38" tempfile = "3.3.0" diff --git a/crates/dagger-core/src/graphql_client.rs b/crates/dagger-core/src/graphql_client.rs index 77548a2..19ce517 100644 --- a/crates/dagger-core/src/graphql_client.rs +++ b/crates/dagger-core/src/graphql_client.rs @@ -4,9 +4,9 @@ use std::sync::Arc; use async_trait::async_trait; use base64::engine::general_purpose; use base64::Engine; -use gql_client::ClientConfig; use crate::connect_params::ConnectParams; +use crate::gql_client::{ClientConfig, GQLClient}; #[async_trait] pub trait GraphQLClient { @@ -17,7 +17,7 @@ pub type DynGraphQLClient = Arc; #[derive(Debug)] pub struct DefaultGraphQLClient { - client: gql_client::Client, + client: GQLClient, } impl DefaultGraphQLClient { @@ -28,7 +28,7 @@ impl DefaultGraphQLClient { headers.insert("Authorization".to_string(), format!("Basic {}", token)); Self { - client: gql_client::Client::new_with_config(ClientConfig { + client: GQLClient::new_with_config(ClientConfig { endpoint: conn.url(), timeout: Some(1000), headers: Some(headers), diff --git a/crates/dagger-core/src/lib.rs b/crates/dagger-core/src/lib.rs index 9363c24..a86daa5 100644 --- a/crates/dagger-core/src/lib.rs +++ b/crates/dagger-core/src/lib.rs @@ -7,6 +7,7 @@ pub mod config; pub mod connect_params; pub mod downloader; pub mod engine; +pub mod gql_client; pub mod graphql_client; pub mod introspection; pub mod logger;