Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more examples to app.rerun.io #2062

Merged
merged 34 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4c3d2f6
separate `web_viewer` html, css, and js for reuse
jprochazk May 9, 2023
a90fe19
ignore `web_viewer/examples`
jprochazk May 9, 2023
8453ba6
add web examples build script
jprochazk May 9, 2023
bb7878e
revert `web_viewer`
jprochazk May 10, 2023
6d5ca47
move `demo` html/js/css into `scripts/templates/demo`
jprochazk May 10, 2023
bc3fc96
rename `build_examples_rrd` to `build_demo_app`
jprochazk May 10, 2023
38b27ca
move demo app assets to a separate directory
jprochazk May 10, 2023
bf478f6
build demo app into `web_demo` dir
jprochazk May 10, 2023
c2e20d7
update `build_demo_app.py` script
jprochazk May 11, 2023
cb49028
remove unnecessary markup
jprochazk May 11, 2023
b061ea0
update examples header
jprochazk May 11, 2023
0d10dc2
change port to static
jprochazk May 11, 2023
c6b5d8b
fix icon user-select
jprochazk May 11, 2023
14b6b54
fix /examples links
jprochazk May 11, 2023
4723e5a
add build/upload workflows for web demo
jprochazk May 11, 2023
72e9d2b
add web_demo workflows to ci
jprochazk May 11, 2023
aa9af79
install jinja2
jprochazk May 11, 2023
5bbc1a9
update web-demo builds to require wheel build
jprochazk May 11, 2023
2e485ba
download wasm from `build-web` instead of building
jprochazk May 11, 2023
5b46ca3
`WASM` -> `Wasm`
jprochazk May 11, 2023
cc27236
only copy release wasm
jprochazk May 11, 2023
0910637
disable `deep_sdf` example
jprochazk May 11, 2023
c0f3b9f
fix asset paths + upload tagged version as /latest
jprochazk May 11, 2023
20af755
add extra build args
jprochazk May 11, 2023
ce1e2ee
uninstall rerun-sdk before installing
jprochazk May 11, 2023
f14ea5f
add `-y` when uninstalling `rerun-sdk`
jprochazk May 11, 2023
ec11ecf
display output when building app
jprochazk May 12, 2023
f3588c1
cache js and css
jprochazk May 12, 2023
26e008c
remove `examples` from gitignore in `web_viewer`
jprochazk May 12, 2023
8ccb574
use latest commit hash in CI
jprochazk May 12, 2023
1d2e46b
bind `--serve` on `0.0.0.0`
jprochazk May 15, 2023
a710ab8
fix typo in workflow
jprochazk May 15, 2023
8ac58e7
fix gh icon highlight
jprochazk May 15, 2023
6dd3953
add source link commit override
jprochazk May 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,23 @@ uploaded anywhere.
- `RELEASE_VERSION` - If producing a release, the version number. This must match the version in `Cargo.toml`.
- [reusable_upload_web.yml](reusable_upload_web.yml) - This job uploads the web assets to google cloud. By default this
only uploads to: `app.rerun.io/commit/<commit>/`
- `MARK_PRERELEASE_FOR_MAINLINE` - If true, then the web assets will go to `app.rerun.io/preleease/
- `MARK_PRERELEASE_FOR_MAINLINE` - If true, then the web assets will go to `app.rerun.io/prelease/
- `MARK_TAGGED_VERSION` - If true, then the web assets will go to `app.rerun.io/version/<RELEASE_VERSION>`
- `RELEASE_VERSION` - If producing a release, the version number.
- `RRD_ARTIFACT_NAME` - Intermediate name of the GitHub rrd artifact. This should match the name passed to
`reusable_build_and_test_wheels.yml`
- `UPLOAD_COMMIT_OVERRIDE` - If set, will replace the value of `<commit>`. This is necessary because we want pull
request builds associated with their originating commit, even if the web-build happens on an ephemeral merge-commit.
- [reusable_build_web_demo.yml](reusable_build_web.yml) - This job builds the assets uploaded to `demo.rerun.io`.
- `SOURCE_LINK_COMMIT_OVERRIDE` - If set, will replace the value of `<commit>` in the built app. This ensures that the
source source code link in the built app always points to the pull request's `HEAD`.
- [reusable_upload_web_demo.yml](reusable_upload_web_demo.yml) - This job uploads the `demo.rerun.io` assets to google cloud. By default this
only uploads to: `demo.rerun.io/commit/<commit>/`
- `MARK_PRERELEASE_FOR_MAINLINE` - If true, then the web assets will go to `demo.rerun.io/prelease/
- `MARK_TAGGED_VERSION` - If true, then the web assets will go to `demo.rerun.io/version/<RELEASE_VERSION>`
- `RELEASE_VERSION` - If producing a release, the version number.
- `UPLOAD_COMMIT_OVERRIDE` - If set, will replace the value of `<commit>`. This is necessary because we want pull
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://build.rerun.io/pr/<PR_NUMBER>/`
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/manual_adhoc_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
CONCURRENCY: adhoc-web-${{ github.event.inputs.ADHOC_NAME }}
PLATFORM: linux
MATURIN_FEATURE_FLAGS: '--no-default-features --features extension-module'
WHEEL_ARTIFACT_NAME: ''
WHEEL_ARTIFACT_NAME: linux-wheel
RRD_ARTIFACT_NAME: linux-rrd-fast
secrets: inherit

