ci: Fixes behavior that was preventing proper comparison due to typos (#2907) #2592
Workflow file for this run
This file contains 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
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@v5-scie-pants | |
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. |