Skip to content

Merge remote-tracking branch 'origin/cs/fix-hatch-vcs' into cs/fix-ha… #134

Merge remote-tracking branch 'origin/cs/fix-hatch-vcs' into cs/fix-ha…

Merge remote-tracking branch 'origin/cs/fix-hatch-vcs' into cs/fix-ha… #134

Workflow file for this run

name: Test Examples
on:
push:
branches: ["**"] # https://stackoverflow.com/a/64635612/14658879
jobs:
build-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pixi
run: curl -fsSL https://pixi.sh/install.sh | bash && echo "$HOME/.pixi/bin" >> $GITHUB_PATH
- name: Build release
run: pixi run --manifest-path pixi.toml build-release
- name: Upload conda channel
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: |
/tmp/ecoscope-workflows/release/artifacts/
!/tmp/ecoscope-workflows/release/artifacts/bld
!/tmp/ecoscope-workflows/release/artifacts/src_cache
if-no-files-found: error
compression-level: 0
check-all-recompiled:
needs: build-release
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example: [
"events",
"patrols",
"subject-tracking",
]
steps:
- uses: actions/checkout@v4
- name: Download conda channel
uses: actions/download-artifact@v4
with:
name: release-artifacts
path: /tmp/ecoscope-workflows/release/artifacts
- name: Log conda channel contents
run: ls -lR /tmp/ecoscope-workflows/release/artifacts
- name: Install pixi
run: curl -fsSL https://pixi.sh/install.sh | bash && echo "$HOME/.pixi/bin" >> $GITHUB_PATH
- name: Check all recompiled
run: |
pixi run -e compile \
python3 dev/check-all-recompiled.py examples/${{ matrix.example }}/spec.yaml \
examples/${{ matrix.example }}/ecoscope-workflows-${{ matrix.example }}-workflow
test-examples-params:
needs: check-all-recompiled # only run if all examples recompiles are up to date
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example: [
"events",
"patrols",
"subject-tracking",
]
steps:
- uses: actions/checkout@v4
- name: Download conda channel
uses: actions/download-artifact@v4
with:
name: release-artifacts
path: /tmp/ecoscope-workflows/release/artifacts
- name: Log conda channel contents
run: ls -lR /tmp/ecoscope-workflows/release/artifacts
- name: Install pixi
run: curl -fsSL https://pixi.sh/install.sh | bash && echo "$HOME/.pixi/bin" >> $GITHUB_PATH
- name: Test
run: pixi run --manifest-path pixi.toml -e default pytest-${{ matrix.example }}-params
test-examples-run:
needs: check-all-recompiled # only run if all examples recompiles are up to date
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example: ["events", "patrols", "subject-tracking"]
deployment: ["local", "docker"]
api: ["app", "cli"]
execution-mode: ["async", "sequential"]
exclude:
# at this point, the docker container we are building runs the app only (not the cli)
# if we want to build a version of the container that runs the cli at a later point,
# we can do that, but for now, we are only testing the app in the container
- deployment: "docker"
api: "cli"
steps:
- uses: actions/checkout@v4
- name: Download conda channel
uses: actions/download-artifact@v4
with:
name: release-artifacts
path: /tmp/ecoscope-workflows/release/artifacts
- name: Log conda channel contents
run: ls -lR /tmp/ecoscope-workflows/release/artifacts
- name: Install pixi
run: curl -fsSL https://pixi.sh/install.sh | bash && echo "$HOME/.pixi/bin" >> $GITHUB_PATH
# 'local' deployment test -------------------------------------------------------------------
- name: Test
if: matrix.deployment == 'local'
run: pixi run --manifest-path pixi.toml -e default pytest-${{ matrix.example }}-${{ matrix.api }} ${{ matrix.execution-mode }}
# 'docker' deployment test ------------------------------------------------------------------
- name: Docker build + run
if: matrix.deployment == 'docker'
run: |
pixi run --manifest-path pixi.toml docker-build-${{ matrix.example }}
pixi run --manifest-path pixi.toml docker-run-${{ matrix.example }}
sleep 5
docker ps
docker logs ${{ matrix.example }}
- name: Invoke container with curl
if: matrix.deployment == 'docker'
run: pixi run --manifest-path pixi.toml curl-invoke-${{ matrix.example }} ${{ matrix.execution-mode }}