benchmark-action / github-action-benchmark

GitHub Action for continuous benchmarking to keep performance
https://benchmark-action.github.io/github-action-benchmark/dev/bench/
MIT License
1.02k stars 152 forks source link

index.html is not being created #160

Open eranreshef-starkware opened 1 year ago

eranreshef-starkware commented 1 year ago

Hi,

I am trying to use this github action for keeping track on the performance of a customSmallerIsBetter tool. After the action is executed, I don't see index.html is being generated.

I would appreciate some help. Thanks!

name: Benchmarks

on:
  workflow_dispatch:
  push:
    branches: [master]

permissions:
  # deployments permission to deploy GitHub pages website
  deployments: write
  # contents permission to update benchmark contents in gh-pages branch
  contents: write

jobs:
  deploy-benchmark-teardown:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Set a unique run identifier
        run: echo "UNIQE_ID=${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV

      - name: Run load test
        run: |
          cat >/tmp/results.json <<EOL
          [
              {
                  "name": "My Custom Smaller Is Better Benchmark - CPU Load",
                  "unit": "Percent",
                  "value": ${{ github.run_number }}
              },
              {
                  "name": "My Custom Smaller Is Better Benchmark - Memory Used",
                  "unit": "Megabytes",
                  "value": ${{ github.run_attempt }},
                  "range": "3",
                  "extra": "Value for Tooltip: 25\nOptional Num #2: 100\nAnything Else!"
              }
          ]
          EOL

      # Download previous benchmark result from cache (if exists)
      - name: Download previous benchmark data
        uses: actions/cache@v1
        with:
          path: ./cache
          key: ${{ runner.os }}-benchmark

      # Run `github-action-benchmark` action
      - name: Store benchmark result
        uses: benchmark-action/github-action-benchmark@v1
        with:
          name: My Test Benchmark
          # What benchmark tool the output.txt came from
          tool: "customSmallerIsBetter"
          # Where the output from the benchmark tool is stored
          output-file-path: /tmp/results.json
          # Where the previous data file is stored
          external-data-json-path: ./cache/benchmark_data.json
          # Workflow will fail when an alert happens
          fail-on-alert: true
          auto-push: false

      - name: Push benchmark result
        run: |
          git fetch
          git checkout gh-pages
          git config --global user.name "eran-test-user"
          git config --global user.email "username@users.noreply.github.com"
          git add .
          git commit -m "${{ github.run_number }}-${{ github.run_attempt }}"
          git push 'https://eranreshef-starkware:${{ secrets.GITHUB_TOKEN }}@github.com/eranreshef-starkware/test-benchmark.git' gh-pages:gh-pages
Cevedale commented 1 year ago

I think that your GitHub Actions workflow aims to run benchmarks and update a GitHub Pages branch (gh-pages). However, there is no explicit step for generating an index.html file or updating the content of the gh-pages branch. To address this, you should include a step to generate the index.html file based on your benchmark results, and then add a separate step to update the gh-pages branch with the new content. Make sure to customize these steps according to your project structure, and ensure that the necessary files are staged for commit. Additionally, verify that your repository has a gh-pages branch created, and GitHub Pages is configured to use this branch for rendering content.

ktrz commented 10 months ago

when using external-data-json-path the action doesn't create an index.html file. It will only create one if that option is not set. You can have a look at Charts on Github Pages part of README for an example