From 0cfa4fcf343ad69122ad5081633b0ed40e06757b Mon Sep 17 00:00:00 2001 From: dkazanc Date: Mon, 12 Aug 2024 16:55:00 +0100 Subject: [PATCH] adding actions ci for the library build --- .../workflows/libtomophantom_conda_upload.yml | 42 +++++++++++++++++++ .../workflows/tomophantom_conda_upload.yml | 10 ++--- .scripts/conda_upload.sh | 2 +- .scripts/conda_upload_lib.sh | 20 +++++++++ 4 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/libtomophantom_conda_upload.yml create mode 100755 .scripts/conda_upload_lib.sh diff --git a/.github/workflows/libtomophantom_conda_upload.yml b/.github/workflows/libtomophantom_conda_upload.yml new file mode 100644 index 0000000..603433b --- /dev/null +++ b/.github/workflows/libtomophantom_conda_upload.yml @@ -0,0 +1,42 @@ +name: libtomophantom_conda_upload + +on: [push] + +jobs: + build-linux: + runs-on: ubuntu-20.04 + + defaults: + run: + shell: bash -l {0} + + steps: + - name: Checkout repository code + uses: actions/checkout@v4 + with: + ref: "master" + fetch-depth: 0 + + # setup Python 3.11 + - name: Setup Python 3.11 + uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: Install dependencies with Conda + run: | + $CONDA/bin/conda install -c conda-forge conda-build anaconda-client + $CONDA/bin/conda install -c conda-forge cmake + $CONDA/bin/conda update conda + $CONDA/bin/conda update conda-build + $CONDA/bin/conda list + + - name: Decrypt a secret + run: ./.scripts/decrypt_secret.sh + env: + LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} + + - name: Upload the tested package to conda cloud + run: | + chmod +x ./.scripts/conda_upload_lib.sh + ./.scripts/conda_upload_lib.sh diff --git a/.github/workflows/tomophantom_conda_upload.yml b/.github/workflows/tomophantom_conda_upload.yml index 6091c43..f857971 100644 --- a/.github/workflows/tomophantom_conda_upload.yml +++ b/.github/workflows/tomophantom_conda_upload.yml @@ -1,4 +1,4 @@ -name: tomohantom_conda_upload +name: tomophantom_conda_upload on: [push] @@ -12,16 +12,16 @@ jobs: steps: - name: Checkout repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: "master" fetch-depth: 0 - # setup Python 3.9 - - name: Setup Python 3.9 + # setup Python 3.11 + - name: Setup Python 3.11 uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: 3.11 - name: Install dependencies with Conda run: | diff --git a/.scripts/conda_upload.sh b/.scripts/conda_upload.sh index 0b1ecfa..f91cc78 100755 --- a/.scripts/conda_upload.sh +++ b/.scripts/conda_upload.sh @@ -9,7 +9,7 @@ mkdir ~/conda-bld conda config --set anaconda_upload no export CONDA_BLD_PATH=~/conda-bld -export CIL_VERSION=3.0 +export CIL_VERSION=3.0.1 $CONDA/bin/conda build conda-recipe . -c httomo # upload packages to conda diff --git a/.scripts/conda_upload_lib.sh b/.scripts/conda_upload_lib.sh new file mode 100755 index 0000000..6d5fa02 --- /dev/null +++ b/.scripts/conda_upload_lib.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +PKG_NAME=libtomophantom +USER=httomo-team +OS=noarch +CONDA_TOKEN=$(cat $HOME/.secrets/my_secret.json) + +mkdir ~/conda-bld +conda config --set anaconda_upload no +export CONDA_BLD_PATH=~/conda-bld + +export CIL_VERSION=3.0.1 +$CONDA/bin/conda build conda-recipe_library . -c httomo + +# upload packages to conda +find $CONDA_BLD_PATH/$OS -name *.tar.bz2 | while read file +do + echo $file + $CONDA/bin/anaconda -v --show-traceback --token $CONDA_TOKEN upload $file --force +done