Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: added action for testing *-tools #85

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
271 changes: 271 additions & 0 deletions .github/workflows/test_tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
name: Test Image/Tabular/MM Tools

on:
workflow_dispatch:
pull_request:
push:
branches-ignore:
- master

jobs:
build_wheels:
name: Build Wheels
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install build tools
run: |
python -m pip install twine build
- name: Build wheels
run: |
python -m build
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: wheels
path: dist/*.whl
retention-days: 1

find_image_tools:
needs: build_wheels
name: Find Image Tools
uses: PolusAI/image-tools/.github/workflows/find-all-tools.yml@master

image-tests:
name: Images | ${{ matrix.tool_name }}
runs-on: ubuntu-latest
needs: find_image_tools
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find_image_tools.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: 'PolusAI/image-tools'
ref: "master"
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Conda | Install
uses: conda-incubator/setup-miniconda@v3
- name: Poetry | Install
uses: abatilo/actions-poetry@v3
- name: Poetry | Config
run: |
poetry config virtualenvs.create false
- name: Tests | Pre-Update
run: |
# We see seg-faults during the cleanup phase of running test on the imagej tools.
set -e
trap 'case $? in
139) echo "::warning::Seg-fault detected in ${{ matrix.tool_name }}. Please check the logs for more information." && exit 0;;
esac' ERR

cd ${{ matrix.tool_dir }}

if [ -f "environment.yml" ]; then
conda init bash
source ~/.bashrc
conda env create -f environment.yml
conda activate project_env
pip install -e ".[all]"
conda install pytest
python -m pytest -v
else
poetry install
poetry run pytest -v
fi
- name: Download Wheels
uses: actions/download-artifact@v4
with:
name: wheels
path: dist
- name: Tests | Post-Update
run: |
set -e
trap 'case $? in
139) echo "::warning::Seg-fault detected in ${{ matrix.tool_name }}. Please check the logs for more information." && exit 0;;
esac' ERR

root_dir=$(pwd)
bfio_wheel=$(ls ${root_dir}/dist/bfio*.whl)
echo "Installing bfio from ${bfio_wheel}"
cd ${{ matrix.tool_dir }}

if [ -f "environment.yml" ]; then
conda init bash
source ~/.bashrc
conda activate project_env
pip install -e ".[all]"
conda install pytest
else
poetry install
fi
poetry add "numpy<2.0"
poetry add "${bfio_wheel}[all]"
poetry run pytest -v

find_tabular_tools:
needs: build_wheels
name: Find Tabular Tools
uses: PolusAI/tabular-tools/.github/workflows/find-all-tools.yml@main

tabular-tests:
name: Tabular | ${{ matrix.tool_name }}
runs-on: ubuntu-latest
needs: find_tabular_tools
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find_tabular_tools.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: 'PolusAI/tabular-tools'
ref: "main"
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Conda | Install
uses: conda-incubator/setup-miniconda@v3
- name: Poetry | Install
uses: abatilo/actions-poetry@v3
- name: Poetry | Config
run: |
poetry config virtualenvs.create false
- name: Tests | Pre-Update
run: |
set -e
trap 'case $? in
139) echo "::warning::Seg-fault detected in ${{ matrix.tool_name }}. Please check the logs for more information." && exit 0;;
esac' ERR

cd ${{ matrix.tool_dir }}

if [ -f "environment.yml" ]; then
conda init bash
source ~/.bashrc
conda env create -f environment.yml
conda activate project_env
pip install -e ".[all]"
conda install pytest
python -m pytest -v
else
poetry install
poetry run pytest -v
fi
- name: Download Wheels
uses: actions/download-artifact@v4
with:
name: wheels
path: dist
- name: Tests | Post-Update
run: |
set -e
trap 'case $? in
139) echo "::warning::Seg-fault detected in ${{ matrix.tool_name }}. Please check the logs for more information." && exit 0;;
esac' ERR

root_dir=$(pwd)
bfio_wheel=$(ls ${root_dir}/dist/bfio*.whl)
echo "Installing bfio from ${bfio_wheel}"
cd ${{ matrix.tool_dir }}

if [ -f "environment.yml" ]; then
conda init bash
source ~/.bashrc
conda activate project_env
pip install -e ".[all]"
conda install pytest
else
poetry install
fi
poetry add "numpy<2.0"
poetry add "${bfio_wheel}[all]"
poetry run pytest -v

# TODO: Uncomment tests for mm-tools after the pip package for `cwl_utilities`
# is available on PyPI and the PRs on mm-tools are merged.
# find_mm_tools:
# needs: build_wheels
# name: Find MM Tools
# uses: PolusAI/mm-tools/.github/workflows/find-all-tools.yml@main

# mm-tests:
# name: MM | ${{ matrix.tool_name }}
# runs-on: ubuntu-latest
# needs: find_mm_tools
# strategy:
# fail-fast: false
# matrix: ${{ fromJson(needs.find_mm_tools.outputs.matrix) }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# repository: 'PolusAI/mm-tools'
# - name: Set up Python 3.9
# uses: actions/setup-python@v5
# with:
# python-version: '3.9'
# - name: Conda | Install
# uses: conda-incubator/setup-miniconda@v3
# - name: Poetry | Install
# uses: abatilo/actions-poetry@v3
# - name: Poetry | Config
# run: |
# poetry config virtualenvs.create false
# - name: Tests | Pre-Update
# run: |
# set -e
# trap 'case $? in
# 139) echo "::warning::Seg-fault detected in ${{ matrix.tool_name }}. Please check the logs for more information." && exit 0;;
# esac' ERR

# cd ${{ matrix.tool_dir }}

# if [ -f "environment.yml" ]; then
# conda init bash
# source ~/.bashrc
# conda env create -f environment.yml
# conda activate project_env
# pip install -e ".[all]"
# conda install pytest
# python -m pytest -v
# else
# poetry install
# poetry run pytest -v
# fi
# - name: Download Wheels
# uses: actions/download-artifact@v4
# with:
# name: wheels
# path: dist
# - name: Tests | Post-Update
# run: |
# set -e
# trap 'case $? in
# 139) echo "::warning::Seg-fault detected in ${{ matrix.tool_name }}. Please check the logs for more information." && exit 0;;
# esac' ERR

# root_dir=$(pwd)
# cd ${{ matrix.tool_dir }}

# if [ -f "environment.yml" ]; then
# conda init bash
# source ~/.bashrc
# conda activate project_env
# pip install -e ".[all]"
# conda install pytest
# else
# poetry install
# fi
# pip install --upgrade --force-reinstall --find-links=${root_dir}/dist bfio
# poetry run pytest -v
Loading