diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index e02cca6b8f75..7f1425a538ab 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -23,7 +23,7 @@ jobs: 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 + WHEEL_ARTIFACT_NAME: 'linux-wheel-fast' RRD_ARTIFACT_NAME: linux-rrd-fast secrets: inherit @@ -44,9 +44,19 @@ jobs: UPLOAD_COMMIT_OVERRIDE: ${{ github.event.pull_request.head.sha }} secrets: inherit + run-notebook: + name: 'Run Notebook' + needs: [min-test-wheel] + uses: ./.github/workflows/reusable_run_notebook.yml + with: + CONCURRENCY: pr-${{ github.event.pull_request.number }} + WHEEL_ARTIFACT_NAME: linux-wheel-fast + UPLOAD_COMMIT_OVERRIDE: ${{ github.event.pull_request.head.sha }} + secrets: inherit + save-pr-summary: name: 'Save PR Summary' - needs: [upload-web] + needs: [upload-web, run-notebook] uses: ./.github/workflows/reusable_pr_summary.yml with: CONCURRENCY: pr-${{ github.event.pull_request.number }} diff --git a/.github/workflows/reusable_run_notebook.yml b/.github/workflows/reusable_run_notebook.yml new file mode 100644 index 000000000000..c2ccd4377316 --- /dev/null +++ b/.github/workflows/reusable_run_notebook.yml @@ -0,0 +1,82 @@ +name: Reusable Buld and Upload Notebook + +on: + workflow_call: + inputs: + CONCURRENCY: + required: true + type: string + WHEEL_ARTIFACT_NAME: + required: false + type: string + default: '' + # 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 }}-run-notebook + cancel-in-progress: true + +jobs: + + run-notebook: + name: Run notebook + + permissions: + contents: "read" + id-token: "write" + + runs-on: ubuntu-latest + + container: + image: rerunio/ci_docker:0.6 + + steps: + - uses: actions/checkout@v3 + + - name: Download Wheel + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.WHEEL_ARTIFACT_NAME }} + path: wheel + + - name: Install built wheel + shell: bash + run: | + pip install --find-links wheel rerun-sdk + + - name: Install Deps + shell: bash + run: | + pip install -r examples/python/notebook/requirements.txt + + - name: Create notebook + shell: bash + run: | + jupyter nbconvert --to=html --ExecutePreprocessor.enabled=True examples/python/notebook/cube.ipynb --output /tmp/cube.html + + - 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 Notebook" + uses: google-github-actions/upload-cloud-storage@v1 + with: + path: "/tmp/cube.html" + destination: "rerun-builds/commit/${{env.SHORT_SHA}}/notebooks" + parent: false diff --git a/scripts/generate_pr_summary.py b/scripts/generate_pr_summary.py index 4043be33c40f..74fe056a4340 100644 --- a/scripts/generate_pr_summary.py +++ b/scripts/generate_pr_summary.py @@ -54,6 +54,13 @@ def generate_pr_summary(github_token: str, github_repository: str, pr_number: in print("Found benchmark results: {}".format(commit_short)) found["bench_results"] = f"https://build.rerun.io/{bench_blob.name}" + # Check if there are notebook results + notebook_blobs = list(builds_bucket.list_blobs(prefix=f"commit/{commit_short}/notebooks")) + notebooks = [f"https://build.rerun.io/{blob.name}" for blob in notebook_blobs if blob.name.endswith(".html")] + if notebooks: + print("Found notebooks for commit: {}".format(commit_short)) + found["notebooks"] = notebooks + # Get the wheel files for the commit wheel_blobs = list(builds_bucket.list_blobs(prefix=f"commit/{commit_short}/wheels")) wheels = [f"https://build.rerun.io/{blob.name}" for blob in wheel_blobs if blob.name.endswith(".whl")] diff --git a/scripts/templates/pr_results_summary.html b/scripts/templates/pr_results_summary.html index 5990b71e5134..542171ad6635 100644 --- a/scripts/templates/pr_results_summary.html +++ b/scripts/templates/pr_results_summary.html @@ -12,6 +12,10 @@ margin-left: 20px; } + .notebook-list { + margin-left: 20px; + } + .wheel-list { margin-left: 20px; } @@ -34,6 +38,16 @@

Hosted App:

{% if build.bench_results %}

Benchmark Results

{% endif %} + {% if build.notebooks %} +
+

Notebooks:

+ +
+ {% endif %} {% if build.wheels %}

Wheels: