-
Notifications
You must be signed in to change notification settings - Fork 174
82 lines (79 loc) · 2.76 KB
/
build-commit.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Build a Daft commit and store the outputted wheel in AWS S3
on:
workflow_dispatch:
inputs:
x86:
description: Build for x86
required: false
default: false
arm:
description: Build for ARM
required: false
default: false
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
outputs:
wheel:
description: The wheel file that was built
value: ${{ jobs.build-commit.outputs.wheel }}
jobs:
build-commit:
strategy:
fail-fast: false
matrix:
compile_arch: [x86, arm]
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:
- if: ${{ (matrix.compile_arch == 'x86') && (github.event.inputs.x86 == 'false') }}
run: exit 0
- if: ${{ (matrix.compile_arch == 'arm') && (github.event.inputs.arm == 'false') }}
run: exit 0
- 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: buildjet/cache@v4
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: |
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
# 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?prefix=builds/${{ inputs.commit || github.sha }}/" >> $GITHUB_STEP_SUMMARY
done