Skip to content

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

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

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

Workflow file for this run

name: Build a Daft commit and store the outputted wheel in AWS S3
on:
pull_request:
workflow_dispatch:
inputs:
commit:
type: string
description: The commit hash to build
required: true
machine_type:
type: string
description: The machine type to use for the build
required: true
workflow_call:
secrets:
ACTIONS_AWS_ROLE_ARN:
description: The ARN of the AWS role to assume
required: true
inputs:
commit:
type: string
description: The commit hash to build
required: true
machine_type:
type: string
description: The machine type to use for the build
required: true
outputs:
wheel:
description: The wheel file that was built
value: ${{ jobs.build-commit.outputs.wheel }}
jobs:
build-commit:
runs-on: ${{ inputs.machine_type }}
timeout-minutes: 15 # Remove for ssh debugging
permissions:
id-token: write
contents: read
outputs:
wheel: ${{ steps.build_and_upload.outputs.wheel }}
steps:
- 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: actions/checkout@v4
with:
ref: ${{ inputs.commit || github.sha }}
fetch-depth: 1
- uses: ./.github/actions/install
- uses: actions/cache@v3
with:
path: ~/target
key: ${{ runner.os }}-cargo-deps-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-deps-
- name: Build the python wheel and upload it to AWS S3
id: build_and_upload
run: |
# Build wheel
export CARGO_TARGET_DIR=~/target
uv v
source .venv/bin/activate
uv pip install pip maturin
maturin build --release
# Upload wheel
# (there should only be one output wheel in this directory)
for file in ~/target/wheels/*.whl; do
aws s3 cp $file s3://github-actions-artifacts-bucket/builds/${{ inputs.commit || 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?region=us-west-2&bucketType=general&prefix=builds/${{ inputs.commit || github.sha }}/" >> $GITHUB_STEP_SUMMARY
done