Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment benchmark result to Pull Request #9

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on: [push]
name: benchmark
jobs:
test:
benchmark:
name: Run benchmark on GHC ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
Expand All @@ -17,9 +17,15 @@ jobs:
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- run: cabal bench --benchmark-options="--output hs-git-gsub-benchmark-${{ github.sha }}.html"
- run: cabal bench -v0 --benchmark-options="--output hs-git-gsub-benchmark-${{ github.sha }}.html" >> benchmark-results.txt
- name: Upload Benchmark Results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: hs-git-gsub-benchmark-${{ github.sha }}.html
- name: Post Benchmark Results as PR Comment
if: ${{ github.event.issue.pull_request }}
run: |
COMMENT_BODY="## Benchmark Results on ${{ github.sha }}\n\`\`\`\n$(cat benchmark-results.txt)\n\`\`\`"
POST_URL="https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" -X POST --data "{\"body\": \"$COMMENT_BODY\"}" $POST_URL
4 changes: 0 additions & 4 deletions benchmark/Main.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import qualified Cli
import Criterion.Main
import System.Directory
import System.Process

benchmark1 :: IO ()
benchmark1 = do
withCurrentDirectory "benchmark/git" $ do
Cli.run ["git", "svn"]
(exitcode, _, _) <- readProcessWithExitCode "git" ["reset", "--hard"] []
return ()

main :: IO ()
Expand Down
Loading