From c810cd3070359a28a8f7b3e36c4be818651280c1 Mon Sep 17 00:00:00 2001 From: katia-sentry Date: Sun, 13 Apr 2025 20:57:30 -0400 Subject: [PATCH] Add Codecov test analytics workflow --- .github/workflows/main.yml | 8 +++++++- .github/workflows/test.yml | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 54d481921..3a9764f48 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -93,7 +93,7 @@ jobs: run: uv pip install 'pydantic==${{ matrix.pydantic-version }}.*' - run: mkdir coverage - - run: uv run --no-sync coverage run -m pytest + - run: uv run --no-sync coverage run -m pytest --junitxml=coverage/test-results.xml env: COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }} - name: store coverage files @@ -132,6 +132,12 @@ jobs: file: ./coverage.xml env_vars: PYTHON - run: uv run coverage report --fail-under 100 + - name: Upload test results to Codecov + uses: codecov/test-results-action@v1 + with: + files: coverage/test-results.xml + + test-pyodide: name: test on Pyodide diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..96580dc8c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,41 @@ +name: Test + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[test] + + - name: Run tests with coverage + run: | + pytest --cov=logfire --cov-report=xml --junitxml=test-results.xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + files: ./coverage.xml + fail_ci_if_error: true + - name: Upload test results to Codecov + uses: codecov/test-results-action@v1 + with: + files: test-results.xml +