chore: bump version #2063
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Created using @tscircuit/plop (npm install -g @tscircuit/plop) | |
| name: Bun Test | |
| on: | |
| pull_request: | |
| env: | |
| SKIP_PR_TITLE: "chore: bump version" | |
| jobs: | |
| validate-test-matrix: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check if should skip | |
| id: should-skip | |
| run: | | |
| if [[ "${{ github.event.pull_request.title }}" == "${{ env.SKIP_PR_TITLE }}" ]]; then | |
| echo "Skipping validation - this is a version bump PR" | |
| exit 0 | |
| fi | |
| - name: Checkout code | |
| if: github.event.pull_request.title != env.SKIP_PR_TITLE | |
| uses: actions/checkout@v4 | |
| - name: Setup bun | |
| if: github.event.pull_request.title != env.SKIP_PR_TITLE | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.1 | |
| - name: Validate test matrix covers all directories | |
| if: github.event.pull_request.title != env.SKIP_PR_TITLE | |
| run: bun run scripts/validate-test-matrix.js | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| needs: validate-test-matrix | |
| strategy: | |
| matrix: | |
| test-dir: [circuit-runner, custom-component-with-fsmap, examples, features, node-resolution, repros, util-fns] | |
| steps: | |
| - name: Check if should skip | |
| id: should-skip | |
| run: | | |
| if [[ "${{ github.event.pull_request.title }}" == "${{ env.SKIP_PR_TITLE }}" ]]; then | |
| echo "Skipping tests - this is a version bump PR" | |
| exit 0 | |
| fi | |
| - name: Checkout code | |
| if: github.event.pull_request.title != env.SKIP_PR_TITLE | |
| uses: actions/checkout@v4 | |
| - name: Setup bun | |
| if: github.event.pull_request.title != env.SKIP_PR_TITLE | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.1 | |
| - name: Install dependencies | |
| if: github.event.pull_request.title != env.SKIP_PR_TITLE | |
| run: bun install | |
| - name: Build project | |
| if: github.event.pull_request.title != env.SKIP_PR_TITLE | |
| run: bun run build | |
| - name: Run tests for ${{ matrix.test-dir }} | |
| if: github.event.pull_request.title != env.SKIP_PR_TITLE | |
| run: | | |
| mapfile -t test_files < <(find tests/${{ matrix.test-dir }} -type f \( -name "*.test.ts" -o -name "*.test.tsx" \) | sort) | |
| if [ ${#test_files[@]} -eq 0 ]; then | |
| echo "No test files found in tests/${{ matrix.test-dir }}." | |
| exit 0 | |
| fi | |
| for test_file in "${test_files[@]}"; do | |
| echo "Running tests in $test_file" | |
| attempt=1 | |
| while [ $attempt -le 4 ]; do | |
| if bun test "$test_file" --timeout 30000; then | |
| code=0 | |
| else | |
| code=$? | |
| fi | |
| if [ $code -eq 0 ]; then | |
| break | |
| fi | |
| if [ $code -ne 139 ] && [ $code -ne 132 ]; then | |
| exit $code | |
| fi | |
| if [ $attempt -eq 4 ]; then | |
| echo "Segmentation fault or illegal instruction detected for $test_file after $attempt attempts (exit=$code)." | |
| exit $code | |
| fi | |
| attempt=$((attempt + 1)) | |
| echo "Segfault (139) or illegal instruction (132) detected for $test_file, retrying ($attempt/4)..." | |
| done | |
| done |