name: Reusable Build web viewer on: workflow_call: inputs: CONCURRENCY: required: true type: string RELEASE_VERSION: required: false type: string default: "prerelease" CHANNEL: # `nightly` or `main` required: true type: string concurrency: group: ${{ inputs.CONCURRENCY }}-build-web cancel-in-progress: true env: RUSTFLAGS: --deny warnings RUSTDOCFLAGS: --deny warnings defaults: run: shell: bash --noprofile --norc -euo pipefail {0} permissions: contents: "write" id-token: "write" pull-requests: "write" jobs: rs-build-web-viewer: name: Build web viewer timeout-minutes: 60 runs-on: ubuntu-latest-16-cores steps: - uses: actions/checkout@v4 with: ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }} - name: Get sha id: get-sha run: | full_commit="${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha }}" echo "sha=$(echo $full_commit | cut -c1-7)" >> "$GITHUB_OUTPUT" - name: Status comment if: github.event_name == 'pull_request' # https://github.com/mshick/add-pr-comment uses: mshick/add-pr-comment@v3.9.1 # GitHub API is very unreliable. We don't want to fail the entire workflow just because we couldn't post a comment. continue-on-error: true with: message-id: "web-viewer-build-status" repo-token: ${{ secrets.GITHUB_TOKEN }} message: | Web viewer is being built. | Result | Commit | Link | Manifest | | ------ | ------- | ----- | -------- | | ⏳ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | [`+nightly`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) [`+main`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) | View image diff on [kitdiff](https://rerun-io.github.io/kitdiff/?url=${{github.event.pull_request.html_url}}). Note: This comment is updated whenever you push a commit. - name: Set up Rust uses: ./.github/actions/setup-rust with: cache_key: "build-web" # Cache will be produced by `reusable_checks/rs-check-wasm` save_cache: false workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }} service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }} - uses: prefix-dev/setup-pixi@v0.10.0 with: pixi-version: v0.71.3 - name: Build web-viewer (release) run: | if [ ${{ inputs.CHANNEL }} = "nightly" ]; then export DEFAULT_EXAMPLES_MANIFEST_URL="https://app.rerun.io/version/nightly/examples_manifest.json" fi pixi run rerun-build-web-release # We build a single manifest pointing to the `commit` # All the `pr`, `main`, release tag, etc. variants will always just point to the resolved commit - name: Build examples manifest run: | full_commit="${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha }}" sha="$(echo $full_commit | cut -c1-7)" pixi run build-examples manifest \ --base-url "https://app.rerun.io/commit/$sha" \ --channel "${{ inputs.CHANNEL }}" \ "crates/viewer/re_web_viewer_server/web_viewer/examples_manifest.json" - name: Upload web viewer uses: actions/upload-artifact@v4 with: name: web_viewer path: "crates/viewer/re_web_viewer_server/web_viewer" - name: Status comment if: failure() && github.event_name == 'pull_request' # https://github.com/mshick/add-pr-comment uses: mshick/add-pr-comment@v3.9.1 # GitHub API is very unreliable. We don't want to fail the entire workflow just because we couldn't post a comment. continue-on-error: true with: message-id: "web-viewer-build-status" repo-token: ${{ secrets.GITHUB_TOKEN }} message: | Web viewer failed to build. | Result | Commit | Link | Manifest | | ------ | ------- | ----- | -------- | | ❌ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | [`+nightly`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) [`+main`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) | View image diff on [kitdiff](https://rerun-io.github.io/kitdiff/?url=${{github.event.pull_request.html_url}}). Note: This comment is updated whenever you push a commit.