Add pytests and workflow for PRs #10
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 | |
lfs: false | |
- name: Restore LFS cache | |
uses: actions/cache@v3 | |
with: | |
path: .git/lfs | |
key: lfs-${{ runner.os }}-${{ github.sha }} | |
restore-keys: | | |
lfs-${{ runner.os }}- | |
- name: Fetch only needed LFS files | |
run: | | |
git lfs install | |
git lfs fetch --include="tests/gold_standard_data/**" | |
git lfs checkout | |
- 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 | |