Skip to content

Commit 176a565

Browse files
committed
[fix/ci] Fixed conda build error
1 parent 97b017b commit 176a565

File tree

2 files changed

+77
-7
lines changed

2 files changed

+77
-7
lines changed

.conda-envs/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package:
22
name: "pyatlan"
3-
version: "{{ environ['GIT_DESCRIBE_TAG'] }}"
3+
version: "{{ environ['PYATLAN_VERSION'] }}"
44

55
source:
66
path: ../
77

88
build:
99
number: 0
10-
script: "{{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation"
10+
script: "{{ PYTHON }} -m pip install . -vv"
1111

1212
requirements:
1313
host:

.github/workflows/build_and_upload_conda_packages.yaml

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,97 @@ jobs:
2525
auto-update-conda: false
2626
auto-activate-base: false
2727
show-channel-urls: true
28+
29+
- name: Install conda-build and anaconda-client
30+
run: |
31+
conda config --add channels conda-forge
32+
conda install conda-build anaconda-client anaconda-auth -y
33+
34+
- name: Set version environment variable
35+
run: |
36+
# Read version from version.txt file
37+
VERSION=$(cat pyatlan/version.txt | tr -d ' \n')
38+
echo "PYATLAN_VERSION=$VERSION" >> $GITHUB_ENV
39+
echo "Building version: $VERSION"
40+
41+
- name: Configure anaconda client
42+
run: |
43+
# Create config directory and file
44+
mkdir -p /home/runner/.continuum/anaconda-client
45+
cat > /home/runner/.continuum/anaconda-client/config.yaml << EOF
46+
url: https://api.anaconda.org
47+
EOF
48+
49+
# Try to find anaconda command in various locations
50+
ANACONDA_CMD=""
51+
for cmd in anaconda "$CONDA/bin/anaconda" "$CONDA/condabin/anaconda" "$(which anaconda)"; do
52+
if command -v "$cmd" >/dev/null 2>&1; then
53+
ANACONDA_CMD="$cmd"
54+
echo "Found anaconda command: $ANACONDA_CMD"
55+
break
56+
fi
57+
done
58+
59+
if [ -z "$ANACONDA_CMD" ]; then
60+
echo "anaconda command not found. Trying to install via pip..."
61+
pip install anaconda-client anaconda-auth
62+
ANACONDA_CMD="anaconda"
63+
fi
64+
65+
echo "Using anaconda command: $ANACONDA_CMD"
66+
67+
# Set up authentication token
68+
echo "Setting up authentication..."
69+
$ANACONDA_CMD config --set url https://api.anaconda.org
70+
echo "Authentication will be handled during upload with --token parameter"
2871
- name: Build conda package
72+
env:
73+
PYATLAN_VERSION: ${{ env.PYATLAN_VERSION }}
2974
run: |
30-
conda build .conda-envs --python ${{ matrix.python-version }} --output-folder /tmp/conda-builds
75+
echo "Current directory: $(pwd)"
76+
echo "Listing .conda-envs directory:"
77+
ls -la .conda-envs/
78+
echo "Creating output directory..."
79+
mkdir -p /tmp/conda-builds
80+
echo "Building conda package with version: $PYATLAN_VERSION"
81+
conda build .conda-envs/meta.yaml --python ${{ matrix.python-version }} --output-folder /tmp/conda-builds --debug --package-format tar.bz2 || {
82+
echo "Conda build failed. Checking for any output..."
83+
ls -la /tmp/conda-builds/ || echo "No output directory"
84+
exit 1
85+
}
3186
3287
- name: Convert to all platforms
3388
run: |
34-
# Find the built package
89+
echo "Checking build output directory:"
90+
ls -la /tmp/conda-builds/ || echo "Directory does not exist"
91+
echo "Finding built packages..."
92+
find /tmp/conda-builds -name "*.tar.bz2" || echo "No .tar.bz2 files found"
93+
find /tmp/conda-builds -name "*.conda" || echo "No .conda files found"
94+
95+
# Find the built package (prioritize .tar.bz2 since we force that format)
3596
PACKAGE_PATH=$(find /tmp/conda-builds -name "*.tar.bz2" | head -1)
97+
if [ -z "$PACKAGE_PATH" ]; then
98+
PACKAGE_PATH=$(find /tmp/conda-builds -name "*.conda" | head -1)
99+
fi
36100
if [ -z "$PACKAGE_PATH" ]; then
37101
echo "No package found to convert"
102+
echo "Build may have failed. Check the build logs above."
38103
exit 1
39104
fi
105+
echo "Found package: $PACKAGE_PATH"
40106
conda convert -p all "$PACKAGE_PATH" -o /tmp/conda-builds
41107
42108
- name: Upload to Anaconda
109+
env:
110+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
43111
run: |
112+
# Find anaconda command
113+
ANACONDA_CMD=$(which anaconda || echo "$CONDA/bin/anaconda")
114+
44115
# Upload all platform packages
45116
for pkg in /tmp/conda-builds/*/*.tar.bz2; do
46117
if [ -f "$pkg" ]; then
47-
anaconda upload --user atlanhq --label main "$pkg"
118+
echo "Uploading $pkg..."
119+
$ANACONDA_CMD upload --user atlanhq --label main "$pkg"
48120
fi
49121
done
50-
env:
51-
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}

0 commit comments

Comments
 (0)