Skip to content

Commit

Permalink
add test-pip-install for testing not requires ecoscope core tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
cisaacstern committed Sep 6, 2024
1 parent b47e2d4 commit 267f3ec
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build & Test (conda)

on:
push:
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
init-shell: bash
- name: Install all dependencies with conda
shell: bash -leo pipefail {0}
run: | # todo: ecoscope-workflows build variants (e.g. "compile-only" w/out ecoscope-core-tasks, etc.)
run: | # todo: ecoscope-workflows build variants (e.g. "compile-only" w/out ecoscope-core, etc.)
micromamba install python=${{ matrix.python-version }} pytest -c conda-forge --yes
micromamba install ecoscope-workflows \
-c file://$(pwd)/tmp/conda-channel \
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/test-pip-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test (pip)

on:
push:
branches: ["main"]
pull_request:
branches: ["*"]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v4
id: restore-cache
with:
key: "pip-venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}"
path: |
.venv/
- name: If no cache hit, recreate venv
if: steps.restore-cache.outputs.cache-hit == false
run: |
python -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -e ".[test,lithops]"
- name: Run doctests
run: |
.venv/bin/python -m pytest -v ecoscope_workflows/ --doctest-modules \
--ignore=ecoscope_workflows/visualize.py
- name: Test with pytest
run: |
.venv/bin/python -m pytest -m "not requires_ecoscope_core" tests -vvv
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ dependencies = [
"pydantic-settings",
"tomli-w",
# compile-time only; todo: these could actually be optional dependencies
# as they are not required for running workflows (just for compiling them)
"jinja2",
"ruamel.yaml",
"ruff",
]

[project.optional-dependencies]
ecoscope-core-tasks = [
ecoscope-core = [
"ecoscope @ git+https://github.com/wildlife-dynamics/[email protected]"
]
gcs = [
Expand Down

0 comments on commit 267f3ec

Please sign in to comment.