Skip to content

coverage

coverage #2221

Workflow file for this run

name: coverage
on:
pull_request:
types: [closed]
schedule:
# ref) https://crontab.guru/
# The time is based on UTC
- cron: '0 15 * * 1-5'
workflow_dispatch:
jobs:
test-coverage:
if: ${{ contains(fromJson('["schedule", "workflow_dispatch"]'), github.event_name) || (!contains(github.event.pull_request.labels.*.name, 'skip:ci') && github.event.pull_request.merged == true) }}
runs-on: [ubuntu-latest-8-cores]
steps:
- name: Checkout the revision
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Extract Python version from pants.toml
run: |
PYTHON_VERSION=$(grep -m 1 -oP '(?<=CPython==)([^"]+)' pants.toml)
echo "PANTS_CONFIG_FILES=pants.ci.toml" >> $GITHUB_ENV
echo "PROJECT_PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_ENV
- name: Set up Python as Runtime
uses: actions/setup-python@v5
with:
python-version: ${{ env.PROJECT_PYTHON_VERSION }}
cache: pip
- name: Bootstrap Pants
uses: pantsbuild/actions/init-pants@v8
with:
gha-cache-key: pants-cache-main-1-coverage-py${{ env.PROJECT_PYTHON_VERSION }}-${{ runner.os }}-${{ runner.arch }}
named-caches-hash: ${{ hashFiles('python*.lock', 'tools/*.lock') }}
cache-lmdb-store: 'true'
- name: Run the full test suite
timeout-minutes: 15
run: |
# configure redis sentinel cluster hostnames for testing
grep -q "127.0.0.1 node01" /etc/hosts || echo "127.0.0.1 node01" | sudo tee -a /etc/hosts
grep -q "127.0.0.1 node02" /etc/hosts || echo "127.0.0.1 node02" | sudo tee -a /etc/hosts
grep -q "127.0.0.1 node03" /etc/hosts || echo "127.0.0.1 node03" | sudo tee -a /etc/hosts
pants test --use-coverage tests:: -- -m 'not integration' -v
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Upload pants log
uses: actions/upload-artifact@v4
with:
name: pants.coverage.log
path: .pants.d/workdir/pants.log
if: always() # We want the log even on failures.