diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a46064577..fe8fe0685 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: run: make -j3 static-check test: - name: Test + name: Unit Tests runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }} steps: - name: Checkout code @@ -66,8 +66,16 @@ jobs: - uses: ./.github/actions/setup-cmux - - name: Run tests - run: make test-unit + - name: Run tests with coverage + run: bun test --coverage --coverage-reporter=lcov src + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/lcov.info + flags: unit-tests + fail_ci_if_error: false integration-test: name: Integration Tests @@ -80,12 +88,20 @@ jobs: - uses: ./.github/actions/setup-cmux - - name: Run integration tests - run: make test-integration + - name: Run integration tests with coverage + run: TEST_INTEGRATION=1 bun x jest --coverage tests env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/lcov.info + flags: integration-tests + fail_ci_if_error: false + storybook-test: name: Storybook Interaction Tests runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }} diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..3a07c8ae6 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,45 @@ +# Codecov Configuration +# https://docs.codecov.com/docs/codecovyml-reference + +# Disable PR comments - just show status checks +comment: false + +coverage: + # Coverage precision (decimal places) + precision: 2 + round: down + range: 70..100 + + status: + # Project coverage status - informational only + project: + default: + target: auto # Compare to base commit + threshold: 5% # Allow 5% drop without changing status + informational: true # Won't block PRs + + # Patch coverage status - informational only + patch: + default: + target: auto # Compare to base commit + threshold: 5% # Allow 5% drop without changing status + informational: true # Won't block PRs + +# Flag configuration to track unit vs integration test coverage +flags: + unit-tests: + paths: + - src/** + carryforward: false + integration-tests: + paths: + - tests/** + carryforward: false + +# Ignore common non-source paths +ignore: + - "**/*.test.ts" + - "**/*.test.tsx" + - "**/dist/**" + - "**/node_modules/**" + - "**/coverage/**"