Skip to content

Commit

Permalink
Upload web viewer to a bucket (#1606)
Browse files Browse the repository at this point in the history
* upload web viewer to a bucket
* Add correct permissions for auth
* bump docker image version
* Only publish wasm on merges to main
* add manual trigger to rust ci with option to force web build upload (default off)
* Version the destination bucket
* Restrict web-build / upload to main, tags, and workflow-dispatch
  • Loading branch information
emilk authored Mar 20, 2023
1 parent 86d0f10 commit 0781ef5
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ on:
branches:
- "main"
pull_request:
workflow_dispatch:
inputs:
force_update_web_build:
description: "Upload web build to google cloud"
required: true
default: false
type: boolean

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Cancel previous CI jobs on the same branch
Expand Down Expand Up @@ -234,6 +241,69 @@ jobs:

# ---------------------------------------------------------------------------

rs-build-web-viewer:
name: Upload web build to google cloud (wasm32 + wasm-bindgen)
permissions:
contents: "read"
id-token: "write"

if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || github.event.inputs.force_update_web_build
runs-on: ubuntu-latest-16-cores
container:
image: rerunio/ci_docker:0.6
env:
RUSTFLAGS: ${{env.RUSTFLAGS}}
RUSTDOCFLAGS: ${{env.RUSTDOCFLAGS}}
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.67.0
target: wasm32-unknown-unknown
override: true

- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
with:
env-vars: CARGO CC CFLAGS CXX CMAKE RUST CACHE_KEY
# See: https://github.com/rerun-io/rerun/pull/497
save-if: ${{ github.event_name == 'push'}}

- name: Build web-viewer (release)
uses: actions-rs/cargo@v1
with:
command: run
args: --locked -p re_build_web_viewer -- --release

# 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: echo "SHORT_SHA=`echo ${{github.sha}} | cut -c1-8`" >> $GITHUB_ENV

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

- name: "Upload web-viewer (tagged)"
if: startsWith(github.ref, 'refs/tags/v')
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_viewer"
destination: "rerun-web-viewer/version/${{github.ref_name}}"
parent: false

# ---------------------------------------------------------------------------

rs-cargo-deny:
name: Check Rust dependencies (cargo-deny)
runs-on: ubuntu-latest-16-cores
Expand Down

1 comment on commit 0781ef5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: 0781ef5 Previous: 86d0f10 Ratio
datastore/insert/batch/rects/insert 564880 ns/iter (± 5103) 561246 ns/iter (± 2192) 1.01
datastore/latest_at/batch/rects/query 1870 ns/iter (± 15) 1871 ns/iter (± 49) 1.00
datastore/latest_at/missing_components/primary 293 ns/iter (± 2) 287 ns/iter (± 0) 1.02
datastore/latest_at/missing_components/secondaries 433 ns/iter (± 3) 452 ns/iter (± 0) 0.96
datastore/range/batch/rects/query 153477 ns/iter (± 1850) 152524 ns/iter (± 239) 1.01
mono_points_arrow/generate_message_bundles 48844526 ns/iter (± 1265749) 46558661 ns/iter (± 1305865) 1.05
mono_points_arrow/generate_messages 137756012 ns/iter (± 1593909) 138526034 ns/iter (± 1446771) 0.99
mono_points_arrow/encode_log_msg 165195359 ns/iter (± 1040800) 164757328 ns/iter (± 1201719) 1.00
mono_points_arrow/encode_total 357571584 ns/iter (± 3169304) 352164723 ns/iter (± 1707971) 1.02
mono_points_arrow/decode_log_msg 186767070 ns/iter (± 1431812) 184807548 ns/iter (± 1075911) 1.01
mono_points_arrow/decode_message_bundles 74673167 ns/iter (± 1025197) 72657778 ns/iter (± 1531084) 1.03
mono_points_arrow/decode_total 256245994 ns/iter (± 2176319) 254375997 ns/iter (± 2047586) 1.01
batch_points_arrow/generate_message_bundles 323516 ns/iter (± 3998) 327481 ns/iter (± 1844) 0.99
batch_points_arrow/generate_messages 6470 ns/iter (± 57) 6442 ns/iter (± 19) 1.00
batch_points_arrow/encode_log_msg 358540 ns/iter (± 3193) 355206 ns/iter (± 1162) 1.01
batch_points_arrow/encode_total 700429 ns/iter (± 5626) 707655 ns/iter (± 1493) 0.99
batch_points_arrow/decode_log_msg 347617 ns/iter (± 1454) 346229 ns/iter (± 565) 1.00
batch_points_arrow/decode_message_bundles 2046 ns/iter (± 26) 2064 ns/iter (± 13) 0.99
batch_points_arrow/decode_total 353880 ns/iter (± 2920) 355825 ns/iter (± 645) 0.99
arrow_mono_points/insert 7087438616 ns/iter (± 13960436) 6941511190 ns/iter (± 90937967) 1.02
arrow_mono_points/query 1789669 ns/iter (± 18050) 1715490 ns/iter (± 23179) 1.04
arrow_batch_points/insert 2681181 ns/iter (± 20305) 2657248 ns/iter (± 15401) 1.01
arrow_batch_points/query 16077 ns/iter (± 160) 15817 ns/iter (± 263) 1.02
arrow_batch_vecs/insert 42298 ns/iter (± 318) 41185 ns/iter (± 578) 1.03
arrow_batch_vecs/query 383412 ns/iter (± 4284) 378721 ns/iter (± 4537) 1.01
tuid/Tuid::random 34 ns/iter (± 0) 34 ns/iter (± 0) 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.