Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Add new workflow to build commits and output to s3 #3321

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/actions/install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Install uv, rust, and python
description: Install uv, rust, and python
inputs:
python_version:
description: The version of python to install
required: false
default: '3.9'
runs:
using: composite
steps:
- shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
CARGO_BIN="$HOME/.cargo/bin"
echo 'export PATH="$CARGO_BIN:$PATH"' >> $HOME/.bashrc
echo "$CARGO_BIN" >> $GITHUB_PATH
- shell: bash
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
UV_BIN="$HOME/.local/bin"
echo 'export PATH="$UV_BIN:$PATH"' >> $HOME/.bashrc
echo "$UV_BIN" >> $GITHUB_PATH
- shell: bash
run: |
source $HOME/.bashrc
- shell: bash
run: |
uv python install ${{ inputs.python_version }}
uv python pin ${{ inputs.python_version }}
67 changes: 67 additions & 0 deletions .github/workflows/build-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build a Daft commit and store the outputted wheel in AWS S3

on:
workflow_dispatch:
workflow_call:
secrets:
ACTIONS_AWS_ROLE_ARN:
description: The ARN of the AWS role to assume
required: true
outputs:
wheel:
description: The wheel file that was built
value: ${{ jobs.build-commit.outputs.wheel }}

jobs:
build-commit:
raunakab marked this conversation as resolved.
Show resolved Hide resolved
runs-on: buildjet-8vcpu-ubuntu-2004
timeout-minutes: 15 # Remove for ssh debugging
permissions:
id-token: write
contents: read
outputs:
wheel: ${{ steps.build_and_upload.outputs.wheel }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
fetch-depth: 1
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.ACTIONS_AWS_ROLE_ARN }}
role-session-name: daft-performance-comparisons-build
- uses: ./.github/actions/install
- uses: buildjet/cache@v4
with:
path: ~/target
key: ${{ runner.os }}-cargo-deps-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-deps-
- id: build_and_upload
run: |
if ! ls ~/target/wheels/*.whl 1> /dev/null 2>&1; then
# Build wheel
export CARGO_TARGET_DIR=~/target
uv v
source .venv/bin/activate
uv pip install pip maturin
maturin build --release
fi

count=$(ls ~/target/wheels/*.whl 2> /dev/null | wc -l)
if [ "$count" -gt 1 ]; then
echo "Found more than 1 wheel"
exit 1
elif [ "$count" -eq 0 ]; then
echo "Found no wheel files"
exit 1
fi

# Upload wheel
for file in ~/target/wheels/*.whl; do
aws s3 cp $file s3://github-actions-artifacts-bucket/builds/${{ github.sha }}/ --acl public-read --no-progress;
file_basename=$(basename $file)
echo "wheel=$file_basename" >> $GITHUB_OUTPUT
echo "Output wheel has been built and stored in S3 at the following location:" >> $GITHUB_STEP_SUMMARY
echo "https://us-west-2.console.aws.amazon.com/s3/buckets/github-actions-artifacts-bucket?prefix=builds/${{ github.sha }}/" >> $GITHUB_STEP_SUMMARY
done