Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

ci(cli): build with --no-default-features and guard against GUI crates (#8539)

Akarshan Biswas09356bcf9447
diff --git a/.github/workflows/template-cli-build-linux-x64.yml b/.github/workflows/template-cli-build-linux-x64.yml
index 5b3e23e29..17d47d331 100644
--- a/.github/workflows/template-cli-build-linux-x64.yml
+++ b/.github/workflows/template-cli-build-linux-x64.yml
@@ -54,7 +54,20 @@ jobs:
JAN_CLI_BUILD_VERSION: ${{ inputs.new_version }}
run: |
cd src-tauri
- cargo build --features cli --bin jan --release
+ cargo build --no-default-features --features cli --bin jan --release
+
+ - name: Assert no GUI crates
+ run: |
+ cd src-tauri
+ if cargo tree --no-default-features --features cli -i tauri >/dev/null 2>&1 || \
+ cargo tree --no-default-features --features cli -i gtk >/dev/null 2>&1 || \
+ cargo tree --no-default-features --features cli -i gdk >/dev/null 2>&1 || \
+ cargo tree --no-default-features --features cli -i muda >/dev/null 2>&1 || \
+ cargo tree --no-default-features --features cli -i wry >/dev/null 2>&1 || \
+ cargo tree --no-default-features --features cli -i webkit2gtk >/dev/null 2>&1; then
+ echo "GUI crate leaked into the CLI dependency graph" >&2
+ exit 1
+ fi
- name: Strip binary
run: strip src-tauri/target/release/jan
diff --git a/.github/workflows/template-cli-build-macos.yml b/.github/workflows/template-cli-build-macos.yml
index 1aea354eb..95d6e8ea2 100644
--- a/.github/workflows/template-cli-build-macos.yml
+++ b/.github/workflows/template-cli-build-macos.yml
@@ -66,7 +66,7 @@ jobs:
JAN_CLI_BUILD_VERSION: ${{ inputs.new_version }}
run: |
cd src-tauri
- cargo build --features cli --bin jan --release --target x86_64-apple-darwin
+ cargo build --no-default-features --features cli --bin jan --release --target x86_64-apple-darwin
- name: Build CLI binary (aarch64)
env:
@@ -74,7 +74,7 @@ jobs:
JAN_CLI_BUILD_VERSION: ${{ inputs.new_version }}
run: |
cd src-tauri
- cargo build --features cli --bin jan --release --target aarch64-apple-darwin
+ cargo build --no-default-features --features cli --bin jan --release --target aarch64-apple-darwin
- name: Create universal binary
run: |
diff --git a/.github/workflows/template-cli-build-windows-x64.yml b/.github/workflows/template-cli-build-windows-x64.yml
index 0fb62d235..13f9f7c8e 100644
--- a/.github/workflows/template-cli-build-windows-x64.yml
+++ b/.github/workflows/template-cli-build-windows-x64.yml
@@ -54,7 +54,7 @@ jobs:
JAN_CLI_BUILD_VERSION: ${{ inputs.new_version }}
run: |
cd src-tauri
- cargo build --features cli --bin jan --release
+ cargo build --no-default-features --features cli --bin jan --release
- name: Package zip
id: package