Expand All @@ -46,3 +46,23 @@ jobs:
ADHOC_NAME: ${{ github.event.inputs.ADHOC_NAME }}
RRD_ARTIFACT_NAME: linux-rrd-fast
secrets: inherit

build-web-demo-adhoc:
name: 'Build Web Demo'
needs: [min-test-wheel, build-web-adhoc]
uses: ./.github/workflows/reusable_build_web_demo.yml
with:
CONCURRENCY: adhoc-web-${{ github.event.inputs.ADHOC_NAME }}
WHEEL_ARTIFACT_NAME: linux-wheel
secrets: inherit

upload-web-demo:
name: 'Upload Web Demo'
needs: [build-web-demo-adhoc]
uses: ./.github/workflows/reusable_upload_web_demo.yml
with:
CONCURRENCY: adhoc-web-${{ github.event.inputs.ADHOC_NAME }}
MARK_PRERELEASE_FOR_MAINLINE: false
MARK_TAGGED_VERSION: false
ADHOC_NAME: ${{ github.event.inputs.ADHOC_NAME }}
secrets: inherit
27 changes: 27 additions & 0 deletions .github/workflows/manual_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ on:
required: false
default: true

BUILD_WEB_DEMO:
description: 'Run reusable_build_web'
type: boolean
required: false
default: true

RELEASE_VERSION:
description: 'Release Version Number (Must match Cargo.toml)'
type: string
Expand Down Expand Up @@ -231,6 +237,27 @@ jobs:
RRD_ARTIFACT_NAME: linux-rrd-fast
secrets: inherit

build-web-demo:
name: 'Build Web Demo'
needs: [min-test-wheel, build-web]
if: ${{ github.event.inputs.BUILD_WEB_DEMO == 'true'}}
uses: ./.github/workflows/reusable_build_web_demo.yml
with:
CONCURRENCY: manual-dispatch-${{ github.run_id}}
WHEEL_ARTIFACT_NAME: linux-wheel
secrets: inherit

upload-web-demo:
name: 'Upload Web Demo'
needs: [build-web-demo]
if: ${{ (github.event.inputs.BUILD_WEB_DEMO == 'true') && (github.event.inputs.UPLOAD_GCLOUD == 'true') }}
uses: ./.github/workflows/reusable_upload_web_demo.yml
with:
CONCURRENCY: manual-dispatch-${{ github.run_id}}
MARK_PRERELEASE_FOR_MAINLINE: false
MARK_TAGGED_VERSION: false
secrets: inherit

check-for-pr:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.UPDATE_PR_SUMMARY == 'true' }}
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,25 @@ jobs:
UPLOAD_COMMIT_OVERRIDE: ${{ github.event.pull_request.head.sha }}
secrets: inherit

build-web-demo:
name: 'Build Web Demo'
needs: [min-test-wheel, build-web]
uses: ./.github/workflows/reusable_build_web_demo.yml
with:
CONCURRENCY: pr-${{ github.event.pull_request.number }}
WHEEL_ARTIFACT_NAME: linux-wheel-fast
SOURCE_LINK_COMMIT_OVERRIDE: ${{ github.event.pull_request.head.sha }}
secrets: inherit

upload-web-demo:
name: 'Upload Web Demo'
needs: [build-web-demo]
uses: ./.github/workflows/reusable_upload_web_demo.yml
with:
CONCURRENCY: pr-${{ github.event.pull_request.number }}
UPLOAD_COMMIT_OVERRIDE: ${{ github.event.pull_request.head.sha }}
secrets: inherit

run-notebook:
name: 'Run Notebook'
needs: [min-test-wheel]
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/on_push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ jobs:
MARK_PRERELEASE_FOR_MAINLINE: true
secrets: inherit

build-web-demo:
name: 'Build Web Demo'
needs: [build-linux, build-web]
uses: ./.github/workflows/reusable_build_web_demo.yml
with:
CONCURRENCY: push-${{ github.ref_name }}
WHEEL_ARTIFACT_NAME: linux-wheel
secrets: inherit

upload-web-demo:
name: 'Upload Web'
needs: [build-web-demo]
uses: ./.github/workflows/reusable_upload_web_demo.yml
with:
CONCURRENCY: push-${{ github.ref_name }}
MARK_PRERELEASE_FOR_MAINLINE: true
secrets: inherit

build-linux:
needs: [checks]
name: 'Linux: Build/Test Wheels'
Expand Down
99 changes: 99 additions & 0 deletions .github/workflows/reusable_build_web_demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Reusable Build Web Demo

