-
Notifications
You must be signed in to change notification settings - Fork 93
feat: some optimize #622
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
feat: some optimize #622
Changes from 31 commits
fa775ee
ba1b77f
80b43ec
c671bd1
cd7a67c
a04d408
eb4ca10
c476440
94c7b45
116db2d
7dfe6db
a82d4ac
071e83a
422a8b4
55325f0
14a8bab
8835015
839d37f
7f83a71
eda3634
830e51a
d4f2274
43d37f3
9143806
14c2f31
bf97aec
f5f0af1
629010c
1e66167
bc59486
cce4247
70a2f36
c412ee9
b47dbfa
021515c
ca34907
4eb0170
c506389
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Em, if we can‘t check the result, what's the meaning of it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Move the test cases previously used for concurrency testing to the benchmark. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Benchmark | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- "**/*.md" | ||
pull_request: | ||
paths-ignore: | ||
- "**/*.md" | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
deployments: write | ||
jobs: | ||
benchmark: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # to be able to retrieve the last commit | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "stable" | ||
- name: Run Benchmark | ||
run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt | ||
# NOTE: Benchmarks could change with different CPU types | ||
- name: Get GitHub Runner System Information | ||
uses: kenchan0130/[email protected] | ||
id: system-info | ||
- name: Get master branch SHA | ||
id: get-master-branch-sha | ||
run: | | ||
devhaozi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
SHA="$(git rev-parse origin/master)" | ||
echo "sha=$SHA" >> $GITHUB_OUTPUT | ||
- name: Get Benchmark Results from master branch | ||
id: cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./cache | ||
key: ${{ steps.get-master-branch-sha.outputs.sha }}-${{ runner.os }}-${{ steps.system-info.outputs.cpu-model }}-benchmark | ||
# This will only run if we have Benchmark Results from master branch | ||
- name: Compare PR Benchmark Results with master branch | ||
uses: benchmark-action/[email protected] | ||
if: steps.cache.outputs.cache-hit == 'true' | ||
with: | ||
tool: 'go' | ||
output-file-path: output.txt | ||
external-data-json-path: ./cache/benchmark-data.json | ||
# Do not save the data (This allows comparing benchmarks) | ||
save-data-file: false | ||
fail-on-alert: true | ||
# Comment on the PR if the branch is not a fork | ||
comment-on-alert: ${{ github.event.pull_request.head.repo.fork == false }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
summary-always: true | ||
alert-threshold: "150%" | ||
- name: Store Benchmark Results for master branch | ||
uses: benchmark-action/[email protected] | ||
if: ${{ github.ref_name == 'master' }} | ||
with: | ||
tool: 'go' | ||
output-file-path: output.txt | ||
external-data-json-path: ./cache/benchmark-data.json | ||
# Save the data to external file (cache) | ||
save-data-file: true | ||
fail-on-alert: false | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
summary-always: true | ||
alert-threshold: "150%" | ||
- name: Publish Benchmark Results to GitHub Pages | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
if: ${{ github.ref_name == 'master' }} | ||
with: | ||
tool: 'go' | ||
output-file-path: output.txt | ||
benchmark-data-dir-path: "benchmarks" | ||
fail-on-alert: false | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
comment-on-alert: true | ||
summary-always: true | ||
# Save the data to external file (GitHub Pages) | ||
save-data-file: true | ||
alert-threshold: "150%" | ||
auto-push: true | ||
- name: Update Benchmark Results cache | ||
uses: actions/cache/save@v4 | ||
if: ${{ github.ref_name == 'master' }} | ||
with: | ||
path: ./cache | ||
key: ${{ steps.get-master-branch-sha.outputs.sha }}-${{ runner.os }}-${{ steps.system-info.outputs.cpu-model }}-benchmark |
devhaozi marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Govulncheck | ||
on: | ||
schedule: | ||
- cron: "0 */6 * * *" # Run every 6 hours | ||
jobs: | ||
govulncheck: | ||
runs-on: ubuntu-latest | ||
env: | ||
GO111MODULE: on | ||
steps: | ||
- name: Fetch Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "stable" | ||
check-latest: true | ||
cache: false | ||
|
||
devhaozi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Install Govulncheck | ||
run: go install golang.org/x/vuln/cmd/govulncheck@latest | ||
|
||
- name: Run Govulncheck | ||
run: govulncheck ./... |
Uh oh!
There was an error while loading. Please reload this page.