chore(blockifier): fetch compiler repo version #778
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: Blockifier-CI | |
# TODO(Dori, 15/8/2024): Split this job, so the feature-less build doesn't run on every push to main | |
# branches. | |
on: | |
push: | |
branches: | |
- main | |
- main-v[0-9].** | |
tags: | |
- v[0-9].** | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- auto_merge_enabled | |
- edited | |
paths: | |
- '.github/workflows/blockifier_ci.yml' | |
- 'crates/blockifier/**' | |
- 'crates/native_blockifier/**' | |
- 'build_native_blockifier_in_docker.sh' | |
- 'scripts/build_native_blockifier.sh' | |
- 'scripts/blockifier.Dockerfile' | |
jobs: | |
featureless-build: | |
runs-on: starkware-ubuntu-20-04-medium | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: "v0-rust-ubuntu-20.04" | |
- run: cargo build -p blockifier | |
- run: cargo test -p blockifier | |
native-blockifier-artifacts-push: | |
runs-on: starkware-ubuntu-20-04-medium | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: "v1-rust-ubuntu-20.04" | |
- name: Build native blockifier | |
run: ./build_native_blockifier_in_docker.sh | |
# Commit hash on pull request event would be the head commit of the branch. | |
- name: Get commit hash prefix for PR update | |
if: ${{ github.event_name == 'pull_request' }} | |
env: | |
COMMIT_SHA: ${{ github.event.pull_request.head.sha }} | |
run: echo "SHORT_HASH=${COMMIT_SHA:0:7}" >> $GITHUB_ENV | |
# On push event (to main, for example) we should take the commit post-push. | |
- name: Get commit hash prefix for merge | |
if: ${{ github.event_name != 'pull_request' }} | |
env: | |
COMMIT_SHA: ${{ github.event.after }} | |
run: echo "SHORT_HASH=${COMMIT_SHA:0:7}" >> $GITHUB_ENV | |
# Rename is required; see https://pyo3.rs/v0.19.2/building_and_distribution#manual-builds. | |
- name: Rename shared object | |
run: | | |
mv \ | |
target/release/libnative_blockifier.so \ | |
target/release/native_blockifier.pypy39-pp73-x86_64-linux-gnu.so | |
- name: Authenticate with GCS | |
# Fork PRs do not have access to secrets. | |
# Push events should trigger the upload regardless of the originating PR. | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
uses: "google-github-actions/auth@v2" | |
with: | |
credentials_json: ${{ secrets.SA_NATIVE_BLOCKIFIER_ARTIFACTS_BUCKET_WRITER_ACCESS_KEY }} | |
- name: Upload binary to GCP | |
# Fork PRs do not have access to secrets (so no uploading). | |
# Push events should trigger the upload regardless of the originating PR. | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
id: upload_file | |
uses: "google-github-actions/upload-cloud-storage@v2" | |
with: | |
path: "target/release/native_blockifier.pypy39-pp73-x86_64-linux-gnu.so" | |
destination: "native_blockifier_artifacts/${{ env.SHORT_HASH }}/release/" |