Refactor and simplify testing data fetching #1353
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: RavenPy | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
RAVEN_TESTING_DATA_BRANCH: master | |
jobs: | |
black: | |
name: Code linting | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install tox and setuptools | |
run: | | |
pip install tox | |
pip install --upgrade "setuptools<65.6" | |
- name: Run linting suite | |
run: tox -e black | |
pip: | |
name: Python${{ matrix.python-version }} (${{ matrix.os }}) | |
needs: black | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- tox-env: py38-linux | |
python-version: "3.8" | |
os: ubuntu-latest | |
- tox-env: py38-macos | |
python-version: "3.8" | |
os: macos-latest | |
- tox-env: py39-linux | |
python-version: "3.9" | |
os: ubuntu-latest | |
- tox-env: py310-linux | |
python-version: "3.10" | |
os: ubuntu-latest | |
- tox-env: py311-linux | |
python-version: "3.11" | |
os: ubuntu-latest | |
- tox-env: py311-macos | |
python-version: "3.11" | |
os: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install GDAL (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install libgdal-dev | |
- name: Install GDAL (macOS) | |
if: matrix.os == 'macos-latest' | |
uses: tecolicom/actions-use-homebrew-tools@v1 | |
with: | |
tools: gdal | |
cache: yes | |
- name: Set GDAL_VERSION (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
echo "GDAL_VERSION=$(gdal-config --version)" >> $GITHUB_ENV | |
- name: Set GDAL_VERSION (macOS) | |
if: matrix.os == 'macos-latest' | |
run: | | |
echo "GDAL_VERSION=$(gdalinfo --version | awk '{print $2}' | sed s'/.$//')" >> $GITHUB_ENV | |
- name: Install tox | |
run: | | |
pip install tox~=4.0 | |
- name: Test with tox and report coverage | |
run: | | |
python3 -m tox -e ${{ matrix.tox-env }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_FLAG_NAME: run-${{ matrix.tox-env }} | |
COVERALLS_PARALLEL: true | |
COVERALLS_SERVICE_NAME: github | |
conda: | |
name: Python${{ matrix.python-version }} (${{ matrix.os }}) (Conda) | |
needs: black | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
python-version: "3.9" | |
- os: ubuntu-latest | |
python-version: "3.10" | |
- os: ubuntu-latest | |
python-version: "3.11" | |
- os: macos-latest | |
python-version: "3.9" | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Patch Environment File | |
if: matrix.os == 'windows-latest' | |
run: | | |
sed -i 's/climpred >=2.2.0/xesmf/' environment.yml | |
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }} | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
cache-downloads: true | |
cache-environment: true | |
cache-environment-key: environment-${{ matrix.python-version }}-${{ matrix.os }}-${{ github.head_ref }} | |
environment-file: environment.yml | |
create-args: >- | |
conda | |
python=${{ matrix.python-version }} | |
- name: Conda and Mamba versions | |
run: | | |
conda --version | |
echo "micromamba: $(micromamba --version)" | |
- name: Install RavenPy | |
run: | | |
pip install -e ".[dev]" | |
- name: List installed packages | |
run: | | |
conda list | |
- name: Test RavenPy | |
run: | | |
pytest --cov --numprocesses=logical | |
- name: Report coverage | |
run: coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_FLAG_NAME: run-conda_${{ matrix.python-version }}_${{ matrix.os }} | |
COVERALLS_PARALLEL: true | |
COVERALLS_SERVICE_NAME: github | |
finish: | |
needs: | |
- pip | |
- conda | |
runs-on: ubuntu-latest | |
container: python:3-slim | |
steps: | |
- name: Coveralls Finished | |
run: | | |
pip install --upgrade coveralls | |
coveralls --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_SERVICE_NAME: github |