Update README.md #1023
This file contains hidden or 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 | |
on: | |
push: | |
env: | |
GENERATE_WORKFLOW_TEST_RESULTS: false | |
GENERATE_PROCESSOR_TEST_RESULTS: false | |
GENERATE_ENGINE_TEST_RESULTS: false | |
jobs: | |
test-workflow: | |
name: Test Workflow | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GH_PAT || github.token }} | |
submodules: recursive | |
- name: Setup Micromamba | |
uses: mamba-org/setup-micromamba@v2 | |
with: | |
environment-name: spatialyze | |
create-args: >- | |
-c conda-forge | |
python=3.10 | |
poetry=1.5.1 | |
init-shell: none | |
cache-downloads: false | |
- name: Check Python Versions | |
shell: micromamba-shell {0} | |
run: | | |
python --version | |
python3 --version | |
which python | |
which python3 | |
which pip | |
which pip3 | |
which poetry | |
- name: Install Dependencies | |
shell: micromamba-shell {0} | |
run: poetry install --no-interaction --without dev --with test | |
- name: Check Installed Packages | |
shell: micromamba-shell {0} | |
run: pip list | |
- name: Ingest data | |
shell: micromamba-shell {0} | |
run: python ./scripts/ingest_road.py /tmp/__spatialyze__test.duckdb | |
- name: Count Tests | |
shell: micromamba-shell {0} | |
run: | | |
pytest --collect-only -qq tests/workflow | |
pytest --collect-only -q -W ignore::Warning tests/workflow | head -n -2 | wc -l | |
pytest --collect-only -q -W ignore::Warning tests/workflow | head -n -2 | wc -l &> test-count | |
- name: Unit Test | |
shell: micromamba-shell {0} | |
run: pytest --cov=spatialyze --cov-report=xml -vv tests/workflow | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: workflow-coverage | |
path: ./coverage.xml | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: workflow-count | |
path: ./test-count | |
- name: Commit generated test inputs | |
if: ${{ env.GENERATE_WORKFLOW_TEST_RESULTS == 'true' }} | |
run: ./scripts/commit-and-push.sh "[CI] update workflow tests" | |
test-video-processor: | |
name: Test Video Processor | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GH_PAT || github.token }} | |
submodules: recursive | |
- name: Setup Micromamba | |
uses: mamba-org/setup-micromamba@v2 | |
with: | |
environment-name: spatialyze | |
create-args: >- | |
-c conda-forge | |
python=3.10 | |
poetry=1.5.1 | |
init-shell: none | |
cache-downloads: false | |
- name: Check Python Versions | |
shell: micromamba-shell {0} | |
run: | | |
python --version | |
python3 --version | |
which python | |
which python3 | |
which pip | |
which pip3 | |
which poetry | |
- name: Install Dependencies | |
shell: micromamba-shell {0} | |
run: poetry install --no-interaction --without dev --with test | |
- name: Check Installed Packages | |
shell: micromamba-shell {0} | |
run: pip list | |
- name: Ingest data | |
shell: micromamba-shell {0} | |
run: | | |
python ./scripts/ingest_road.py /tmp/__spatialyze__test.duckdb | |
- name: Count Tests | |
shell: micromamba-shell {0} | |
run: | | |
pytest --collect-only -qq tests/video_processor | |
pytest --collect-only -q -W ignore::Warning tests/video_processor | head -n -2 | wc -l | |
pytest --collect-only -q -W ignore::Warning tests/video_processor | head -n -2 | wc -l &> test-count | |
- name: Unit Test | |
shell: micromamba-shell {0} | |
run: pytest --cov=spatialyze --cov-report=xml -vv tests/video_processor | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: video-processor-coverage | |
path: ./coverage.xml | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: video-processor-count | |
path: ./test-count | |
- name: Commit formatted changes | |
if: ${{ env.GENERATE_PROCESSOR_TEST_RESULTS == 'true' }} | |
run: ./scripts/commit-and-push.sh "[CI] update video processor tests" | |
test-engine-and-interface: | |
name: Test Engine and Interface | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GH_PAT || github.token }} | |
- name: Setup Micromamba | |
uses: mamba-org/setup-micromamba@v2 | |
with: | |
environment-name: spatialyze | |
create-args: >- | |
-c conda-forge | |
python=3.10 | |
poetry=1.5.1 | |
init-shell: none | |
cache-downloads: false | |
- name: Check Python Versions | |
shell: micromamba-shell {0} | |
run: | | |
python --version | |
python3 --version | |
which python | |
which python3 | |
which pip | |
which pip3 | |
which poetry | |
- name: Install Dependencies | |
shell: micromamba-shell {0} | |
run: poetry install --no-interaction --without dev,cv --with test | |
- name: Check Installed Packages | |
shell: micromamba-shell {0} | |
run: pip list | |
- name: Ingest data | |
shell: micromamba-shell {0} | |
run: | | |
python ./scripts/ingest_road.py /tmp/__spatialyze__test.duckdb | |
python ./scripts/import_tables.py /tmp/__spatialyze__test.duckdb | |
- name: Generate Image data | |
shell: micromamba-shell {0} | |
run: python scripts/fake-images.py | |
- name: Count Tests | |
shell: micromamba-shell {0} | |
run: | | |
pytest --collect-only -qq tests/engine tests/interface | |
pytest --collect-only -q -W ignore::Warning tests/engine tests/interface | head -n -2 | wc -l | |
pytest --collect-only -q -W ignore::Warning tests/engine tests/interface | head -n -2 | wc -l &> test-count | |
- name: Unit Test | |
shell: micromamba-shell {0} | |
run: pytest --cov=spatialyze --cov-report=xml -vv tests/engine tests/interface | |
- name: Commit test changes | |
if: ${{ env.GENERATE_ENGINE_TEST_RESULTS == 'true' }} | |
run: ./scripts/commit-and-push.sh "[CI] update engine and interface tests" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: engine-and-interface-coverage | |
path: ./coverage.xml | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: engine-and-interface-count | |
path: ./test-count | |
upload-coverage: | |
name: Upload Coverage | |
needs: [test-video-processor, test-engine-and-interface, test-workflow] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Coverage | |
uses: actions/download-artifact@v4 | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
# - name: Download Coverage | |
# uses: actions/download-artifact | |
# with: | |
# name: video-processor-coverage | |
# path: ./video-processor-coverage | |
# - name: Download Coverage | |
# uses: actions/download-artifact | |
# with: | |
# name: engine-and-interface-coverage | |
# path: ./engine-and-interface-coverage | |
# - name: Combine Coverage | |
# shell: micromamba-shell {0} | |
# run: | | |
# pip install coverage | |
# coverage combine ./video-processor-coverage ./engine-and-interface-coverage | |
# coverage xml | |
# coverage report | |
# coverage html | |
# coverage-badge -o coverage.svg -f | |
# - name: Upload Coverage | |
# uses: actions/upload-artifact | |
# with: | |
# name: coverage | |
# path: ./coverage.xml | |
# - name: Upload Coverage | |
# uses: actions/upload-artifact | |
# with: | |
# name: coverage-badge | |
# path: ./coverage.svg | |
test-count: | |
name: Test Count | |
needs: [test-video-processor, test-engine-and-interface, test-workflow] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Count | |
uses: actions/download-artifact@v4 | |
with: | |
name: video-processor-count | |
path: ./video-processor-test-count | |
- name: Download Count | |
uses: actions/download-artifact@v4 | |
with: | |
name: engine-and-interface-count | |
path: ./engine-and-interface-test-count | |
- name: Download Count | |
uses: actions/download-artifact@v4 | |
with: | |
name: workflow-count | |
path: ./workflow-test-count | |
- name: Combine Counts | |
run: | | |
cat ./video-processor-test-count/* ./engine-and-interface-test-count/* ./workflow-test-count/* | awk '{s+=$1} END {print s}' &> test-count | |
echo "Total tests: $(cat test-count)" | |
- name: Download Count Badge | |
run: | | |
curl -o ./test-count-badge.svg https://img.shields.io/badge/$(cat test-count | tr -d " \t\n\r")-4572a1.svg?label=Test%20Count\&style=for-the-badge | |
rm -rf ./*test-count | |
- name: Deploy | |
uses: exuanbo/actions-deploy-gist@v1 | |
with: | |
token: ${{ secrets.GIST_PAT }} | |
gist_id: b32bb8bf89a237c0f13da5e17abc1cd9 | |
file_path: test-count-badge.svg | |
file_type: text |