Skip to content

Merge pull request #338 from kreshuklab/qy/unify-prediction #118

Merge pull request #338 from kreshuklab/qy/unify-prediction

Merge pull request #338 from kreshuklab/qy/unify-prediction #118

name: Conda Build and Test
on: [push]
jobs:
build-and-test-linux:
runs-on: ubuntu-latest
env:
DISPLAY: ":99.0"
steps:
# Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4
# Set up Qt libraries (required for PyQt applications)
- name: Set Up Qt Libraries
uses: tlambert03/setup-qt-libs@v1
# Start X virtual framebuffer for GUI testing
- name: Start Xvfb
run: |
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid \
--make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX
# Set the PlantSeg version based on the current date and time
- name: Set PlantSeg Version
run: echo "RELEASE_VERSION=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
# Print the PlantSeg version name (for debugging purposes)
- name: Print PlantSeg Version
run: echo $RELEASE_VERSION
# Set up Miniconda
- name: Set Up Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: true
activate-environment: ""
channels: local,conda-forge,defaults
channel-priority: false
# Display available Conda environments (for debugging purposes)
- name: List Conda Environments
shell: bash -l {0}
run: conda info --envs
# Build the PlantSeg Conda package
- name: Build PlantSeg Package
shell: bash -l {0}
run: |
conda install -q conda-build
conda build -c conda-forge conda-recipe
# Create a Conda environment for testing
- name: Create PlantSeg Test Environment
run: |
conda create -n plant-seg -c local -c conda-forge plantseg pytest pytest-qt pytest-cov pytest-mock requests-mock
# Run tests using pytest
- name: Run Tests with Pytest
shell: bash -l {0}
run: |
conda activate plant-seg
pytest -s --cov --cov-report=xml
conda deactivate
# Upload Codecov report
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}