-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |