build-commit #61
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-commit | |
on: | |
workflow_dispatch: | |
inputs: | |
python_version: | |
type: string | |
description: The version of python to use | |
required: false | |
default: "3.9" | |
jobs: | |
build-commit: | |
runs-on: buildjet-8vcpu-ubuntu-2004 | |
timeout-minutes: 15 # Remove for ssh debugging | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: us-west-2 | |
role-session-name: build-commit-workflow | |
role-to-assume: ${{ secrets.ACTIONS_AWS_ROLE_ARN }} | |
- name: Install uv, rust, python | |
uses: ./.github/actions/install | |
with: | |
python_version: ${{ inputs.python_version }} | |
- name: Restore cached build artifacts | |
uses: buildjet/cache@v4 | |
with: | |
path: ~/target | |
key: ${{ runner.os }}-cargo-deps-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo-deps- | |
- name: Setup uv environment | |
run: | | |
uv v | |
source .venv/bin/activate | |
uv pip install boto3 packaging | |
- name: Check if build already exists in AWS S3 | |
run: | | |
source .venv/bin/activate | |
wheel_name=$(python .github/ci-scripts/get_wheel_name_from_s3.py ${{ github.sha }} x86) | |
echo "wheel_name=$wheel_name" >> $GITHUB_ENV | |
- name: Build release wheel | |
run: | | |
if [ $wheel_name ]; then | |
echo "Commit already built" | |
exit 0 | |
fi | |
export CARGO_TARGET_DIR=~/target | |
source .venv/bin/activate | |
uv pip install pip maturin boto3 | |
maturin build --release | |
- name: Upload wheel to AWS S3 | |
run: | | |
if [ $wheel_name ]; then | |
echo "Commit already built" | |
exit 0 | |
fi | |
source .venv/bin/activate | |
python .github/ci-scripts/upload_wheel_to_s3.py ${{ github.sha }} x86 ~/target/wheels | |
- name: Print url of the built wheel to GitHub Actions Summary Page | |
run: | | |
url="https://us-west-2.console.aws.amazon.com/s3/object/github-actions-artifacts-bucket?prefix=builds/${{ github.sha }}/$wheel_name" | |
echo "Output python-release-wheel location:" >> $GITHUB_STEP_SUMMARY | |
echo "$url" >> $GITHUB_STEP_SUMMARY |