|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, develop] |
| 6 | + pull_request: |
| 7 | + branches: [main, develop] |
| 8 | + |
| 9 | +jobs: |
| 10 | + lint: |
| 11 | + runs-on: [self-hosted, kubernetes] |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - name: Setup Node.js |
| 16 | + uses: actions/setup-node@v4 |
| 17 | + with: |
| 18 | + node-version: "20" |
| 19 | + cache: "npm" |
| 20 | + |
| 21 | + - name: Install dependencies |
| 22 | + run: npm ci |
| 23 | + |
| 24 | + - name: Run linter |
| 25 | + run: npm run lint |
| 26 | + |
| 27 | + build: |
| 28 | + runs-on: [self-hosted, kubernetes] |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Setup Node.js |
| 33 | + uses: actions/setup-node@v4 |
| 34 | + with: |
| 35 | + node-version: "20" |
| 36 | + cache: "npm" |
| 37 | + |
| 38 | + - name: Install dependencies |
| 39 | + run: npm ci |
| 40 | + |
| 41 | + - name: Build |
| 42 | + run: npm run build |
| 43 | + |
| 44 | + - name: Upload build artifacts |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: dist |
| 48 | + path: dist/ |
| 49 | + |
| 50 | + test: |
| 51 | + runs-on: [self-hosted, kubernetes] |
| 52 | + needs: build |
| 53 | + strategy: |
| 54 | + matrix: |
| 55 | + node-version: [18, 20, 21] |
| 56 | + |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - name: Setup Node.js ${{ matrix.node-version }} |
| 61 | + uses: actions/setup-node@v4 |
| 62 | + with: |
| 63 | + node-version: ${{ matrix.node-version }} |
| 64 | + cache: "npm" |
| 65 | + |
| 66 | + - name: Install dependencies |
| 67 | + run: npm ci |
| 68 | + |
| 69 | + - name: Run unit tests |
| 70 | + run: npm test |
| 71 | + env: |
| 72 | + CI: true |
| 73 | + |
| 74 | + integration-test: |
| 75 | + runs-on: [self-hosted, kubernetes] |
| 76 | + needs: build |
| 77 | + |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@v4 |
| 80 | + |
| 81 | + - name: Setup Node.js |
| 82 | + uses: actions/setup-node@v4 |
| 83 | + with: |
| 84 | + node-version: "20" |
| 85 | + cache: "npm" |
| 86 | + |
| 87 | + - name: Install dependencies |
| 88 | + run: npm ci |
| 89 | + |
| 90 | + - name: Start OpenCode mock server |
| 91 | + run: | |
| 92 | + npm run test:mock-server & |
| 93 | + sleep 5 |
| 94 | +
|
| 95 | + - name: Run integration tests |
| 96 | + run: npm run test:integration |
| 97 | + env: |
| 98 | + CI: true |
| 99 | + OPENCODE_BASE_URL: http://localhost:4096 |
| 100 | + |
| 101 | + - name: Stop mock server |
| 102 | + if: always() |
| 103 | + run: pkill -f mock-server || true |
| 104 | + |
| 105 | + type-check: |
| 106 | + runs-on: [self-hosted, kubernetes] |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@v4 |
| 109 | + |
| 110 | + - name: Setup Node.js |
| 111 | + uses: actions/setup-node@v4 |
| 112 | + with: |
| 113 | + node-version: "20" |
| 114 | + cache: "npm" |
| 115 | + |
| 116 | + - name: Install dependencies |
| 117 | + run: npm ci |
| 118 | + |
| 119 | + - name: Type check |
| 120 | + run: npm run type-check |
0 commit comments