Skip to content

CI(deps): Update dependency pylint to v4 (#6497) #12114

CI(deps): Update dependency pylint to v4 (#6497)

CI(deps): Update dependency pylint to v4 (#6497) #12114

Workflow file for this run

---
name: macOS
# Build and run tests on macOS
on:
push:
branches:
- main
- releasebranch_*
pull_request:
env:
CACHE_NUMBER: 0
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
permissions: {}
jobs:
macos_build:
name: macOS build
runs-on: macos-15
env:
PYTHONWARNINGS: always
steps:
- name: Info
run: |
echo "macOS version $(sw_vers -productVersion)"
echo "architecture $(uname -a)"
- name: Disabling Spotlight
run: sudo mdutil -a -i off
- name: Uninstalling Homebrew
run: |
echo "Moving directories..."
sudo mkdir /opt/local-off /opt/homebrew-off
test ! -d /usr/local || /usr/bin/sudo /usr/bin/find /usr/local \
-mindepth 1 -maxdepth 1 -type d -print -exec /bin/mv {} \
/opt/local-off/ \;
test ! -d /opt/homebrew || /usr/bin/sudo /usr/bin/find /opt/homebrew \
-mindepth 1 -maxdepth 1 -type d -print -exec /bin/mv {} \
/opt/homebrew-off/ \;
echo "Removing files..."
test ! -d /usr/local || /usr/bin/sudo /usr/bin/find /usr/local \
-mindepth 1 -maxdepth 1 -type f -print -delete
test ! -d /opt/homebrew || /usr/bin/sudo /usr/bin/find /opt/homebrew \
-mindepth 1 -maxdepth 1 -type f -print -delete
# Rehash to forget about the deleted files
hash -r
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Get current date cache key segment
id: date
# Year and week of year so cache key changes weekly
run: echo "date=$(date +%Y-%U)" >> "${GITHUB_OUTPUT}"
- name: Prepare Conda environment file
env:
test_dependencies: |
ipython
pytest
pytest-github-actions-annotate-failures
pytest-timeout
pytest-xdist
pyyaml
run: |
cp ./macos/files/conda-requirements-dev-arm64.txt "${RUNNER_TEMP}/macos_dependencies.txt"
echo "${test_dependencies// /\n}" >> "${RUNNER_TEMP}/macos_dependencies.txt"
- name: Setup Mamba
uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 # v2.0.7
with:
init-shell: bash
environment-file: ${{ runner.temp }}/macos_dependencies.txt
environment-name: grass-env
# Persist on the same period (date).
cache-environment-key: environment-${{ steps.date.outputs.date }}
- name: Environment info
shell: bash -el {0}
run: |
printenv | sort
$CC --version
- name: Create installation directory
run: mkdir "${HOME}/install"
- name: Build and install
shell: micromamba-shell {0}
run: source ./.github/workflows/macos_install.sh "${HOME}/install"
- name: Add the bin directory to PATH
run: echo "${HOME}/install/bin" >> "${GITHUB_PATH}"
- name: Check installed version
if: ${{ !cancelled() }}
shell: micromamba-shell {0}
run: source ./.github/workflows/print_versions.sh
- name: Run pytest with multiple workers in parallel
shell: micromamba-shell {0}
run: |
PYTHONPATH="$(grass --config python_path):${PYTHONPATH}"
LD_LIBRARY_PATH="$(grass --config path)/lib:${LD_LIBRARY_PATH}"
export PYTHONPATH
export LD_LIBRARY_PATH
pytest \
@.github/workflows/pytest_args_ci.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)
shell: micromamba-shell {0}
run: |
PYTHONPATH="$(grass --config python_path):${PYTHONPATH}"
LD_LIBRARY_PATH="$(grass --config path)/lib:${LD_LIBRARY_PATH}"
export PYTHONPATH
export LD_LIBRARY_PATH
pytest \
@.github/workflows/pytest_args_ci.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)
shell: micromamba-shell {0}
run: |
PYTHONPATH="$(grass --config python_path):${PYTHONPATH}"
LD_LIBRARY_PATH="$(grass --config path)/lib:${LD_LIBRARY_PATH}"
export PYTHONPATH
export LD_LIBRARY_PATH
pytest \
@.github/workflows/pytest_args_gunittest.txt \
--junitxml=pytest.gunittest.junit.xml
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
with:
exclude: gui
flags: macos-pytest-python
token: ${{ secrets.CODECOV_TOKEN }}
- name: Cache GRASS Sample Dataset
id: cached-data
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: sample-data/nc_spm_full_v2alpha2.tar.gz
key: nc_spm_full_v2alpha2.tar.gz
enableCrossOsArchive: true
- name: Download GRASS Sample Dataset
if: steps.cached-data.outputs.cache-hit != 'true'
run: |
mkdir -p sample-data
curl -L "$SAMPLE_DATA" -o sample-data/nc_spm_full_v2alpha2.tar.gz
env:
SAMPLE_DATA: "https://grass.osgeo.org/sampledata/north_carolina/\
nc_spm_full_v2alpha2.tar.gz"
- name: Save GRASS Sample Dataset to cache
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
if: steps.cached-data.outputs.cache-hit != 'true'
with:
path: sample-data/nc_spm_full_v2alpha2.tar.gz
key: nc_spm_full_v2alpha2.tar.gz
- name: Run gunittest tests
shell: micromamba-shell {0}
run: .github/workflows/test_thorough.sh --config .github/workflows/macos_gunittest.cfg
env:
SAMPLE_DATA_URL: "file://${{ github.workspace }}/sample-data/\
nc_spm_full_v2alpha2.tar.gz"
- name: Make HTML test report available
if: ${{ !cancelled() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: testreport-macOS
path: testreport
retention-days: 3