From b5cff524278a1e61aa734717596c70bb459016dd Mon Sep 17 00:00:00 2001 From: Daisuke Fujimura Date: Sun, 24 Mar 2024 23:41:43 +0900 Subject: [PATCH 1/5] Fix job name --- .github/workflows/benchmark.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index a414278..c3efad3 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -1,7 +1,7 @@ on: [push] name: benchmark jobs: - test: + benchmark: name: Run benchmark on GHC ${{ matrix.ghc }} runs-on: ubuntu-latest strategy: From d10fdca14e2fd6b84a272928096b733ce16fd0a5 Mon Sep 17 00:00:00 2001 From: Daisuke Fujimura Date: Sun, 24 Mar 2024 23:42:18 +0900 Subject: [PATCH 2/5] wip --- .github/workflows/benchmark.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index c3efad3..309e25a 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -1,4 +1,4 @@ -on: [push] +on: [push, pull_request] name: benchmark jobs: benchmark: @@ -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_name == '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.issue.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 From 059d616c3ce4bd99573c83444691538721c9f7c7 Mon Sep 17 00:00:00 2001 From: Daisuke Fujimura Date: Sun, 24 Mar 2024 23:44:06 +0900 Subject: [PATCH 3/5] TEST --- benchmark/Main.hs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/benchmark/Main.hs b/benchmark/Main.hs index 221f983..f95522f 100644 --- a/benchmark/Main.hs +++ b/benchmark/Main.hs @@ -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 () From 06c114069714931545060e9a0c869f1ab64949fa Mon Sep 17 00:00:00 2001 From: Daisuke Fujimura Date: Sun, 24 Mar 2024 23:45:09 +0900 Subject: [PATCH 4/5] wip --- .github/workflows/benchmark.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 309e25a..4452757 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -1,4 +1,4 @@ -on: [push, pull_request] +on: [push] name: benchmark jobs: benchmark: @@ -24,7 +24,7 @@ jobs: name: benchmark-results path: hs-git-gsub-benchmark-${{ github.sha }}.html - name: Post Benchmark Results as PR Comment - if: github.event_name == 'pull_request' + 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.issue.number }}/comments" From 343561dae560403774d046e420bbafcf8b8b5150 Mon Sep 17 00:00:00 2001 From: Daisuke Fujimura Date: Sun, 24 Mar 2024 23:51:28 +0900 Subject: [PATCH 5/5] wip --- .github/workflows/benchmark.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 4452757..b1383b6 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -27,5 +27,5 @@ jobs: 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.issue.number }}/comments" + 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