diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff41085..ebb3f2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,7 @@ jobs: - name: Build with nix and run checks run: | - nix flake check --print-build-logs + nix flake check --max-jobs 2 --print-build-logs check-win: name: "check windows" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ab3b34f..1154f62 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -38,7 +38,7 @@ jobs: bin: rnk name: rnk-x86_64-unknown-linux-musl-${{ needs.prepare-version.outputs.RNK_RELEASE_VERSION}}.tar.gz cargo_command: cargo - features: "--no-default-features --features vendored-openssl" + features: "--no-default-features --features vendored-openssl,vendored-git" - os_name: Linux-aarch64 os: ubuntu-24.04-arm @@ -46,7 +46,7 @@ jobs: bin: rnk name: rnk-aarch64-unknown-linux-musl-${{ needs.prepare-version.outputs.RNK_RELEASE_VERSION}}.tar.gz cargo_command: cargo - features: "--no-default-features --features vendored-openssl" + features: "--no-default-features --features vendored-openssl,vendored-git" - os_name: Windows-x86_64 os: windows-latest @@ -54,7 +54,7 @@ jobs: bin: rnk.exe name: rnk-x86_64-pc-windows-msvc-${{ needs.prepare-version.outputs.RNK_RELEASE_VERSION}}.zip cargo_command: cargo - features: "--no-default-features --features vendored-openssl" + features: "--no-default-features --features vendored-openssl,vendored-git" - os_name: macOS-x86_64 os: macOS-latest @@ -62,7 +62,7 @@ jobs: bin: rnk name: rnk-x86_64-apple-darwin-${{ needs.prepare-version.outputs.RNK_RELEASE_VERSION}}.tar.gz cargo_command: cargo - features: "--no-default-features --features vendored-openssl" + features: "--no-default-features --features vendored-openssl,vendored-git" - os_name: macOS-aarch64 os: macOS-latest @@ -70,7 +70,7 @@ jobs: bin: rnk name: rnk-aarch64-apple-darwin-${{ needs.prepare-version.outputs.RNK_RELEASE_VERSION}}.tar.gz cargo_command: cargo - features: "--no-default-features --features vendored-openssl" + features: "--no-default-features --features vendored-openssl,vendored-git" runs-on: ${{ matrix.platform.os }} steps: diff --git a/Cargo.lock b/Cargo.lock index cd9581b..afc1e04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5202,7 +5202,6 @@ dependencies = [ "clap_complete", "color-eyre", "comrak", - "console 0.16.4", "db-keystore", "directories", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index 8b9c8fd..80ffd0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,6 @@ build = "build.rs" [dependencies] clap = { version = "4.6.6", features = ["derive", "wrap_help"] } clap_complete = { version = "4.6.9", features = ["unstable-dynamic"] } -console = { version = "0.16.4" } env_logger = { version = "0.11.11" } log = { version = "0.4.34" } openssl = { version = "0.10.81", optional = true } @@ -40,7 +39,6 @@ regex-macro = { version = "0.3.0" } iso8601-timestamp = { version = "0.4" } toml = { version = "1.1.5" } git2 = { version = "0.21.0", default-features = false, features = [ - "vendored-libgit2", "https", "ssh", ] } @@ -95,6 +93,7 @@ vendored-openssl = [ "openssl/vendored", "reqwest/native-tls-vendored", ] # include compiled openssl library +vendored-git = ["git2/vendored-libgit2"] # statically link vendored libgit2 vendored-zlib = [ "git2/zlib-ng-compat", ] # without this feature wherever the cli is installed needs to have zlib.so diff --git a/flake.nix b/flake.nix index 3b44752..8822c6c 100644 --- a/flake.nix +++ b/flake.nix @@ -70,6 +70,8 @@ pkgs.openssl pkgs.installShellFiles pkgs.git + pkgs.libgit2 + pkgs.libssh2 ] ++ lib.optionals pkgs.stdenv.isDarwin [ # Additional darwin specific inputs can be set here @@ -100,6 +102,8 @@ inherit cargoArtifacts; # additional arguments to cargo for building the app, --release is already there cargoExtraArgs = ""; + # we run nextest further down, no need to run tests while building + doCheck = false; postInstall = '' for shell in fish zsh bash; do echo "COMPLETE=$shell rnk" > rnk.$shell @@ -108,63 +112,66 @@ ''; }); in { - checks = { - # Build the crate as part of `nix flake check` for convenience - inherit my-crate; - - # Run clippy (and deny all warnings) on the crate source, - # again, reusing the dependency artifacts from above. - # - # Note that this is done as a separate derivation so that - # we can block the CI if there are issues here, but not - # prevent downstream consumers from building our crate by itself. - my-crate-clippy = craneLib.cargoClippy (commonArgs - // { - inherit cargoArtifacts; - cargoClippyExtraArgs = "--features user-doc --all-targets -- --deny warnings"; - }); - - my-crate-doc = craneLib.cargoDoc (commonArgs - // { - inherit cargoArtifacts; - }); - - my-user-docs = craneLib.mkCargoDerivation (commonArgs - // { - inherit cargoArtifacts; - pnameSuffix = "-userdocs"; - buildPhaseCargoCommand = "cargoWithProfile run --features user-doc -- user-doc ${docSrc}"; - }); - - # Check formatting - my-crate-fmt = craneLib.cargoFmt { - inherit src; - inherit version; - }; - - # Audit dependencies - my-crate-audit = craneLib.cargoAudit { - inherit src advisory-db; - cargoAuditExtraArgs = "--ignore RUSTSEC-2023-0071"; - inherit version; - }; + checks = + { + # Build the crate as part of `nix flake check` for convenience + inherit my-crate; + + # Run clippy (and deny all warnings) on the crate source, + # again, reusing the dependency artifacts from above. + # + # Note that this is done as a separate derivation so that + # we can block the CI if there are issues here, but not + # prevent downstream consumers from building our crate by itself. + my-crate-clippy = craneLib.cargoClippy (commonArgs + // { + inherit cargoArtifacts; + cargoClippyExtraArgs = "--features user-doc --all-targets -- --deny warnings"; + }); - # Audit licenses - my-crate-deny = craneLib.cargoDeny { - inherit src; - inherit version; - }; + my-crate-doc = craneLib.cargoDoc (commonArgs + // { + inherit cargoArtifacts; + }); - # Run tests with cargo-nextest - # Consider setting `doCheck = false` on `my-crate` if you do not want - # the tests to run twice - my-crate-nextest = craneLib.cargoNextest (commonArgs - // { - inherit cargoArtifacts; - partitions = 1; - partitionType = "count"; - }); - }; + # Check formatting + my-crate-fmt = craneLib.cargoFmt { + inherit src; + inherit version; + }; + + # Audit dependencies + my-crate-audit = craneLib.cargoAudit { + inherit src advisory-db; + cargoAuditExtraArgs = "--ignore RUSTSEC-2023-0071"; + inherit version; + }; + + # Audit licenses + my-crate-deny = craneLib.cargoDeny { + inherit src; + inherit version; + }; + + # Run tests with cargo-nextest + # Consider setting `doCheck = false` on `my-crate` if you do not want + # the tests to run twice + my-crate-nextest = craneLib.cargoNextest (commonArgs + // { + inherit cargoArtifacts; + partitions = 1; + partitionType = "count"; + }); + } + // (lib.optionalAttrs pkgs.stdenv.isLinux { + # User docs build is slow on macOS (compiles git2 from C), only run on Linux + my-user-docs = craneLib.mkCargoDerivation (commonArgs + // { + inherit cargoArtifacts; + pnameSuffix = "-userdocs"; + buildPhaseCargoCommand = "cargoWithProfile run --features user-doc -- user-doc ${docSrc}"; + }); + }); packages = {