|
| 1 | +name: Test Completions Generation |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - add-shell-completions |
| 7 | + |
| 8 | +jobs: |
| 9 | + test-linux: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v6 |
| 13 | + - uses: dtolnay/rust-toolchain@stable |
| 14 | + |
| 15 | + - name: Build binary |
| 16 | + run: cargo build --release --features vendored-openssl |
| 17 | + |
| 18 | + - name: Test completion generation |
| 19 | + run: | |
| 20 | + BIN="target/release/lychee" |
| 21 | + chmod +x $BIN |
| 22 | +
|
| 23 | + # Test all completion types |
| 24 | + echo "Testing Bash completion..." |
| 25 | + $BIN --generate complete-bash > /tmp/lychee.bash |
| 26 | +
|
| 27 | + echo "Testing Elvish completion..." |
| 28 | + $BIN --generate complete-elvish > /tmp/lychee.elv |
| 29 | +
|
| 30 | + echo "Testing Fish completion..." |
| 31 | + $BIN --generate complete-fish > /tmp/lychee.fish |
| 32 | +
|
| 33 | + echo "Testing PowerShell completion..." |
| 34 | + $BIN --generate complete-powershell > /tmp/_lychee.ps1 |
| 35 | +
|
| 36 | + echo "Testing Zsh completion..." |
| 37 | + $BIN --generate complete-zsh > /tmp/_lychee |
| 38 | +
|
| 39 | + # Verify files were created and are not empty |
| 40 | + for file in /tmp/lychee.bash /tmp/lychee.elv /tmp/lychee.fish /tmp/_lychee.ps1 /tmp/_lychee; do |
| 41 | + if [ ! -s "$file" ]; then |
| 42 | + echo "Error: $file is empty or missing" |
| 43 | + exit 1 |
| 44 | + fi |
| 45 | + echo "✓ $(basename $file): $(wc -l < $file) lines" |
| 46 | + done |
| 47 | +
|
| 48 | + echo "✅ All completions generated successfully!" |
| 49 | +
|
| 50 | + test-macos: |
| 51 | + runs-on: macos-latest |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v6 |
| 54 | + - uses: dtolnay/rust-toolchain@stable |
| 55 | + |
| 56 | + - name: Build and test completions |
| 57 | + run: | |
| 58 | + cargo build --release |
| 59 | + BIN="target/release/lychee" |
| 60 | +
|
| 61 | + # Quick test |
| 62 | + $BIN --generate complete-bash > /tmp/test.bash |
| 63 | + $BIN --generate complete-fish > /tmp/test.fish |
| 64 | + $BIN --generate complete-zsh > /tmp/test.zsh |
| 65 | +
|
| 66 | + echo "✅ macOS completions work!" |
0 commit comments