checks: Update pre-commit config and tools versions #13808
Workflow file for this run
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
--- | |
name: pytest | |
on: | |
push: | |
branches: | |
- main | |
- releasebranch_* | |
pull_request: | |
permissions: {} | |
jobs: | |
pytest: | |
concurrency: | |
group: >- | |
${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}-${{ | |
matrix.os }}-${{ matrix.python-version }} | |
cancel-in-progress: true | |
strategy: | |
matrix: | |
os: | |
- ubuntu-24.04 | |
python-version: | |
- "3.10" | |
- "3.13" | |
fail-fast: true | |
runs-on: ${{ matrix.os }} | |
env: | |
FORCE_COLOR: 1 # for software including pip: https://force-color.org/ | |
CLICOLOR_FORCE: 1 # for other software including ninja: https://bixense.com/clicolors/ | |
PYTHONWARNINGS: always | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip # zizmor: ignore[cache-poisoning] This pytest workflow not used for release artifacts | |
allow-prereleases: true | |
- name: Install non-Python dependencies | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y wget git gawk findutils | |
LC_ALL=C.UTF-8 sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable | |
sudo apt-get update -y | |
xargs -a <(awk '! /^ *(#|$)/' ".github/workflows/apt.txt") -r -- \ | |
sudo apt-get install -y --no-install-recommends --no-install-suggests | |
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1 | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --break-system-packages -r .github/workflows/python_requirements.txt | |
pip install --break-system-packages -r .github/workflows/optional_requirements.txt | |
pip install --break-system-packages pytest pytest-timeout \ | |
pytest-github-actions-annotate-failures pytest-xdist pytest-cov | |
- name: Create installation directory | |
run: | | |
mkdir "${HOME}/install" | |
- name: Set number of cores for compilation | |
run: | | |
echo "MAKEFLAGS=-j$(nproc)" >> "${GITHUB_ENV}" | |
- name: Build | |
run: | | |
".github/workflows/build_${MATRIX_OS}.sh" "${HOME}/install" | |
env: | |
MATRIX_OS: ${{ matrix.os }} | |
- name: Add the bin directory to PATH | |
run: | | |
echo "${HOME}/install/bin" >> "${GITHUB_PATH}" | |
- name: Print installed versions | |
if: always() | |
run: .github/workflows/print_versions.sh | |
- name: Test executing of the grass command | |
run: .github/workflows/test_simple.sh | |
- name: Run pytest with multiple workers in parallel | |
run: | | |
PYTHONPATH="$(grass --config python_path):${PYTHONPATH}" | |
LD_LIBRARY_PATH="$(grass --config path)/lib:${LD_LIBRARY_PATH}" | |
INITIAL_GISBASE="$(grass --config path)" | |
INITIAL_PWD="${PWD}" | |
export PYTHONPATH | |
export LD_LIBRARY_PATH | |
export INITIAL_GISBASE | |
export INITIAL_PWD | |
pytest \ | |
@.github/workflows/pytest_args_ci.txt \ | |
@.github/workflows/pytest_args_cov.txt \ | |
@.github/workflows/pytest_args_parallel.txt \ | |
--junitxml=pytest.xdist.junit.xml \ | |
-k 'not testsuite' | |
- name: Run pytest with a single worker (for tests marked with needs_solo_run) | |
run: | | |
PYTHONPATH="$(grass --config python_path):${PYTHONPATH}" | |
LD_LIBRARY_PATH="$(grass --config path)/lib:${LD_LIBRARY_PATH}" | |
INITIAL_GISBASE="$(grass --config path)" | |
INITIAL_PWD="${PWD}" | |
export PYTHONPATH | |
export LD_LIBRARY_PATH | |
export INITIAL_GISBASE | |
export INITIAL_PWD | |
pytest \ | |
@.github/workflows/pytest_args_ci.txt \ | |
@.github/workflows/pytest_args_cov.txt \ | |
@.github/workflows/pytest_args_not_parallel.txt \ | |
--junitxml=pytest.needs_solo_run.junit.xml \ | |
-k 'not testsuite' | |
- name: Run pytest with a single worker (for gunittest-based tests) | |
run: | | |
PYTHONPATH="$(grass --config python_path):${PYTHONPATH}" | |
LD_LIBRARY_PATH="$(grass --config path)/lib:${LD_LIBRARY_PATH}" | |
INITIAL_GISBASE="$(grass --config path)" | |
INITIAL_PWD="${PWD}" | |
export PYTHONPATH | |
export LD_LIBRARY_PATH | |
export INITIAL_GISBASE | |
export INITIAL_PWD | |
pytest \ | |
@.github/workflows/pytest_args_cov.txt \ | |
@.github/workflows/pytest_args_gunittest.txt \ | |
--junitxml=pytest.gunittest.junit.xml | |
- name: Fix non-standard installed script paths in coverage data | |
run: | | |
PYTHONPATH="$(grass --config python_path):${PYTHONPATH}" | |
LD_LIBRARY_PATH="$(grass --config path)/lib:${LD_LIBRARY_PATH}" | |
INITIAL_GISBASE="$(grass --config path)" | |
INITIAL_PWD="${PWD}" | |
export PYTHONPATH | |
export LD_LIBRARY_PATH | |
export INITIAL_GISBASE | |
export INITIAL_PWD | |
python utils/coverage_mapper.py | |
coverage combine | |
coverage html | |
- name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1 | |
with: | |
exclude: gui | |
flags: pytest-python-${{ matrix.python-version }} | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 | |
with: | |
verbose: true | |
flags: pytest-python-${{ matrix.python-version }} | |
name: pytest-python-${{ matrix.python-version }} | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Make python-only code coverage test report available | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: python-codecoverage-report-${{ matrix.os }}-${{ matrix.python-version }} | |
path: coverage_html_report | |
retention-days: 1 | |
pytest-success: | |
name: pytest Result | |
needs: | |
- pytest | |
if: ${{ always() }} | |
uses: ./.github/workflows/verify-success.yml | |
with: | |
needs_context: ${{ toJson(needs) }} |