| 1 | name: Test CLI Options |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [ main ] |
| 6 | pull_request: |
| 7 | branches: [ main ] |
| 8 | |
| 9 | jobs: |
| 10 | test-cli-options: |
| 11 | runs-on: ubuntu-latest |
| 12 | |
| 13 | strategy: |
| 14 | fail-fast: false |
| 15 | matrix: |
| 16 | include: |
| 17 | # Default template combinations |
| 18 | - template: "default" |
| 19 | rpc: true |
| 20 | linter: "eslint" |
| 21 | test_name: "Default + RPC + ESLint" |
| 22 | - template: "default" |
| 23 | rpc: true |
| 24 | linter: "biome" |
| 25 | test_name: "Default + RPC + Biome" |
| 26 | - template: "default" |
| 27 | rpc: false |
| 28 | linter: "eslint" |
| 29 | test_name: "Default + No RPC + ESLint" |
| 30 | - template: "default" |
| 31 | rpc: false |
| 32 | linter: "biome" |
| 33 | test_name: "Default + No RPC + Biome" |
| 34 | |
| 35 | # Tailwind template combinations |
| 36 | - template: "tailwind" |
| 37 | rpc: true |
| 38 | linter: "eslint" |
| 39 | test_name: "Tailwind + RPC + ESLint" |
| 40 | - template: "tailwind" |
| 41 | rpc: true |
| 42 | linter: "biome" |
| 43 | test_name: "Tailwind + RPC + Biome" |
| 44 | - template: "tailwind" |
| 45 | rpc: false |
| 46 | linter: "eslint" |
| 47 | test_name: "Tailwind + No RPC + ESLint" |
| 48 | - template: "tailwind" |
| 49 | rpc: false |
| 50 | linter: "biome" |
| 51 | test_name: "Tailwind + No RPC + Biome" |
| 52 | |
| 53 | # Shadcn template combinations |
| 54 | - template: "shadcn" |
| 55 | rpc: true |
| 56 | linter: "eslint" |
| 57 | test_name: "Shadcn + RPC + ESLint" |
| 58 | - template: "shadcn" |
| 59 | rpc: true |
| 60 | linter: "biome" |
| 61 | test_name: "Shadcn + RPC + Biome" |
| 62 | - template: "shadcn" |
| 63 | rpc: false |
| 64 | linter: "eslint" |
| 65 | test_name: "Shadcn + No RPC + ESLint" |
| 66 | - template: "shadcn" |
| 67 | rpc: false |
| 68 | linter: "biome" |
| 69 | test_name: "Shadcn + No RPC + Biome" |
| 70 | |
| 71 | steps: |
| 72 | - name: Checkout repository |
| 73 | uses: actions/checkout@v4 |
| 74 | |
| 75 | - name: Setup Bun |
| 76 | uses: oven-sh/setup-bun@v2 |
| 77 | with: |
| 78 | bun-version: latest |
| 79 | |
| 80 | - name: Install dependencies |
| 81 | run: bun install |
| 82 | |
| 83 | - name: Build CLI |
| 84 | run: bun run build |
| 85 | |
| 86 | - name: Create test project - ${{ matrix.test_name }} |
| 87 | run: | |
| 88 | # Create project with specified options |
| 89 | echo "Creating project with options:" |
| 90 | echo "Template: ${{ matrix.template }}" |
| 91 | echo "RPC: ${{ matrix.rpc }}" |
| 92 | echo "Linter: ${{ matrix.linter }}" |
| 93 | |
| 94 | if [ "${{ matrix.rpc }}" = "true" ]; then |
| 95 | ./dist/index.js test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} \ |
| 96 | --yes \ |
| 97 | --template ${{ matrix.template }} \ |
| 98 | --rpc \ |
| 99 | --linter ${{ matrix.linter }} |
| 100 | else |
| 101 | ./dist/index.js test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} \ |
| 102 | --yes \ |
| 103 | --template ${{ matrix.template }} \ |
| 104 | --linter ${{ matrix.linter }} |
| 105 | fi |
| 106 | |
| 107 | - name: Install project dependencies |
| 108 | run: | |
| 109 | cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} |
| 110 | bun install |
| 111 | |
| 112 | - name: Build test project |
| 113 | run: | |
| 114 | cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} |
| 115 | bun run build |
| 116 | |
| 117 | - name: Verify build outputs |
| 118 | run: | |
| 119 | cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} |
| 120 | |
| 121 | # Check that dist directories exist |
| 122 | if [ ! -d "client/dist" ]; then |
| 123 | echo "❌ Client build failed - dist directory not found" |
| 124 | exit 1 |
| 125 | fi |
| 126 | |
| 127 | if [ ! -d "server/dist" ]; then |
| 128 | echo "❌ Server build failed - dist directory not found" |
| 129 | exit 1 |
| 130 | fi |
| 131 | |
| 132 | # Check for expected files |
| 133 | if [ ! -f "client/dist/index.html" ]; then |
| 134 | echo "❌ Client build incomplete - index.html not found" |
| 135 | exit 1 |
| 136 | fi |
| 137 | |
| 138 | if [ ! -f "server/dist/index.js" ]; then |
| 139 | echo "❌ Server build incomplete - index.js not found" |
| 140 | exit 1 |
| 141 | fi |
| 142 | |
| 143 | echo "✅ Build verification passed for ${{ matrix.test_name }}" |
| 144 | |
| 145 | - name: Run linter on generated project |
| 146 | run: | |
| 147 | cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} |
| 148 | |
| 149 | if [ "${{ matrix.linter }}" = "eslint" ]; then |
| 150 | # Check if ESLint config exists and run it |
| 151 | if [ -f ".eslintrc.json" ] || [ -f ".eslintrc.js" ] || [ -f "eslint.config.js" ]; then |
| 152 | echo "Running ESLint..." |
| 153 | bun run lint || echo "ESLint warnings/errors found but continuing..." |
| 154 | fi |
| 155 | elif [ "${{ matrix.linter }}" = "biome" ]; then |
| 156 | # Check if Biome config exists and run it |
| 157 | if [ -f "biome.json" ]; then |
| 158 | echo "Running Biome..." |
| 159 | bun run lint || echo "Biome warnings/errors found but continuing..." |
| 160 | fi |
| 161 | fi |
| 162 | |
| 163 | - name: Cleanup test project |
| 164 | if: always() |
| 165 | run: | |
| 166 | rm -rf test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} |