diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0ccdb2b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Build and Release ST_BarcodeMap + +on: + push: + tags: + - 'v*' # Triggers on version tags like v0.0.1 + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + environment-file: environment.yml + activate-environment: barcodeenv + python-version: 3.9 + + - name: Install C++ dependencies + shell: bash -l {0} + run: | + mamba install -c conda-forge gcc_linux-64 gxx_linux-64 + export CC=$(which x86_64-conda-linux-gnu-gcc) + export CXX=$(which x86_64-conda-linux-gnu-g++) + echo "Using CC=$CC" + echo "Using CXX=$CXX" + make + + - name: Rename binary with version + run: | + mkdir -p dist + cp ST_BarcodeMap dist/ST_BarcodeMap-${{ github.ref_name }}-linux + chmod +x dist/ST_BarcodeMap-${{ github.ref_name }}-linux + + - name: Upload binary to GitHub Release + uses: softprops/action-gh-release@v1 + with: + name: Release ${{ github.ref_name }} + tag_name: ${{ github.ref_name }} + files: dist/ST_BarcodeMap-${{ github.ref_name }}-linux + body: | + 🔁 Automated release for **${{ github.ref_name }}** + 🐧 Platform: **Linux** + 📦 Binary: `ST_BarcodeMap-${{ github.ref_name }}-linux` + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index f643e09..8f88085 100644 --- a/Makefile +++ b/Makefile @@ -4,39 +4,35 @@ DIR_OBJ := ./obj PREFIX ?= /usr/local BINDIR ?= $(PREFIX)/bin -INCLUDE_DIRS ?= -LIBRARY_DIRS ?= + +# Use Conda’s Boost, but system GCC +INCLUDE_DIRS = -I$(DIR_INC) -I$(CONDA_PREFIX)/include -I/usr/include/hdf5/serial +LIBRARY_DIRS = -L$(CONDA_PREFIX)/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial SRC := $(wildcard ${DIR_SRC}/*.cpp) OBJ := $(patsubst %.cpp,${DIR_OBJ}/%.o,$(notdir ${SRC})) -TARGET := ST_BarcodeMap-0.0.1 - +TARGET := ST_BarcodeMap BIN_TARGET := ${TARGET} -CXX ?= g++ -CXXFLAGS := -std=c++11 -g -O3 -I${DIR_INC} $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir)) ${CXXFLAGS} -LIBS := -lz -lpthread -LD_FLAGS := $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(LIBS) $(LD_FLAGS) - +CXX := g++ +CXXFLAGS := -std=c++11 -g -O3 $(INCLUDE_DIRS) +LD_FLAGS := $(LIBRARY_DIRS) -lboost_serialization -lhdf5 -lz -lpthread -${BIN_TARGET}:${OBJ} +${BIN_TARGET}: ${OBJ} $(CXX) $(OBJ) -o $@ $(LD_FLAGS) -${DIR_OBJ}/%.o:${DIR_SRC}/%.cpp make_obj_dir +${DIR_OBJ}/%.o: ${DIR_SRC}/%.cpp make_obj_dir $(CXX) -c $< -o $@ $(CXXFLAGS) -.PHONY:clean +.PHONY: clean clean: - rm obj/*.o - rm $(TARGET) + rm -f ${DIR_OBJ}/*.o + rm -f ${TARGET} make_obj_dir: - @if test ! -d $(DIR_OBJ) ; \ - then \ - mkdir $(DIR_OBJ) ; \ - fi + @if [ ! -d ${DIR_OBJ} ]; then mkdir -p ${DIR_OBJ}; fi install: - install $(TARGET) $(BINDIR)/$(TARGET) + install ${TARGET} ${BINDIR}/${TARGET} @echo "Installed." diff --git a/README.md b/README.md index 5b141bb..30f7b76 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,24 @@ This program can map barcode of stereomics-seq to stereomics-chip | zlib | >=1.2.11 | file compressing and decompressing | | hdf5 | >=1.10.7 | hdf5 format mask file read | +## Using conda +If the conda is not set up yet, please install conda first, following the link below: +[https://www.anaconda.com/docs/getting-started/miniconda/install#macos-linux-installation](https://www.anaconda.com/docs/getting-started/miniconda/install#macos-linux-installation) + +To meet the above prerequisites, a conda environment can be created as shown below: +```bash +conda install mamba -n base -c conda-forge +mamba create -n barcodeenv boost=1.73 hdf5=1.10.7 zlib=1.2.11 -c conda-forge +conda activate barcodeenv +mamba install -c conda-forge gcc_linux-64 gxx_linux-64 +mamba install -c conda-forge boost=1.73 +``` + ## make the runnable program ``` ##add the requested packages in your environment value or specify their path in Makefile by INCLUDE_DIRS and LIBRARY_DIRS +conda activate barcodeenv +export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH cd ST_BarcodeMap make diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..35fd309 --- /dev/null +++ b/environment.yml @@ -0,0 +1,11 @@ +name: barcodeenv +channels: + - conda-forge +dependencies: + - boost=1.73 + - hdf5=1.10.7 + - zlib=1.2.11 + - gcc_linux-64 + - gxx_linux-64 + - make + - mamba