on:
workflow_call:
inputs:
CONCURRENCY:
required: true
type: string
WHEEL_ARTIFACT_NAME:
required: true
type: string
# Each example in the built app contains a link to its source code.
# This determines the target commit to link to, and by default
# it is the current commit (github.sha)
SOURCE_LINK_COMMIT_OVERRIDE:
required: false
type: string

concurrency:
group: ${{ inputs.CONCURRENCY }}-build-web-demo
cancel-in-progress: true

env:
PYTHON_VERSION: "3.8"
# web_sys_unstable_apis is required to enable the web_sys clipboard API which egui_web uses
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
RUSTFLAGS: --cfg=web_sys_unstable_apis --deny warnings

# See https://github.com/ericseppanen/cargo-cranky/issues/8
RUSTDOCFLAGS: --deny warnings --deny rustdoc::missing_crate_level_docs

jobs:
rs-build-web-demo:
name: Build Web Demo
permissions:
contents: "read"
id-token: "write"

runs-on: ubuntu-latest-16-cores

container:
image: rerunio/ci_docker:0.6

steps:
- uses: actions/checkout@v3

- name: Download Web Viewer
uses: actions/download-artifact@v3
with:
name: web_viewer
path: web_viewer

- name: Download Wheel
uses: actions/download-artifact@v3
with:
name: ${{ inputs.WHEEL_ARTIFACT_NAME }}
path: wheel

- name: Install dependencies for examples/python
run: |
pip install -r scripts/requirements-web-demo.txt
pip install Jinja2

- name: Install built wheel
shell: bash
run: |
pip uninstall rerun-sdk -y
pip install deprecated numpy>=1.23 pyarrow==10.0.1 pytest==7.1.2
pip install rerun-sdk --no-index --find-links wheel

- name: Verify built wheel version
shell: bash
run: |
python3 -m rerun --version
which rerun
rerun --version

- name: Resolve source link commit hash
run: |
if [ -z "${{ inputs.SOURCE_LINK_COMMIT_OVERRIDE }}" ]; then
USED_SHA=${{ github.sha }}
else
USED_SHA=${{ inputs.SOURCE_LINK_COMMIT_OVERRIDE }}
fi
echo "SHORT_SHA=$(echo $USED_SHA | cut -c1-7)" >> $GITHUB_ENV

- name: Build web demo
env:
COMMIT_HASH: ${{ env.SHORT_SHA }}
run: |
python3 scripts/build_demo_app.py --skip-wasm-build

- name: Upload web demo assets
uses: actions/upload-artifact@v3
with:
name: web_demo
path: web_demo

108 changes: 108 additions & 0 deletions .github/workflows/reusable_upload_web_demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Reusable Upload Web Demo

on:
workflow_call:
inputs:
CONCURRENCY:
required: true
type: string
ADHOC_NAME:
type: string
required: false
default: ''
MARK_PRERELEASE_FOR_MAINLINE:
required: false
type: boolean
default: false
MARK_TAGGED_VERSION:
required: false
type: boolean
default: false
RELEASE_VERSION:
required: false
type: string
default: 'prerelease'
# We need this because PRs use a merged commit but we really want
# to track uploads based on the source commit.
UPLOAD_COMMIT_OVERRIDE:
required: false
type: string
default: ''

concurrency:
group: ${{ inputs.CONCURRENCY }}-upload-web-demo
cancel-in-progress: true

jobs:

upload-web:
name: Upload Web Wemo to Google Cloud
permissions:
contents: "read"
id-token: "write"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Download web demo assets
uses: actions/download-artifact@v3
with:
name: web_demo
path: web_demo

# Upload the wasm, html etc to a Google cloud bucket:
- id: "auth"
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}

- name: Add SHORT_SHA env property with commit short sha
run: |
if [ -z "${{ inputs.UPLOAD_COMMIT_OVERRIDE }}" ]; then
USED_SHA=${{ github.sha }}
else
USED_SHA=${{ inputs.UPLOAD_COMMIT_OVERRIDE }}
fi
echo "SHORT_SHA=$(echo $USED_SHA | cut -c1-7)" >> $GITHUB_ENV

- name: "Upload web demo (commit)"
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_demo"
destination: "rerun-demo/commit/${{env.SHORT_SHA}}"
parent: false

- name: "Upload web demo (prerelease)"
if: inputs.MARK_PRERELEASE_FOR_MAINLINE
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_demo"
destination: "rerun-demo/prerelease"
parent: false

- name: "Upload web demo (tagged)"
if: inputs.MARK_TAGGED_VERSION
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_demo"
destination: "rerun-demo/version/${{inputs.RELEASE_VERSION}}"
parent: false

- name: "Upload web demo (latest)"
if: inputs.MARK_TAGGED_VERSION
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_demo"
destination: "rerun-demo/version/latest"
parent: false

- name: "Upload web demo (adhoc)"
if: ${{ inputs.ADHOC_NAME != '' }}
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_demo"
destination: "rerun-demo/adhoc/${{inputs.ADHOC_NAME}}"
parent: false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ perf.data*

# Screenshots from samples etc.
screenshot*.png

# Web demo app build
web_demo
Loading