Skip to content

Commit c612176

Browse files
committed
Add test-library-no-clap ci step
1 parent 4bbbf54 commit c612176

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,60 @@ jobs:
4141

4242
- name: Run Docker Image
4343
run: docker run --network host sqlant postgresql://user:password@localhost/db
44+
45+
test-library-no-clap:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout Repository
49+
uses: actions/checkout@v4
50+
51+
- name: Setup Rust
52+
uses: actions-rs/toolchain@v1
53+
with:
54+
toolchain: stable
55+
override: true
56+
57+
- name: Create test project using sqlant as library
58+
run: |
59+
# Create a temporary test project
60+
mkdir -p /tmp/test-sqlant-lib
61+
cd /tmp/test-sqlant-lib
62+
63+
# Initialize a new Rust project
64+
cargo init --lib
65+
66+
# Add sqlant as a library dependency (using local path)
67+
cat > Cargo.toml << 'EOF'
68+
[package]
69+
name = "test-sqlant-lib"
70+
version = "0.1.0"
71+
edition = "2021"
72+
73+
[dependencies]
74+
sqlant = { path = "${{ github.workspace }}", default-features = false }
75+
EOF
76+
77+
# Create a simple lib.rs that uses sqlant
78+
cat > src/lib.rs << 'EOF'
79+
use sqlant::{GeneratorType, get_generator};
80+
81+
pub fn test_use_sqlant() {
82+
let _ = GeneratorType::PlantUML;
83+
}
84+
EOF
85+
86+
- name: Build test project
87+
run: |
88+
cd /tmp/test-sqlant-lib
89+
cargo build
90+
91+
- name: Verify clap is not in Cargo.lock
92+
run: |
93+
cd /tmp/test-sqlant-lib
94+
if grep -q "name = \"clap\"" Cargo.lock; then
95+
echo "ERROR: clap found in Cargo.lock when using sqlant as library"
96+
echo "sqlant should not depend on clap when used as a library"
97+
exit 1
98+
else
99+
echo "SUCCESS: clap is not in Cargo.lock"
100+
fi

0 commit comments

Comments
 (0)