Merge remote-tracking branch 'origin/cs/fix-hatch-vcs' into cs/fix-ha… #138
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: Test Examples | |
on: | |
push: | |
branches: ["**"] # https://stackoverflow.com/a/64635612/14658879 | |
jobs: | |
build-release: | |
# we cannot assume that pushes by humans to prs are recompiled, so to save ci cycles, we only | |
# run these tests on pushes to prs by elebot (which we know are recompiled). we also test on | |
# all pushes to main, since we know that the content is recompiled there as well. | |
if: (github.ref != 'refs/heads/main' && github.actor == 'ecoscope-elebot') || (github.ref == 'refs/heads/main') | |
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: | |
# we trust elebot, but having broken examples is a big deal, so we run this additional check | |
# before running the tests on the examples. this is to ensure that the examples are 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 }} |