feat: Added github actions
c8234baf
2 file(s) · +188 −0
| 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 | + | ./dist/index.js test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} \ |
|
| 95 | + | --yes \ |
|
| 96 | + | --template ${{ matrix.template }} \ |
|
| 97 | + | --rpc=${{ matrix.rpc }} \ |
|
| 98 | + | --linter ${{ matrix.linter }} |
|
| 99 | + | ||
| 100 | + | - name: Install project dependencies |
|
| 101 | + | run: | |
|
| 102 | + | cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} |
|
| 103 | + | bun install |
|
| 104 | + | ||
| 105 | + | - name: Build test project |
|
| 106 | + | run: | |
|
| 107 | + | cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} |
|
| 108 | + | bun run build |
|
| 109 | + | ||
| 110 | + | - name: Verify build outputs |
|
| 111 | + | run: | |
|
| 112 | + | cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} |
|
| 113 | + | ||
| 114 | + | # Check that dist directories exist |
|
| 115 | + | if [ ! -d "client/dist" ]; then |
|
| 116 | + | echo "❌ Client build failed - dist directory not found" |
|
| 117 | + | exit 1 |
|
| 118 | + | fi |
|
| 119 | + | ||
| 120 | + | if [ ! -d "server/dist" ]; then |
|
| 121 | + | echo "❌ Server build failed - dist directory not found" |
|
| 122 | + | exit 1 |
|
| 123 | + | fi |
|
| 124 | + | ||
| 125 | + | # Check for expected files |
|
| 126 | + | if [ ! -f "client/dist/index.html" ]; then |
|
| 127 | + | echo "❌ Client build incomplete - index.html not found" |
|
| 128 | + | exit 1 |
|
| 129 | + | fi |
|
| 130 | + | ||
| 131 | + | if [ ! -f "server/dist/index.js" ]; then |
|
| 132 | + | echo "❌ Server build incomplete - index.js not found" |
|
| 133 | + | exit 1 |
|
| 134 | + | fi |
|
| 135 | + | ||
| 136 | + | echo "✅ Build verification passed for ${{ matrix.test_name }}" |
|
| 137 | + | ||
| 138 | + | - name: Run linter on generated project |
|
| 139 | + | run: | |
|
| 140 | + | cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} |
|
| 141 | + | ||
| 142 | + | if [ "${{ matrix.linter }}" = "eslint" ]; then |
|
| 143 | + | # Check if ESLint config exists and run it |
|
| 144 | + | if [ -f ".eslintrc.json" ] || [ -f ".eslintrc.js" ] || [ -f "eslint.config.js" ]; then |
|
| 145 | + | echo "Running ESLint..." |
|
| 146 | + | bun run lint || echo "ESLint warnings/errors found but continuing..." |
|
| 147 | + | fi |
|
| 148 | + | elif [ "${{ matrix.linter }}" = "biome" ]; then |
|
| 149 | + | # Check if Biome config exists and run it |
|
| 150 | + | if [ -f "biome.json" ]; then |
|
| 151 | + | echo "Running Biome..." |
|
| 152 | + | bun run lint || echo "Biome warnings/errors found but continuing..." |
|
| 153 | + | fi |
|
| 154 | + | fi |
|
| 155 | + | ||
| 156 | + | - name: Cleanup test project |
|
| 157 | + | if: always() |
|
| 158 | + | run: | |
|
| 159 | + | rm -rf test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.linter }} |
| 1 | + | name: Test |
|
| 2 | + | ||
| 3 | + | on: |
|
| 4 | + | push: |
|
| 5 | + | branches: [ main ] |
|
| 6 | + | pull_request: |
|
| 7 | + | branches: [ main ] |
|
| 8 | + | ||
| 9 | + | jobs: |
|
| 10 | + | test: |
|
| 11 | + | runs-on: ubuntu-latest |
|
| 12 | + | ||
| 13 | + | steps: |
|
| 14 | + | - name: Checkout repository |
|
| 15 | + | uses: actions/checkout@v4 |
|
| 16 | + | ||
| 17 | + | - name: Setup Bun |
|
| 18 | + | uses: oven-sh/setup-bun@v2 |
|
| 19 | + | with: |
|
| 20 | + | bun-version: latest |
|
| 21 | + | ||
| 22 | + | - name: Install dependencies |
|
| 23 | + | run: bun install |
|
| 24 | + | ||
| 25 | + | - name: Run tests |
|
| 26 | + | run: bun test |
|
| 27 | + | ||
| 28 | + | - name: Run tests with coverage |
|
| 29 | + | run: bun test --coverage |