Skip to content

Commit

Permalink
ci: add minimum-versions and pre-release-versions
Browse files Browse the repository at this point in the history
Includes a refactor of the Python setup into a repository-specific action to
reduce duplication.
  • Loading branch information
gadomski committed Feb 9, 2022
1 parent 37c7ca2 commit c6ed1d4
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 34 deletions.
36 changes: 36 additions & 0 deletions .github/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Setup
description: Set up the stactools testing environment with conda, pip, and associated caches
inputs:
python-version:
description: Python version to set up w/ conda
required: True
pip-cache-hash:
description: The hash used for the pip cache
required: False
default: ${{ hashFiles('setup.cfg', 'requirements-dev.txt') }}
runs:
using: composite
steps:
- name: Set up conda cache
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }}
restore-keys: ${{ runner.os }}-conda-
- name: Set up pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ inputs.pip-cache-hash }}
restore-keys: ${{ runner.os }}-pip-
- name: Set up Conda with Python ${{ inputs.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ inputs.python-version }}
- name: Update Conda's environemnt
run: conda env update -f environment.yml -n test
shell: bash -l {0}
- name: Update pip
run: python -m pip install --upgrade pip
shell: bash -l {0}
121 changes: 87 additions & 34 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,26 @@ env:
DOCKER_IMAGE_NAME: ${{ github.repository }}

jobs:
codecov:
name: codecov
standard:
name: Standard
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Execute linters and test suites
run: ./docker/cibuild
- name: Upload All coverage to Codecov
uses: codecov/[email protected]
- uses: ./.github/setup
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
python-matrix:
name: python-matrix
python-version: ${{ matrix.python-version }}
- name: Update
run: ./scripts/update
- name: Test
run: ./scripts/test
extra-requires:
name: Extra requires
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -35,36 +40,84 @@ jobs:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Set up conda cache
uses: actions/cache@v2
- uses: ./.github/setup
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ hashFiles('**/environment.yml') }}
restore-keys: ${{ runner.os }}-conda-
- name: Set up pip cache
uses: actions/cache@v2
python-version: ${{ matrix.python-version }}
- name: Install with extra_requires
run: pip install '.[all]'
- name: Install development dependencies
run: pip install -r requirements-dev.txt
- name: Test
run: ./scripts/test
minimum-versions:
name: Minimum versions
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: ./.github/setup
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg', '**/requirements-dev.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Set up Conda with Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
python-version: ${{ matrix.python-version }}
pip-cache-hash: ${{ hashFiles('requirements-min.txt', 'requirements-dev.txt') }}
- name: Install minimum requirements
run: pip install -r requirements-min.txt
- name: Install the package
run: pip install .
- name: Install development dependencies
run: pip install -r requirements-dev.txt
- name: Test
run: scripts/test
pre-release-versions:
name: Pre-release versions
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: ./.github/setup
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Update Conda's environemnt
run: conda env update -f environment.yml -n test
- name: Update
run: scripts/update
- name: Install pre-release versions of rasterio and pystac
run: pip install -U --pre pystac rasterio
- name: Run tests
run: scripts/test
env:
PROJ_LIB: false
codecov:
name: Codecov
needs:
- standard
- extra-requires
- minimum-versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Execute linters and test suites
run: ./scripts/cibuild
- name: Install with extra_requires
run: pip install -e '.[all]'
- name: Test again
run: ./scripts/test
run: ./docker/cibuild
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
docker:
name: docker
name: Docker
needs:
- codecov
- python-matrix
- standard
- extra-requires
- minimum-versions
permissions:
contents: read
packages: write
Expand Down

0 comments on commit c6ed1d4

Please sign in to comment.