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

added conda workflow #20

Merged
merged 1 commit into from
Nov 25, 2024
Merged
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
144 changes: 144 additions & 0 deletions .github/workflows/conda-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
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

- name: Install conda-build tools
run: |
mamba install conda-build anaconda-client conda-verify

- 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
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
Loading