-
Notifications
You must be signed in to change notification settings - Fork 8
155 lines (146 loc) · 5.95 KB
/
conda-build.yml
File metadata and controls
155 lines (146 loc) · 5.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Conda Build
on:
release:
types: [published]
workflow_dispatch:
inputs:
buildNumber:
type: string
required: true
description: "build-nr: anaconda.org build-nr (DON'T trigger build if you don't know how to set it)"
version:
type: string
required: true
description: "version: PEP440 package-version (DON'T trigger build if you don't know what PEP440 is)"
python-version:
type: string
required: true
description: "Python version to test (e.g. 3.9 or 3.10)"
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
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-version: ${{ steps.bcs.outputs.karabo_version }}
build-docker: ${{ steps.bcs.outputs.build_docker == 'true' }}
latest-docker: ${{ steps.bcs.outputs.latest_docker == 'true' }}
python-version: ${{ steps.bcs.outputs.python_version }}
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: Install Micromamba
uses: mamba-org/setup-micromamba@v1
with:
init-shell: bash
environment-name: buildenv
create-args: python=3.9 versioneer # default, overwritten below if needed
- name: Configure micromamba channels
run: |
micromamba config append channels i4ds/label/dev
micromamba config append channels i4ds
micromamba config append channels nvidia/label/cuda-11.7.1
micromamba config append channels conda-forge
- name: Build Conda
id: bcs
shell: bash -l {0}
run: |
if [[ ${{ github.event_name }} == 'release' ]]; then
echo "Conda build from release"
build="0"
KARABO_TAG=${{ steps.get-latest-tag.outputs.tag }}
if [[ ${KARABO_TAG:0:1} == "v" ]]; then
KARABO_VERSION="${KARABO_TAG:1}"
else
echo "invalid karabo-tag: has no leading v"
exit 1
fi
BUILD_DOCKER=true
LATEST_DOCKER=true
PYTHON_VERSION="3.9"
elif [[ ${{ github.event_name }} == 'workflow_dispatch' ]] || [[ ${{ github.event_name }} == 'workflow_call' ]]; then
echo "Conda build from dispatch | call"
build=${{ inputs.buildNumber }}
BUILD_DOCKER=${{ inputs.buildDocker }}
LATEST_DOCKER=${{ inputs.latestDocker }}
KARABO_VERSION=${{ inputs.version }}
PYTHON_VERSION=${{ inputs.python-version }}
if [[ ${KARABO_VERSION:0:1} == "v" ]]; then
KARABO_VERSION="${KARABO_VERSION:1}"
fi
micromamba install -n buildenv -c conda-forge python=${PYTHON_VERSION} versioneer -y
VERSIONEER_VERSION=$(micromamba run -n buildenv python -c 'import versioneer; print(versioneer.get_version())')
if [[ "$VERSIONEER_VERSION" != *"$KARABO_VERSION"* ]] && [[ "$KARABO_VERSION" != *"dev"* ]]; then
echo "Provided version $KARABO_VERSION doesn't match the actual version $VERSIONEER_VERSION"
exit 1
fi
else
echo "Unexpected github-event occurred"
exit 1
fi
if [[ "$KARABO_VERSION" == *"dev"* ]]; then
if [[ $LATEST_DOCKER == 'true' ]]; then
echo "Dev build docker image can not be tagged as latest!"
exit 1
fi
build="$((build + 1000))"
fi
export KARABO_VERSION=$KARABO_VERSION build=$build
echo "karabo_version=$KARABO_VERSION" >> $GITHUB_OUTPUT
echo "build_docker=$BUILD_DOCKER" >> $GITHUB_OUTPUT
echo "latest_docker=$LATEST_DOCKER" >> $GITHUB_OUTPUT
echo "python_version=$PYTHON_VERSION" >> $GITHUB_OUTPUT
micromamba run -n buildenv conda config --append channels i4ds
micromamba run -n buildenv conda config --append channels nvidia/label/cuda-11.7.1
micromamba run -n buildenv conda config --append channels conda-forge
cd conda
micromamba run -n buildenv conda mambabuild .
- name: Publish to Conda
shell: bash
run: |
micromamba install -n buildenv -c conda-forge anaconda-client -y
micromamba run -n buildenv anaconda -t ${{ secrets.ANACONDA_SECRET }} upload /opt/conda/conda-bld/linux-64/karabo-pipeline-*.tar.bz2 --force
test-build-39:
needs: conda-build
uses: ./.github/workflows/test-user-package.yml
with:
python-version: "3.9"
version: ${{ needs.conda-build.outputs.karabo-version }}
buildDocker: ${{ needs.conda-build.outputs.build-docker == 'true' }}
latestDocker: ${{ needs.conda-build.outputs.latest-docker == 'true' }}
test-build-310:
needs: conda-build
uses: ./.github/workflows/test-user-package.yml
with:
python-version: "3.10"
version: ${{ needs.conda-build.outputs.karabo-version }}
buildDocker: ${{ needs.conda-build.outputs.build-docker == 'true' }}
latestDocker: ${{ needs.conda-build.outputs.latest-docker == 'true' }}