Skip to content

Commit

Permalink
added conda workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
aviezerl committed Nov 25, 2024
1 parent 05bb495 commit c59fbac
Showing 1 changed file with 146 additions and 0 deletions.
146 changes: 146 additions & 0 deletions .github/workflows/conda-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Build Conda Package

on:
push:
tags:
- 'v*' # Trigger on version tags
workflow_dispatch: # Allow manual triggering

jobs:
build:
name: Build Conda Package
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false
defaults:
run:
shell: bash -el {0}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get version from tag
id: get_version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
else
echo "VERSION=4.2.13" >> $GITHUB_ENV # Default version if not triggered by tag
fi
echo "Using version: ${{ env.VERSION }}"
- name: Set up Conda environment
uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
activate-environment: ""
miniforge-version: latest
miniforge-variant: Mambaforge
use-mamba: true
python-version: "3.11" # Specify Python 3.11

- name: Install conda-build tools
run: |
mamba install conda-build anaconda-client
- name: Create conda recipe
run: |
mkdir -p conda-recipe
cat > conda-recipe/meta.yaml << EOF
{% set version = "${{ env.VERSION }}" %}
package:
name: r-misha
version: {{ version }}
source:
git_url: https://github.com/tanaylab/misha
git_rev: v{{ version }}
build:
number: 0
rpaths:
- lib/R/lib/
- lib/
skip: True # [not unix]
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- r-base >=3.0.0
- make
- automake
- autoconf
- python >=3.9,<3.12 # Explicitly specify Python version range
host:
- r-base >=3.0.0
- r-magrittr
- r-curl
run:
- r-base >=3.0.0
- r-magrittr
- r-curl
- r-dplyr
- r-glue
- r-readr
- r-tibble
test:
requires:
- r-testthat >=3.0.0
commands:
- $R -e "library('misha')"
about:
home: https://tanaylab.github.io/misha/
dev_url: https://github.com/tanaylab/misha
license: MIT
license_file: LICENSE
summary: 'Toolkit for Analysis of Genomic Data'
description: |
A toolkit for analysis of genomic data. The 'misha' package
implements an efficient data structure for storing genomic data, and
provides a set of functions for data extraction, manipulation and
analysis.
doc_url: https://tanaylab.github.io/misha/
extra:
recipe-maintainers:
- ${{ github.repository_owner }}
EOF
cat > conda-recipe/build.sh << 'EOF'
#!/bin/bash
mkdir -p $PREFIX/lib/R/library
$R CMD INSTALL --build .
EOF
chmod +x conda-recipe/build.sh
- name: Build conda package
run: |
conda build conda-recipe
- name: Upload conda package
if: |
startsWith(github.ref, 'refs/tags/') &&
!failure() &&
!cancelled()
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
# Get the platform-specific path
PLATFORM_PATH=$(conda build conda-recipe --output)
echo "Uploading package from: $PLATFORM_PATH"
anaconda -t $ANACONDA_TOKEN upload -u ${{ secrets.ANACONDA_USERNAME }} "$PLATFORM_PATH" --force
- name: Save conda package as artifact
uses: actions/upload-artifact@v4
with:
name: conda-package-${{ matrix.os }}
path: ${{ env.CONDA_PREFIX }}/conda-bld/**/*.tar.bz2
if-no-files-found: error

0 comments on commit c59fbac

Please sign in to comment.