Skip to content

Commit

Permalink
[BSE-4019] Move Build BodoSQL to Github Action (#8387)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadia206 authored Nov 9, 2024
1 parent 34159ba commit fd8263b
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 20 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/_build_bodosql_conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build and Publish BodoSQL Conda Binary

on:
workflow_call:
inputs:
is-release:
description: 'Is this a release build'
required: false
type: boolean
default: false

jobs:
build:
runs-on: [self-hosted, small]
timeout-minutes: 240

steps:
- uses: actions/checkout@v4
with:
# For setuptools_scm to be able to determine version,
# we need to fetch the entire history
fetch-depth: 0

- name: Create Micromamba Environment
uses: mamba-org/setup-micromamba@v1
with:
environment-name: bodosql_build
create-args: conda-build anaconda-client python-libarchive-c setuptools_scm -c conda-forge
cache-environment: true
generate-run-shell: true
init-shell: bash
condarc: |
channels:
- conda-forge
remote_max_retries: 5
remote_backoff_factor: 60
aggressive_update_packages: []
- name: 'Download the Bodo conda'
uses: actions/download-artifact@v4
with:
name: bodo-conda-linux-3.12-community
run-id: ${{ github.event.workflow_run.id }}
path: ./Bodo-CondaPkg-Linux

- name: 'Build Conda Package'
run: |
set -exo pipefail
source $HOME/micromamba/etc/profile.d/micromamba.sh
micromamba activate bodosql_build
# Determine Output Version
export BODOSQL_VERSION=$(python -m setuptools_scm)
echo "BODOSQL_VERSION=$BODOSQL_VERSION" >> $GITHUB_ENV
# Build Conda Package with Conda-Build
conda build buildscripts/bodosql/conda-recipe -c conda-forge -c ./Bodo-CondaPkg-Linux --croot $HOME/conda-bld
shell: bash
env:
BODOSQL_VERSION: ${{ env.BODOSQL_VERSION }}

- name: Upload Conda Package
uses: actions/upload-artifact@v4
with:
name: bodosql-conda-noarch
path: /home/ec2-user/conda-bld/

- name: 'Set Secret File Permissions and Publish BodoSQL Binary to Artifactory'
if: ${{ inputs.is-release }}
run: |
set -eo pipefail
echo "${{ secrets.PUBLISH_BINARY_SECRETS }}" > $HOME/secret_file
sudo chmod a+r $HOME/secret_file
echo "BODOSQL_VERSION: $BODOSQL_VERSION"
artifactory_channel=`./buildscripts/bodosql/get_channel.sh`
echo "artifactory_channel: $artifactory_channel"
./buildscripts/bodosql/publish_binary.sh $artifactory_channel
shell: bash
3 changes: 0 additions & 3 deletions .github/workflows/_build_iceberg_conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ jobs:
runs-on: [self-hosted, small]
timeout-minutes: 240

env:
BODO_CHANNEL_NAME: 'bodo.ai'

steps:
- uses: actions/checkout@v4
with:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,11 @@ jobs:
uses: Bodo-inc/Bodo/.github/workflows/_build_azurefs_sas_token_provider_conda.yml@develop
secrets: inherit

# TODO: Include BodoSQL, E2E tests, and AMI
bodosql-conda:
needs: bodo-conda-community
uses: Bodo-inc/Bodo/.github/workflows/_build_bodosql_conda.yml@develop
with:
is-release: ${{ github.event_name == 'release' }}
secrets: inherit

# TODO: Include E2E tests, and AMI
3 changes: 2 additions & 1 deletion bodo/libs/_distributed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ static int verify_license_platform() {
success = verify_license_azure(instance_id);
}
}
MPI_Bcast(&success, 1, MPI_INT, 0, MPI_COMM_WORLD);
CHECK_MPI(MPI_Bcast(&success, 1, MPI_INT, 0, MPI_COMM_WORLD),
"verify_license_platform: MPI error on MPI_Bcast:");
return success;
}

Expand Down
6 changes: 3 additions & 3 deletions buildscripts/bodosql/conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: bodosql
version: {{ BODOSQL_VERSION }}
version: {{ environ.get('BODOSQL_VERSION') }}

source:
path: ../../../BodoSQL
Expand All @@ -15,11 +15,11 @@ requirements:
- setuptools_scm >=8
- openjdk >=11.0, <18
- maven
- bodo {{ BODO_VERSION }}
- bodo {{ BODOSQL_VERSION }}

run:
- openjdk >=11.0, <18
- bodo {{ BODO_VERSION }}
- bodo {{ BODOSQL_VERSION }}
- py4j ==0.10.9.7
- python >=3.10,<3.13

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash
set -exo pipefail

export PATH=$HOME/miniforge3/bin:$PATH
source activate $CONDA_ENV
# Package Setup
eval "$(micromamba shell hook -s posix)"
micromamba activate bodosql_build

BODOSQL_CHANNEL_NAME=${1:-bodo-binary}

Expand Down Expand Up @@ -31,16 +32,25 @@ if [[ -n "$IS_RELEASE" ]] && [[ "$BODOSQL_CHANNEL_NAME" == "bodo.ai" ]]; then
label="main"
fi

for package in `ls $CONDA_PREFIX/conda-bld/noarch/bodosql*.tar.bz2`; do
package_name=`basename $package`
curl -u${USERNAME}:${TOKEN} -T $package "https://bodo.jfrog.io/artifactory/${BODOSQL_CHANNEL_NAME}/noarch/$package_name"
if [[ ! -z "$label" ]]; then
# `--skip-existing` skips the upload in case the package already exists.
# Since the pipeline runs every night, we don't want to replace
# the package on anaconda and accidentally break something.
anaconda -t $ANACONDA_TOKEN upload -u bodo.ai -c bodo.ai $package --label $label --skip-existing
fi
done

PACKAGE_DIR=$HOME/conda-bld

# Upload to Anaconda
package=`ls $PACKAGE_DIR/noarch/bodosql*.tar.bz2`
if [[ -z "$package" ]]; then
echo "Unable to Find Package. Exiting ..."
exit 1
fi

package_name=`basename $package`
echo "Package Name: $package_name"
curl -u${USERNAME}:${TOKEN} -T $package "https://bodo.jfrog.io/artifactory/${BODOSQL_CHANNEL_NAME}/noarch/$package_name"
if [[ ! -z "$label" ]]; then
# `--skip-existing` skips the upload in case the package already exists.
# Since the pipeline runs every night, we don't want to replace
# the package on anaconda and accidentally break something.
anaconda -t $ANACONDA_TOKEN upload -u bodo.ai -c bodo.ai $package --label $label --skip-existing
fi

# Reindex Conda
curl -X POST https://$USERNAME:$TOKEN@bodo.jfrog.io/artifactory/api/conda/$BODOSQL_CHANNEL_NAME/reindex
Expand Down

0 comments on commit fd8263b

Please sign in to comment.