Add pytests and workflow for PRs #4
Workflow file for this run
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: Build C code and run tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libpng-dev \ | |
libyaml-dev \ | |
libgsl-dev \ | |
libgdal-dev \ | |
libopencv-dev \ | |
cmake \ | |
build-essential \ | |
python3-dev | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest | |
cd scripts/python | |
pip install -e . | |
- name: Configure and build C code | |
run: | | |
mkdir -p build | |
cd build | |
cmake -DWITH_OPENCV=ON .. | |
make -j$(nproc) | |
- name: Run tests | |
run: | | |
pytest --maxfail=3 --tb=short | |