|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ci-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + quality: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v6 |
| 18 | + |
| 19 | + - uses: oven-sh/setup-bun@v2 |
| 20 | + with: |
| 21 | + bun-version: latest |
| 22 | + |
| 23 | + - uses: actions/cache@v5 |
| 24 | + with: |
| 25 | + path: ~/.bun/install/cache |
| 26 | + key: bun-${{ runner.os }}-${{ hashFiles('bun.lockb') }} |
| 27 | + restore-keys: bun-${{ runner.os }}- |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + uses: nick-fields/retry@v4 |
| 31 | + with: |
| 32 | + max_attempts: 3 |
| 33 | + timeout_minutes: 5 |
| 34 | + command: bun install --frozen-lockfile |
| 35 | + |
| 36 | + - name: Check version consistency |
| 37 | + run: | |
| 38 | + ROOT_VERSION=$(jq -r .version package.json) |
| 39 | + echo "Root version: $ROOT_VERSION" |
| 40 | + MISMATCH=0 |
| 41 | + for pkg in packages/*/package.json; do |
| 42 | + PKG_VERSION=$(jq -r .version "$pkg") |
| 43 | + if [ "$PKG_VERSION" != "$ROOT_VERSION" ]; then |
| 44 | + echo "::error file=$pkg::Version mismatch: $pkg has $PKG_VERSION, expected $ROOT_VERSION" |
| 45 | + MISMATCH=1 |
| 46 | + fi |
| 47 | + done |
| 48 | + # Check optionalDependencies in wrapper |
| 49 | + for dep_version in $(jq -r '.optionalDependencies // {} | values[]' packages/wrapper/package.json); do |
| 50 | + if [ "$dep_version" != "$ROOT_VERSION" ]; then |
| 51 | + echo "::error file=packages/wrapper/package.json::Dependency version mismatch: $dep_version, expected $ROOT_VERSION" |
| 52 | + MISMATCH=1 |
| 53 | + fi |
| 54 | + done |
| 55 | + if [ "$MISMATCH" -eq 1 ]; then |
| 56 | + echo "::error::Version mismatch detected across package.json files" |
| 57 | + exit 1 |
| 58 | + fi |
| 59 | + echo "All versions match: $ROOT_VERSION" |
| 60 | +
|
| 61 | + - name: Lint |
| 62 | + uses: nick-fields/retry@v4 |
| 63 | + with: |
| 64 | + max_attempts: 3 |
| 65 | + timeout_minutes: 5 |
| 66 | + command: bun run lint |
| 67 | + |
| 68 | + - name: Type check |
| 69 | + uses: nick-fields/retry@v4 |
| 70 | + with: |
| 71 | + max_attempts: 3 |
| 72 | + timeout_minutes: 5 |
| 73 | + command: bunx tsc --noEmit |
| 74 | + |
| 75 | + test: |
| 76 | + runs-on: ubuntu-latest |
| 77 | + strategy: |
| 78 | + fail-fast: false |
| 79 | + matrix: |
| 80 | + env-config: |
| 81 | + - { name: default, env: {} } |
| 82 | + - { name: telemetry-disabled, env: { FAILPROOFAI_TELEMETRY_DISABLED: "1" } } |
| 83 | + - { name: log-debug, env: { FAILPROOFAI_LOG_LEVEL: debug } } |
| 84 | + - { name: hook-log-file, env: { FAILPROOFAI_HOOK_LOG_FILE: "1" } } |
| 85 | + env: ${{ matrix.env-config.env }} |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@v6 |
| 88 | + |
| 89 | + - uses: oven-sh/setup-bun@v2 |
| 90 | + with: |
| 91 | + bun-version: latest |
| 92 | + |
| 93 | + - uses: actions/cache@v5 |
| 94 | + with: |
| 95 | + path: ~/.bun/install/cache |
| 96 | + key: bun-${{ runner.os }}-${{ hashFiles('bun.lockb') }} |
| 97 | + restore-keys: bun-${{ runner.os }}- |
| 98 | + |
| 99 | + - name: Install dependencies |
| 100 | + uses: nick-fields/retry@v4 |
| 101 | + with: |
| 102 | + max_attempts: 3 |
| 103 | + timeout_minutes: 5 |
| 104 | + command: bun install --frozen-lockfile |
| 105 | + |
| 106 | + - name: Test (${{ matrix.env-config.name }}) |
| 107 | + uses: nick-fields/retry@v4 |
| 108 | + with: |
| 109 | + max_attempts: 3 |
| 110 | + timeout_minutes: 10 |
| 111 | + command: bun run test:run |
| 112 | + |
| 113 | + build: |
| 114 | + runs-on: ubuntu-latest |
| 115 | + steps: |
| 116 | + - uses: actions/checkout@v6 |
| 117 | + |
| 118 | + - uses: oven-sh/setup-bun@v2 |
| 119 | + with: |
| 120 | + bun-version: latest |
| 121 | + |
| 122 | + - uses: actions/cache@v5 |
| 123 | + with: |
| 124 | + path: ~/.bun/install/cache |
| 125 | + key: bun-${{ runner.os }}-${{ hashFiles('bun.lockb') }} |
| 126 | + restore-keys: bun-${{ runner.os }}- |
| 127 | + |
| 128 | + - name: Install dependencies |
| 129 | + uses: nick-fields/retry@v4 |
| 130 | + with: |
| 131 | + max_attempts: 3 |
| 132 | + timeout_minutes: 5 |
| 133 | + command: bun install --frozen-lockfile |
| 134 | + |
| 135 | + - name: Build |
| 136 | + uses: nick-fields/retry@v4 |
| 137 | + with: |
| 138 | + max_attempts: 3 |
| 139 | + timeout_minutes: 10 |
| 140 | + command: bun run build |
| 141 | + |
| 142 | + test-e2e: |
| 143 | + runs-on: ubuntu-latest |
| 144 | + env: |
| 145 | + FAILPROOFAI_TELEMETRY_DISABLED: "1" |
| 146 | + steps: |
| 147 | + - uses: actions/checkout@v6 |
| 148 | + |
| 149 | + - uses: oven-sh/setup-bun@v2 |
| 150 | + with: |
| 151 | + bun-version: latest |
| 152 | + |
| 153 | + - uses: actions/cache@v5 |
| 154 | + with: |
| 155 | + path: ~/.bun/install/cache |
| 156 | + key: bun-${{ runner.os }}-${{ hashFiles('bun.lockb') }} |
| 157 | + restore-keys: bun-${{ runner.os }}- |
| 158 | + |
| 159 | + - name: Install dependencies |
| 160 | + uses: nick-fields/retry@v4 |
| 161 | + with: |
| 162 | + max_attempts: 3 |
| 163 | + timeout_minutes: 5 |
| 164 | + command: bun install --frozen-lockfile |
| 165 | + |
| 166 | + - name: Build npm package (setup E2E env) |
| 167 | + uses: nick-fields/retry@v4 |
| 168 | + with: |
| 169 | + max_attempts: 2 |
| 170 | + timeout_minutes: 15 |
| 171 | + command: bun run test:npx |
| 172 | + |
| 173 | + - name: E2E Hook Tests |
| 174 | + uses: nick-fields/retry@v4 |
| 175 | + with: |
| 176 | + max_attempts: 2 |
| 177 | + timeout_minutes: 10 |
| 178 | + command: bun run test:e2e |
0 commit comments