Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 38 additions & 37 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
name: Build and run Python unit tests
name: Unit tests

on:
workflow_call:
push:
branches:
- main
pull_request:

on: push
permissions:
contents: read
jobs:
test-linux:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- uses: pre-commit/action@v3.0.1

test:
needs: [lint]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v3
- uses: actions/checkout@v5
with:
python-version: '3.8'
- name: Add system deps and exiftool
lfs: true
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install libzbar0 make perl
wget https://cpan.metacpan.org/authors/id/E/EX/EXIFTOOL/Image-ExifTool-12.76.tar.gz
tar -xzf Image-ExifTool-12.76.tar.gz
pushd Image-ExifTool-12.76/
perl Makefile.PL
make test
sudo make install
popd
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
source "$CONDA/etc/profile.d/conda.sh"
hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda update -n base conda
conda info -a
conda env create -f micasense_conda_env.yml
conda activate micasense
sudo apt-get -qq install exiftool libgdal-dev libzbar0t64
GDAL_VERSION=$(gdal-config --version)
pip install "gdal==$GDAL_VERSION"
- name: Test with pytest
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda activate micasense
git lfs install
git lfs pull
pytest --junit-xml=test-results.xml
pip install -e .[test]
pytest -m "not newgdal" --cov=./ --cov-report=xml
- uses: actions/upload-artifact@v4
if: ${{ matrix.python-version == '3.12' }}
with:
name: coverage-report
path: coverage.xml
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
.ipynb_checkpoints
__pycache__
/dist/
/*.egg-info
/*.egg-info
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-illegal-windows-names
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.14.6
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi ] # avoid jupyter
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi ] # avoid jupyter
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli
types_or: [python, rst, markdown]
files: ^(assume|docs|tests)/
Loading