Dashboard Generator #80297
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2023 The TensorFlow Authors. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# ============================================================================ | |
name: Dashboard Generator | |
on: | |
# Only the default branch is supported. | |
branch_protection_rule: | |
schedule: | |
- cron: '*/5 * * * *' | |
workflow_dispatch: | |
inputs: | |
gist: | |
required: false | |
description: (OPTIONAL) Overwrite "previous" data. Format is a hexadecimal gist ID. Gist should have files of JSON data, named same as matrix config / yaml files, extracted from e.g. merged.json. Can be empty or excluded. | |
reset: | |
required: false | |
description: (OPTIONAL) Reset all previous data. Type "yes reset" to enable. | |
jobs: | |
dashboards: | |
if: github.repository == 'tensorflow/build' # Don't do this in forks | |
name: Generate Dashboard | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
config: [ tensorflow, jax ] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0 | |
with: | |
persist-credentials: false | |
- name: Download previous workflow's data | |
if: "${{ github.event.inputs.reset != 'yes reset' }}" | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
path: tf_oss_dashboard | |
workflow_conclusion: success | |
if_no_artifact_found: warn | |
- name: Overwrite data, if provided | |
if: "${{ github.event.inputs.gist != '' }}" | |
run: | | |
mkdir -p tf_oss_dashboard/${{matrix.config}} | |
git clone "https://gist.github.com/${{github.event.inputs.gist}}.git" gist | |
cd gist | |
if [[ -s ${{matrix.config}} ]]; then | |
mv ${{matrix.config}} ../tf_oss_dashboard/${{matrix.config}}/old.json | |
fi | |
- name: Run Script | |
id: run-script | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: ./merge_and_generate.sh ${{matrix.config}} | |
working-directory: tf_oss_dashboard | |
- name: Upload ongoing data and dashboard output | |
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1 | |
with: | |
name: ${{matrix.config}} | |
path: tf_oss_dashboard/${{matrix.config}} | |
retention-days: 5 | |
assemble: | |
if: github.repository == 'tensorflow/build' # Don't do this in forks | |
name: Assemble Dashboards | |
needs: dashboards | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0 | |
with: | |
persist-credentials: false | |
# Get all artifacts into current dir | |
- uses: actions/[email protected] | |
with: | |
path: artifacts | |
- name: Move dashboard around, include all generated files | |
run: | | |
mv artifacts/tensorflow .site | |
mv -t .site tf_oss_dashboard/* | |
rmdir artifacts || mv -t .site artifacts/* | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload pages artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: '.site' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |