Skip to content

cleanup unused channels and test build_manual #129

cleanup unused channels and test build_manual

cleanup unused channels and test build_manual #129

Workflow file for this run

# Conda package builds triggered manually.
# To trigger a build, bump the build number in .conda/meta.yaml.
name: Build (manual)
# Uncomment the following lines to trigger a build if the release build failed
on:
push:
paths:
- '.conda/**/*' # Include all files and subdirectories in .conda
- '!*.conda/**/README*' # Exclude any README files
- '.conda_mac/**/*' # Include all files and subdirectories in .conda_mac
- '!*.conda_mac/**/README*' # Exclude any README files
- '.github/workflows/build_manual.yml'
- 'requirements.txt'
- 'environment_build.yml'
- 'setup.py'
- 'sleap/version.py'
branches:
# - develop
# - fakebranch
- elizabeth/test-conda-build-when-changes-made-to-requirements
jobs:
build:
name: Build package from push (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "windows-2022", "macos-14"]
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixinclude
include:
# Use this condarc as default
- condarc: .conda/condarc.yaml
- pyver: "3.10"
# Use special condarc if macos
- os: "macos-14"
condarc: .conda_mac/condarc.yaml
pyver: "3.10"
steps:
# Setup
- name: Checkout
uses: actions/checkout@v4
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3.0.3
with:
miniforge-version: latest
condarc-file: ${{ matrix.condarc }}
python-version: ${{ matrix.pyver }}
environment-file: environment_build.yml
activate-environment: sleap_ci
conda-solver: "libmamba"
- name: Print build environment info
shell: bash -l {0}
run: |
which python
conda info
conda list
# Build pip wheel (Not Windows)
- name: Build pip wheel (Not Windows)
if: matrix.os != 'windows-2022'
shell: bash -l {0}
run: |
python setup.py bdist_wheel
# # Upload pip wheel (Ubuntu)
# - name: Upload pip wheel (Ubuntu)
# if: matrix.os == 'ubuntu-22.04'
# env:
# PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
# shell: bash -l {0}
# run: |
# twine upload -u __token__ -p "$PYPI_TOKEN" dist/* --non-interactive --skip-existing --disable-progress-bar
# Build conda package (Ubuntu)
- name: Build conda package (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
shell: bash -l {0}
run: |
conda build .conda --output-folder build
echo "BUILD_PATH=$(pwd)/build" >> "$GITHUB_ENV"
# Build conda package (Windows)
- name: Build conda package (Windows)
if: matrix.os == 'windows-2022'
shell: powershell
run: |
conda build .conda --output-folder build
echo "BUILD_PATH=\$(pwd)\build" >> "$env:GITHUB_ENV"
# Build conda package (Mac)
- name: Build conda package (Mac)
if: matrix.os == 'macos-14'
shell: bash -l {0}
run: |
conda build .conda_mac --output-folder build
echo "BUILD_PATH=$(pwd)/build" >> "$GITHUB_ENV"
# Print build and environment info for each OS after deactiviating build environment
- name: Print base environment info
shell: bash -l {0}
run: |
echo "Current build path: $BUILD_PATH"
conda deactivate
echo "Python executable before activating environment:"
which python
echo "Python version before activating environment:"
python --version
echo "Conda info before activating environment:"
conda info
# Install necessary OpenGL packages for Ubuntu only https://github.com/conda-forge/opencv-feedstock/issues/401
- name: Install OpenGL libraries on Ubuntu runner
if: matrix.os == 'ubuntu-22.04'
shell: bash -l {0}
run: |
sudo apt-get update
sudo apt-get install libglapi-mesa libegl-mesa0 libegl1 libopengl0 libgl1-mesa-glx
# Create conda environment using built conda package (Ubuntu and Windows)
- name: Create conda environment (Ubuntu and Windows)
if: matrix.os != 'macos-14'
shell: bash -l {0}
run: |
echo "Creating and testing conda environment with sleap package..."
conda create -y -n sleap_test -c file://$BUILD_PATH -c sleap/label/dev -c conda-forge -c nvidia -c anaconda sleap
# Create conda environment using built conda package (Mac)
# Note channel differences
- name: Create conda environment (Mac)
if: matrix.os == 'macos-14'
shell: bash -l {0}
run: |
echo "Creating and testing conda environment with sleap package..."
conda create -y -n sleap_test -c file://$BUILD_PATH -c conda-forge -c anaconda sleap
# Test conda environment
- name: Test conda environment
shell: bash -l {0}
run: |
echo "Activating sleap_test"
conda activate sleap_test
echo "Python executable after activating sleap_test environment:"
which python
echo "Python version after activating sleap_test environment:"
python --version
echo "Conda info after activating sleap_test environment:"
conda info
echo "List of installed conda packages in the sleap_test environment:"
conda list
echo "List of installed pip packages in the sleap_test environment:"
pip list
echo "Testing sleap package installation..."
sleap_version=$(python -c "import sleap; print(sleap.__version__)")
echo "Test completed using sleap version: $sleap_version"
# # Login to conda (Ubuntu)
# - name: Login to Anaconda (Ubuntu)
# if: matrix.os == 'ubuntu-22.04'
# env:
# ANACONDA_LOGIN: ${{ secrets.ANACONDA_LOGIN }}
# shell: bash -l {0}
# run: |
# yes 2>/dev/null | anaconda login --username sleap --password "$ANACONDA_LOGIN" || true
# # Login to conda (Windows)
# - name: Login to Anaconda (Windows)
# if: matrix.os == 'windows-2022'
# env:
# ANACONDA_LOGIN: ${{ secrets.ANACONDA_LOGIN }}
# shell: powershell
# run: |
# echo "yes" | anaconda login --username sleap --password "$env:ANACONDA_LOGIN"
# # Login to conda (Mac)
# - name: Login to Anaconda (Mac)
# if: matrix.os == 'macos-14'
# env:
# ANACONDA_LOGIN: ${{ secrets.ANACONDA_LOGIN }}
# shell: bash -l {0}
# run: |
# yes 2>/dev/null | anaconda login --username sleap --password "$ANACONDA_LOGIN" || true
# # Upload conda package (Windows)
# - name: Upload conda package (Windows/dev)
# if: matrix.os == 'windows-2022'
# shell: powershell
# run: |
# anaconda -v upload "build\win-64\*.tar.bz2" --label dev
# # Upload conda package (Ubuntu)
# - name: Upload conda package (Ubuntu/dev)
# if: matrix.os == 'ubuntu-22.04'
# shell: bash -l {0}
# run: |
# anaconda -v upload build/linux-64/*.tar.bz2 --label dev
# # Upload conda package (Mac)
# - name: Upload conda package (Mac/dev)
# if: matrix.os == 'macos-14'
# shell: bash -l {0}
# run: |
# anaconda -v upload build/osx-arm64/*.tar.bz2 --label dev
# - name: Logout from Anaconda
# shell: bash -l {0}
# run: |
# anaconda logout