Skip to content

Commit

Permalink
merge ci-additional workflow into ci (#518)
Browse files Browse the repository at this point in the history
* merge ci-additional workflow into ci

* update cache key

* indent

* rename env files

* fix path to env files

* version check file name

* fix env selection

* fix if check
  • Loading branch information
mathause committed Mar 21, 2024
1 parent aae41cf commit 245704d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 77 deletions.
65 changes: 1 addition & 64 deletions .github/workflows/ci-additional.yaml
Expand Up @@ -12,69 +12,6 @@ concurrency:
cancel-in-progress: true

jobs:
test:
name: py${{ matrix.python-version }}-${{ matrix.env }}
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
include:
- env: "bare-minimum"
python-version: "3.9"
- env: "min-all-deps"
python-version: "3.9"
- env: "shapely_lt_2"
python-version: "3.10"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags.

- name: Set environment variables
run: |
PY=${{ matrix.python-version }}
# replace "." in matrix.python-version
PY=${PY//./}
echo "CONDA_ENV_FILE=ci/requirements/py${PY}-${{ matrix.env }}.yml" >> $GITHUB_ENV
- name: Create conda environment
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
cache-downloads-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}"
environment-file: ${{ env.CONDA_ENV_FILE }}
create-args: >-
python=${{ matrix.python-version }}
- name: Install regionmask
run: |
python -m pip install --no-deps -e .
- name: Version info
run: |
conda info -a
conda list
- name: Import regionmask
run: |
python -c "import regionmask"
- name: Run tests
timeout-minutes: 15
run: python -u -m pytest
--cov=regionmask
--cov-report=xml
$PYTEST_EXTRA_FLAGS

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests,${{ matrix.env }}
env_vars: RUNNER_OS
name: codecov-umbrella
fail_ci_if_error: false

min-version-policy:
name: Minimum Version Policy
Expand All @@ -101,4 +38,4 @@ jobs:

- name: minimum versions policy
run: |
python ci/min_deps_check.py ci/requirements/py39-min-all-deps.yml
python ci/min_deps_check.py ci/requirements/min-all-deps.yml
34 changes: 21 additions & 13 deletions .github/workflows/ci.yaml
Expand Up @@ -13,7 +13,7 @@ concurrency:

jobs:
test:
name: py${{ matrix.python-version }}
name: py${{ matrix.python-version }} ${{ matrix.env }}
runs-on: ${{ matrix.os }}
defaults:
run:
Expand All @@ -22,45 +22,53 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
# Bookend python versions
python-version: ["3.9", "3.12"]
env: [""]
include:
- env: "bare-minimum"
os: "ubuntu-latest"
python-version: "3.9"
- env: "min-all-deps"
os: "ubuntu-latest"
python-version: "3.9"
- env: "shapely_lt_2"
os: "ubuntu-latest"
python-version: "3.10"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags.

- name: Set environment variables
run: |
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
if [[ "${{ matrix.env }}" == "" ]]; then
echo "CONDA_ENV_FILE=environment.yml" >> $GITHUB_ENV
else
echo "CONDA_ENV_FILE=${{ matrix.env }}.yml" >> $GITHUB_ENV
fi
- name: Create conda environment
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
cache-downloads-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}"
environment-file: ci/requirements/environment.yml
cache-downloads-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{ env.CONDA_ENV_FILE }}"
environment-file: "ci/requirements/${{ env.CONDA_ENV_FILE }}"
create-args: >-
python=${{ matrix.python-version }}
- name: Install regionmask
run: |
python -m pip install --no-deps -e .
- name: Version info
run: |
conda info -a
conda list
- name: Import regionmask
run: |
python -c "import regionmask"
- name: Run tests
timeout-minutes: 5
run: python -u -m pytest
--cov=regionmask
--cov-report=xml
--junitxml=test-results/${{ runner.os }}-${{ matrix.python-version }}.xml
--junitxml=pytest.xml

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 245704d

Please sign in to comment.