bobheadxi / gobenchdata

📉 Run Go benchmarks, publish results to an interactive web app, and check for performance regressions in your pull requests
https://gobenchdata.bobheadxi.dev
MIT License
142 stars 14 forks source link

Problem on second run: destination path '.' already exists and is not an empty directory #76

Closed ajnavarro closed 1 year ago

ajnavarro commented 1 year ago

First of all thanks for this amazing GitHub action!

I'm trying to publish benchmarks results to a separate repository. I already fixed the problem with the standard GitHub token and I'm using a personal one with write permissions.

I'm having a problem when executing a second run of benchmarks. If there is a benchmark.json file already on the remote repository, the process fails with exit status 128: fatal: destination path '.' already exists and is not an empty directory.

These are my workflow config files:

Main benchmark.yml file:

name: run benchmarks
on:
  workflow_call:
    inputs:
      publish:
        required: true
        type: boolean
      test-flags:
        required: true
        type: string
jobs:
  benchmarks:
    runs-on: self-hosted
    steps:
    - name: checkout
      uses: actions/checkout@v2
    - uses: actions/setup-go@v2
      with: 
        go-version: "1.20"
    - name: "gobenchdata publish: ${{ inputs.publish }}"
      run: go run go.bobheadxi.dev/gobenchdata@v1 action
      env:
        GITHUB_TOKEN: ${{ secrets.WRITE_TOKEN }}
        INPUT_PRUNE_COUNT: 30
        INPUT_GO_TEST_FLAGS: ${{ inputs.test-flags }}
        INPUT_PUBLISH: ${{ inputs.publish }}
        INPUT_PUBLISH_REPO: ajnavarro/gno-benchmarks
        INPUT_PUBLISH_BRANCH: gh-pages
        INPUT_BENCHMARKS_OUT: benchmarks.json
        INPUT_CHECKS: ${{ !inputs.publish }}
        INPUT_CHECKS_CONFIG: .benchmarks/gobenchdata-checks.yml

benchmark-check.yml that is running on every PR:

name: run benchmarks on every PR

on:
  pull_request:
jobs:
  check:
    uses: ./.github/workflows/benchmark.yml
    secrets: inherit
    with:
      publish: false
      test-flags: "-short -run=^$"

benchmark-publish.yml file that will run every day with main changes:

name: run benchmarks on main branch every day

on:
  workflow_dispatch:
  schedule:
    - cron:  '0 0 * * *' # run on default branch every day
jobs:
  publish:
    uses: ./.github/workflows/benchmark.yml
    secrets: inherit
    with:
      publish: true
      test-flags: "-short -run=^$" # TODO: remove short flag

I really appreciate any help you can provide. Thanks!

ajnavarro commented 1 year ago

Never mind, the problem was on the self-hosted node that was not cleaning its state. Thanks!