Skip to content

Commit

Permalink
Abstract build step into composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
Raunak Bhagat committed Nov 16, 2024
1 parent 39c00af commit 98e1360
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 45 deletions.
81 changes: 81 additions & 0 deletions .github/actions/build-commit/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build a specific daft commit and store it in AWS S3
description: Build a specific daft commit and store the output wheel in AWS S3

inputs:
commit:
description: The commit hash to build
required: true

outputs:
wheel:
description: The wheel file that was built
value: ${{ steps.upload_to_s3.outputs.wheel }}

runs:
using: composite
steps:
- name: Assume AWS credentials
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
- name: Checkout commit ${{ inputs.commit }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
- uses: ./.github/actions/install
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/target/debug
key: ${{ runner.os }}-cargo-deps-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-deps-
- name: Build wheel for commit ${{ inputs.commit }}
shell: bash
run: |
export CARGO_TARGET_DIR=~/target
uv v
source .venv/bin/activate
uv pip install pip
uv pip install maturin
maturin build
- name: Upload files to s3
shell: bash
id: upload_to_s3
run: |
# 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/${{ github.sha }}/${{ inputs.commit }}/ --acl public-read --no-progress;
file_basename=$(basename $file)
echo "wheel=$file_basename" >> "$GITHUB_OUTPUT"
done
# steps:
# - name: Install rust
# 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

# - name: Install uv
# 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

# - name: Source .bashrc
# shell: bash
# run: |
# source $HOME/.bashrc

# - name: Install python (version 3.9)
# shell: bash
# run: |
# uv python install 3.9
# uv python pin 3.9
28 changes: 21 additions & 7 deletions .github/assets/ray.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ available_node_types:
resources: {"CPU": 0}
node_config:
KeyName: ci-github-actions-ray-cluster-key
InstanceType: i3.2xlarge
ImageId: ami-0b8c6b923777519db
InstanceType: m6id.2xlarge
IamInstanceProfile:
Name: ray-autoscaler-v1

Expand All @@ -28,13 +27,21 @@ available_node_types:
resources: {}
node_config:
KeyName: ci-github-actions-ray-cluster-key
InstanceType: i3.2xlarge
ImageId: ami-0b8c6b923777519db
InstanceType: m6id.2xlarge
IamInstanceProfile:
Name: ray-autoscaler-v1

setup_commands:
# Mount drive
- sudo mkfs.ext4 /dev/nvme1n1
- sudo mount -t ext4 /dev/nvme1n1 /tmp
- sudo chmod 777 /tmp

# Install dependencies
- sudo apt install unzip
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
- unzip awscliv2.zip
- sudo ./aws/install
- curl -LsSf https://astral.sh/uv/install.sh | sh
- echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
- source ~/.bashrc
Expand All @@ -44,6 +51,13 @@ setup_commands:
- echo "source $HOME/.venv/bin/activate" >> $HOME/.bashrc
- source .venv/bin/activate
- uv pip install pip ray[default] py-spy
# GitHub Actions workflow will replace the `<<SHA>>`, `<<COMMIT>>`, and `<<WHEEL>>` placeholders
# with the actual values as determined dynamically during runtime of the actual workflow.
- uv pip install https://github-actions-artifacts-bucket.s3.amazonaws.com/builds/<<SHA>>/<<COMMIT>>/<<WHEEL>>
# GitHub Actions workflow will replace the `<<SHA>>`, `<<COMMIT>>`, and `<<WHEEL>>` placeholders
# with the actual values as determined dynamically during runtime of the actual workflow.
# - uv pip install https://github-actions-artifacts-bucket.s3.amazonaws.com/builds/<<SHA>>/<<COMMIT>>/<<WHEEL>>
- uv pip install getdaft

# Download benchmarking fixtures
- |
aws s3 sync \
s3://eventual-dev-benchmarking-fixtures/uncompressed/tpch-dbgen/2_0/2/parquet/ \
/tmp/data/2_0/2/parquet/
80 changes: 42 additions & 38 deletions .github/workflows/benchmark-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,45 +26,49 @@ jobs:
outputs:
wheel: ${{ steps.upload_to_s3.outputs.wheel }}
steps:
- name: Assume AWS credentials
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
- name: Checkout commit ${{ matrix.commit }}
uses: actions/checkout@v4
- uses: ./.github/actions/build-commit
with:
ref: ${{ matrix.commit }}
- uses: ./.github/actions/install
- name: Install additional dependencies
run: |
sudo apt-get update
sudo apt-get install gcc g++ pkg-config libssl-dev make -y
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/target/debug
key: ${{ runner.os }}-cargo-deps-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-deps-
- name: Build wheel for commit ${{ matrix.commit }}
run: |
export CARGO_TARGET_DIR=~/target
uv v
source .venv/bin/activate
uv pip install pip
uv pip install maturin
maturin build
- name: Upload files to s3
id: upload_to_s3
run: |
# 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/${{ github.sha }}/${{ matrix.commit }}/ --acl public-read --no-progress;
file_basename=$(basename $file)
echo "wheel=$file_basename" >> "$GITHUB_OUTPUT"
done
commit: ${{ matrix.commit }}

# - name: Assume AWS credentials
# 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
# - name: Checkout commit ${{ matrix.commit }}
# uses: actions/checkout@v4
# with:
# ref: ${{ matrix.commit }}
# - uses: ./.github/actions/install
# - name: Install additional dependencies
# run: |
# sudo apt-get update
# sudo apt-get install gcc g++ pkg-config libssl-dev make -y
# - name: Cache dependencies
# uses: actions/cache@v3
# with:
# path: ~/target/debug
# key: ${{ runner.os }}-cargo-deps-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: |
# ${{ runner.os }}-cargo-deps-
# - name: Build wheel for commit ${{ matrix.commit }}
# run: |
# export CARGO_TARGET_DIR=~/target
# uv v
# source .venv/bin/activate
# uv pip install pip
# uv pip install maturin
# maturin build
# - name: Upload files to s3
# id: upload_to_s3
# run: |
# # 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/${{ github.sha }}/${{ matrix.commit }}/ --acl public-read --no-progress;
# file_basename=$(basename $file)
# echo "wheel=$file_basename" >> "$GITHUB_OUTPUT"
# done

run:
needs: build
Expand Down

0 comments on commit 98e1360

Please sign in to comment.