Conda Build #111
Workflow file for this run
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
name: Conda Build | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
buildNumber: | |
type: string | |
required: false | |
default: "0" | |
description: "build-nr: conda build-nr of anaconda.org" | |
version: | |
type: string | |
required: true | |
description: "version: PEP440 package-version (incl. leading 'v')" | |
dev: | |
type: boolean | |
required: true | |
description: "dev-build? If yes, it sets an offset to build-nr" | |
buildDocker: | |
type: boolean | |
required: false | |
default: false | |
description: "build docker-img if conda-build & tests succeeded?" | |
latestDocker: | |
type: boolean | |
required: false | |
default: false | |
description: "tag docker-img as latest (if `buildDocker` is enabled)" | |
workflow_call: | |
inputs: | |
buildNumber: | |
type: string | |
required: true | |
version: | |
type: string | |
required: true | |
dev: | |
type: boolean | |
required: false | |
default: false | |
buildDocker: | |
type: boolean | |
required: false | |
default: false | |
latestDocker: | |
type: boolean | |
required: false | |
default: false | |
jobs: | |
conda-build: | |
runs-on: ubuntu-latest | |
container: ghcr.io/i4ds/mambabuild-docker:latest | |
outputs: | |
karabo-tag: ${{ steps.bcs.outputs.karabo_tag }} | |
build-docker: ${{ steps.bcs.outputs.build_docker }} | |
latest-docker: ${{ steps.bcs.outputs.latest_docker }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get Previous tag | |
uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: get-latest-tag | |
- name: Build Conda | |
id: bcs | |
shell: bash -l {0} | |
run: | | |
if [[ ${{ github.event_name }} == "release" ]] | |
then | |
BUILD_NUMBER="0" | |
KARABO_TAG=${{ steps.get-latest-tag.outputs.tag }} | |
BUILD_DOCKER=true | |
LATEST_DOCKER=true | |
fi | |
if [[ ${{ github.event_name }} == "workflow_dispatch" ]] || [[ ${{ github.event_name }} == "workflow_call" ]] | |
then | |
BUILD_NUMBER=${{ inputs.buildNumber }} | |
KARABO_TAG=${{ inputs.version }} | |
BUILD_DOCKER=${{ inputs.buildDocker }} | |
LATEST_DOCKER=${{ inputs.latestDocker }} | |
fi | |
KARABO_VERSION="${KARABO_TAG:1}" | |
DEV_STR="dev" | |
if [[ ${{ inputs.dev }} == "true" ]] | |
then | |
if [[ "$KARABO_VERSION" != *"$DEV_STR"* ]] || [[ $LATEST_DOCKER == 'true' ]] | |
then | |
echo "Invalid configuration of workflow-inputs!" | |
exit 2 | |
fi | |
BUILD_NUMBER="$(($BUILD_NUMBER + 999))" | |
else | |
if [[ "$KARABO_VERSION" == *"$DEV_STR"* ]] | |
then | |
echo "Invalid configuration of workflow-inputs!" | |
exit 2 | |
fi | |
fi | |
export KARABO_VERSION=$KARABO_VERSION BUILD_NUMBER=$BUILD_NUMBER | |
echo "karabo_tag=$KARABO_TAG" >> $GITHUB_OUTPUT | |
echo "build_docker=$BUILD_DOCKER" >> $GITHUB_OUTPUT | |
echo "latest_docker=$LATEST_DOCKER" >> $GITHUB_OUTPUT | |
conda config --append channels i4ds | |
conda config --append channels nvidia/label/cuda-11.7.0 | |
conda config --append channels conda-forge | |
cd conda | |
conda mambabuild . | |
- name: Publish to Conda | |
shell: bash -l {0} | |
run: | | |
conda activate base | |
anaconda -t ${{ secrets.ANACONDA_SECRET }} upload /opt/conda/conda-bld/linux-64/karabo-pipeline-*.tar.bz2 --force | |
test-build: | |
needs: conda-build | |
uses: ./.github/workflows/test-user-package.yml | |
with: | |
version: ${{ needs.conda-build.outputs.karabo-tag }} | |
buildDocker: ${{ needs.conda-build.outputs.build-docker == 'true' }} | |
latestDocker: ${{ needs.conda-build.outputs.latest-docker == 'true' }} |