Skip to content

Commit

Permalink
Use new CI workflows for pull-request and merge to main (#1955)
Browse files Browse the repository at this point in the history
on_pull_request.yml includes the following pieces:
 - reusable_checks.yml -- Run all of the lints, code-formatting, tests, etc.
 - reusable_build_and_test_wheels.yml -- Configured in a "minimal" mode with SDK includes end-to-end test and produces an rrd.
 - reusable_build_web.yml -- Verifies we can build the wasm
 - reusable_upload_web.yml -- Uploads the RRD and Wasm to app.rerun.io to confirm the demo works as well as support notebook testing.
 - reusable_pr_summary.yml -- Create a manifest page with a link to the

on_push_main.yml includes the following pieces:
 - reusable_checks.yml -- Run all of the lints, code-formatting, tests, etc.
 - reusable_bench.yml -- Run the benchmarks
 - reusable_build_and_test_wheels.yml -- Builds wheels for all platforms
 - reusable_upload_wheel.yml -- Uploads the all the wheels to gcloud
 - reusable_build_web.yml -- Builds the wasm bundle
 - reusable_upload_web.yml -- Uploads the RRD and Wasm to app.rerun.io
 - reusable_pip_index.yml -- Generates a pip index page which can be used to install packages with, e.g.
  • Loading branch information
jleibs authored Apr 25, 2023
1 parent 01080d6 commit ff436d8
Show file tree
Hide file tree
Showing 17 changed files with 525 additions and 1,104 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ By convention:
- All workflows that are triggered via `workflow_dispatch` start with the `manual_` prefix.
- All workflows that are triggered via an event start with the `on_` prefix.
- `on_pull_request` is triggered on pull requests.
- `on_main` is triggered on pushes to the main branch.
- `on_push_main` is triggered on pushes to the main branch.

If you are going to be doing any editing of workflows, the
[VS Code extension](https://marketplace.visualstudio.com/items?itemName=cschleiden.vscode-github-actions)
Expand Down Expand Up @@ -51,7 +51,7 @@ uploaded anywhere.
request builds associated with their originating commit, even if the web-build happens on an ephemeral merge-commit.
- [reusable_pr_summary.yml](reusable_pr_summary.yml) - This job updates the PR summary with the results of the CI run.
- This summary can be found at:
`https://storage.googleapis.com/rerun-builds/pull_request/<PR_NUMBER>/index.html`
`https://build.rerun.io/pr/<PR_NUMBER>/`
- `PR_NUMBER` - The PR number to update. This will generally be set by the `on_pull_request.yml` workflow using:
`${{github.event.pull_request.number}}`

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/manual_build_wheels_for_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ jobs:
RRD_ARTIFACT_NAME: linux-rrd
secrets: inherit

generate-wheel-index:
name: 'Generate Pip Index'
needs: [check-for-pr, upload-wheels-linux, upload-wheels-windows, upload-wheels-macos-arm, upload-wheels-macos-intel]
uses: ./.github/workflows/reusable_pip_index.yml
secrets: inherit

update-pr-summary:
name: 'Update PR Summary'
needs: [check-for-pr, upload-wheels-linux, upload-wheels-windows, upload-wheels-macos-arm, upload-wheels-macos-intel]
Expand Down
45 changes: 43 additions & 2 deletions .github/workflows/manual_run_bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,54 @@ name: Manually run the benchmarks

on:
workflow_dispatch:
inputs:
BENCH_NAME:
description: 'Name of the benchmark to save'
type: string
required: false
default: ''
COMPARE_TO:
description: 'Saved Benchmark to compare to'
type: string
required: false
default: 'main'

jobs:

run-benchmarks:
run-benches:
name: Benchmarks
uses: ./.github/workflows/reusable_bench.yml
with:
BENCH_NAME: ${{ github.event.inputs.BENCH_NAME }}
COMPARE_TO: ${{ github.event.inputs.COMPARE_TO }}
secrets: inherit

check-for-pr:
runs-on: ubuntu-latest
outputs:
PR_NUMBER: ${{ steps.get_pr.outputs.PR_NUMBER }}
steps:
- name: Check if commit belongs to a PR
id: get_pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "TODO(jleibs): Run benches"
pr_number=$(curl --silent --header "Authorization: Bearer ${GITHUB_TOKEN}" \
--url "https://api.github.com/repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/pulls" \
| jq '.[] | .number')
if [ -z "$pr_number" ]; then
echo "No PR associated with this commit"
exit 1
else
echo "Commit is associated with PR: $pr_number"
echo "PR_NUMBER=$pr_number" >> "$GITHUB_OUTPUT"
fi
update-pr-summary:
name: 'Update PR Summary'
needs: [check-for-pr, run-benches]
uses: ./.github/workflows/reusable_pr_summary.yml
with:
PR_NUMBER: ${{ needs.check-for-pr.outputs.PR_NUMBER}}
secrets: inherit
32 changes: 0 additions & 32 deletions .github/workflows/misc.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Pull-Request

on:
pull_request:
types:
- opened
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# These jobs use fairly short names as they are a prefix in the display hierarchy
jobs:
checks:
name: Checks
uses: ./.github/workflows/reusable_checks.yml
secrets: inherit


min-test-wheel:
name: 'Minimum Wheel'
uses: ./.github/workflows/reusable_build_and_test_wheels.yml
with:
SAVE_CACHE: false
PLATFORM: linux
MATURIN_FEATURE_FLAGS: '--no-default-features --features extension-module'
WHEEL_ARTIFACT_NAME: '' # the min-test wheel isn't used for anything
RRD_ARTIFACT_NAME: linux-rrd-fast
secrets: inherit

build-web:
name: 'Build Web'
uses: ./.github/workflows/reusable_build_web.yml
secrets: inherit

upload-web:
name: 'Upload Web'
needs: [min-test-wheel, build-web]
uses: ./.github/workflows/reusable_upload_web.yml
with:
RRD_ARTIFACT_NAME: linux-rrd-fast
UPLOAD_COMMIT_OVERRIDE: ${{ github.event.pull_request.head.sha }}
secrets: inherit

save-pr-summary:
name: 'Save PR Summary'
needs: [upload-web]
uses: ./.github/workflows/reusable_pr_summary.yml
with:
PR_NUMBER: ${{ github.event.pull_request.number }}
secrets: inherit
173 changes: 173 additions & 0 deletions .github/workflows/on_push_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: Pull-Request

on:
push:
branches:
- "main"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
checks:
name: Checks
uses: ./.github/workflows/reusable_checks.yml
secrets: inherit

benches:
name: Benchmarks
uses: ./.github/workflows/reusable_bench.yml
with:
SAVE_BENCHES: true
BENCH_NAME: main
COMPARE_TO: main
secrets: inherit

deploy-docs:
needs: [checks, benches]
name: Deploy Docs
uses: ./.github/workflows/reusable_deploy_docs.yml
with:
PY_DOCS_VERSION_NAME: "HEAD"
UPDATE_LATEST: false
secrets: inherit

build-web:
name: 'Build Web'
uses: ./.github/workflows/reusable_build_web.yml
secrets: inherit

upload-web:
name: 'Upload Web'
needs: [build-linux, build-web]
uses: ./.github/workflows/reusable_upload_web.yml
with:
RRD_ARTIFACT_NAME: linux-rrd
MARK_PRERELEASE_FOR_MAINLINE: true
secrets: inherit

build-linux:
needs: [checks]
name: 'Linux: Build/Test Wheels'
uses: ./.github/workflows/reusable_build_and_test_wheels.yml
with:
PLATFORM: linux
WHEEL_ARTIFACT_NAME: linux-wheel
RRD_ARTIFACT_NAME: linux-rrd
secrets: inherit

build-windows:
needs: [checks]
name: 'Windows: Build/Test Wheels'
uses: ./.github/workflows/reusable_build_and_test_wheels.yml
with:
PLATFORM: windows
WHEEL_ARTIFACT_NAME: windows-wheel
RRD_ARTIFACT_NAME: ''
secrets: inherit

build-macos-arm:
needs: [checks]
name: 'Macos-Arm: Build/Test Wheels'
uses: ./.github/workflows/reusable_build_and_test_wheels.yml
with:
PLATFORM: macos-arm
WHEEL_ARTIFACT_NAME: macos-arm-wheel
RRD_ARTIFACT_NAME: ''
secrets: inherit

build-macos-intel:
needs: [checks]
name: 'Macos-Intel: Build/Test Wheels'
uses: ./.github/workflows/reusable_build_and_test_wheels.yml
with:
PLATFORM: macos-intel
WHEEL_ARTIFACT_NAME: 'macos-intel-wheel'
RRD_ARTIFACT_NAME: ''
secrets: inherit

upload-wheels-linux:
name: 'Linux: Upload Wheels'
needs: [build-linux]
uses: ./.github/workflows/reusable_upload_wheels.yml
with:
WHEEL_ARTIFACT_NAME: linux-wheel
RRD_ARTIFACT_NAME: linux-rrd
secrets: inherit

upload-wheels-windows:
name: 'Windows: Upload Wheels'
needs: [build-linux, build-windows]
uses: ./.github/workflows/reusable_upload_wheels.yml
with:
WHEEL_ARTIFACT_NAME: windows-wheel
RRD_ARTIFACT_NAME: linux-rrd
secrets: inherit

upload-wheels-macos-arm:
name: 'Macos-Arm: Upload Wheels'
needs: [build-linux, build-macos-arm]
uses: ./.github/workflows/reusable_upload_wheels.yml
with:
WHEEL_ARTIFACT_NAME: macos-arm-wheel
RRD_ARTIFACT_NAME: linux-rrd
secrets: inherit

upload-wheels-macos-intel:
name: 'Macos-Intel: Upload Wheels'
needs: [build-linux, build-macos-intel]
uses: ./.github/workflows/reusable_upload_wheels.yml
with:
WHEEL_ARTIFACT_NAME: macos-intel-wheel
RRD_ARTIFACT_NAME: linux-rrd
secrets: inherit

generate-pip-index:
name: 'Generate Pip Index'
needs: [upload-wheels-linux, upload-wheels-windows, upload-wheels-macos-arm, upload-wheels-macos-intel]
uses: ./.github/workflows/reusable_pip_index.yml
secrets: inherit

pre-release:
name: Pre Release
needs: [upload-web, generate-pip-index]
runs-on: "ubuntu-latest"
steps:
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${{github.sha}} | cut -c1-7`" >> $GITHUB_ENV

# First delete the old prerelease. If we don't do this, we don't get things like
# proper source-archives and changelog info.
# https://github.com/dev-drprasad/delete-tag-and-release
- uses: dev-drprasad/[email protected]
with:
tag_name: prerelease
delete_release: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Create the actual prerelease
# https://github.com/ncipollo/release-action
- name: GitHub Release
uses: ncipollo/[email protected]
with:
body: |
This is a prerelease. It is not intended for production use.
Please report any issues you find.
## Example Hosted App
https://app.rerun.io/commit/${{ env.SHORT_SHA }}
## Wheels can be installed with:
```
pip install --pre -f https://build.rerun.io/commit/${{ env.SHORT_SHA}}/wheels --upgrade rerun-sdk
```
prerelease: true
name: "Development Build"
tag: "prerelease"
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: true
Loading

0 comments on commit ff436d8

Please sign in to comment.