Skip to content

Commit

Permalink
Add github tokens to download artifacts
Browse files Browse the repository at this point in the history
* remove rhysd/github-action-benchmark
* add benchmark job summary
* manually publish codacy coverage
  • Loading branch information
milkshakeuk committed Dec 20, 2023
1 parent fe37797 commit 5fb8ffa
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
22 changes: 9 additions & 13 deletions .github/workflows/build-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,16 @@ jobs:
id: coverage-paths
run: |
readarray -d '' coveragePathArray < <(find . -name "coverage.cobertura.xml" -print0)
coveragePaths=$(printf ",%s" "${coveragePathArray[@]}")
coveragePaths=$(printf -- "-r %s " "${coveragePathArray[@]}")
echo "COVERAGE_REPORT_PATHS=$coveragePaths" >> $GITHUB_OUTPUT
- name: Publish Code Coverage Results
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ${{ steps.coverage-paths.outputs.COVERAGE_REPORT_PATHS }}
run: |
auth="--project-token ${{ secrets.CODACY_PROJECT_TOKEN }}"
bash <(curl -Ls https://coverage.codacy.com/get.sh) report $auth \
${{ steps.coverage-paths.outputs.COVERAGE_REPORT_PATHS }} --partial &&\
bash <(curl -Ls https://coverage.codacy.com/get.sh) final $auth
report-benchmark-results:
needs: build-and-test
Expand All @@ -107,11 +109,5 @@ jobs:
with:
name: benchmark-results

- name: Report benchmark result
uses: rhysd/github-action-benchmark@v1
with:
name: Benchmark.Net Benchmark
tool: "benchmarkdotnet"
output-file-path: BenchmarkDotNet.Artifacts/results/NHapi.Benchmarks.LargeEmbeddedFileTest-report-full-compressed.json
auto-push: false
summary-always: true
- name: 'Report benchmark result'
run: cat ./NHapi.Benchmarks.LargeEmbeddedFileTest-report-github.md >> $GITHUB_STEP_SUMMARY
14 changes: 9 additions & 5 deletions .github/workflows/publish-pr-coverage-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ jobs:
uses: actions/download-artifact@v4
with:
name: coverage-reports
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- name: Set Coverage Report Paths
id: coverage-paths
run: |
readarray -d '' coveragePathArray < <(find . -name "coverage.cobertura.xml" -print0)
coveragePaths=$(printf ",%s" "${coveragePathArray[@]}")
coveragePaths=$(printf -- "-r %s " "${coveragePathArray[@]}")
echo "COVERAGE_REPORT_PATHS=$coveragePaths" >> $GITHUB_OUTPUT
- name: Publish Code Coverage Results
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ${{ steps.coverage-paths.outputs.COVERAGE_REPORT_PATHS }}
run: |
auth="--project-token ${{ secrets.CODACY_PROJECT_TOKEN }}"
bash <(curl -Ls https://coverage.codacy.com/get.sh) report $auth \
--commit-uuid ${{ github.event.workflow_run.head_sha }} \
${{ steps.coverage-paths.outputs.COVERAGE_REPORT_PATHS }} --partial &&\
bash <(curl -Ls https://coverage.codacy.com/get.sh) final $auth
1 change: 1 addition & 0 deletions .github/workflows/publish-pr-test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: unit-test-results
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- name: Publish Unit Test Results
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/report-benchmark-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@ jobs:
uses: actions/download-artifact@v4
with:
name: benchmark-results
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- name: Report benchmark result
uses: rhysd/github-action-benchmark@v1
with:
name: Benchmark.Net Benchmark
tool: "benchmarkdotnet"
output-file-path: BenchmarkDotNet.Artifacts/results/NHapi.Benchmarks.LargeEmbeddedFileTest-report-full-compressed.json
auto-push: false
summary-always: true
- name: 'Report benchmark result'
run: cat ./NHapi.Benchmarks.LargeEmbeddedFileTest-report-github.md >> $GITHUB_STEP_SUMMARY
1 change: 1 addition & 0 deletions tests/NHapi.Benchmarks/LargeEmbeddedFileTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

[MemoryDiagnoser]
[JsonExporterAttribute.FullCompressed]
[MarkdownExporterAttribute.GitHub]
[SimpleJob(RuntimeMoniker.Net462, baseline: true)]
[SimpleJob(RuntimeMoniker.Net60)]
[SimpleJob(RuntimeMoniker.Net80)]
Expand Down

0 comments on commit 5fb8ffa

Please sign in to comment.