Skip to content

Commit

Permalink
v0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS committed Jun 24, 2024
1 parent 894d53e commit 88d4241
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
TAG="v0.0.1-$(date +'%Y%m%d%H%M%S')"
TAG="v0.0.2-$(date +'%Y%m%d%H%M%S')"
git tag $TAG
git push origin $TAG
env:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
- name: Delete Existing Release Assets
run: |
release_id=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/oneclickvirt/cpuTest/releases/tags/output" | jq -r '.id')
release_id=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/oneclickvirt/cputest/releases/tags/output" | jq -r '.id')
echo "Deleting existing release assets..."
assets=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/oneclickvirt/cpuTest/releases/$release_id/assets" | jq -r '.[] | .id')
assets=$(curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/oneclickvirt/cputest/releases/$release_id/assets" | jq -r '.[] | .id')
for asset in $assets; do
echo "Deleting asset with ID: $asset"
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/oneclickvirt/cpuTest/releases/assets/$asset"
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/oneclickvirt/cputest/releases/assets/$asset"
done
sleep 60
Expand All @@ -55,18 +55,18 @@ jobs:
run: |
mkdir -p bin
cd cmd
CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ../bin/cpuTest-${{ matrix.goos }}-${{ matrix.goarch }} -v -ldflags="-extldflags=-static" .
CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ../bin/cputest-${{ matrix.goos }}-${{ matrix.goarch }} -v -ldflags="-extldflags=-static" .
- name: Upload New Assets
run: |
release_id=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/oneclickvirt/cpuTest/releases/tags/output" | jq -r '.id')
release_id=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/oneclickvirt/cputest/releases/tags/output" | jq -r '.id')
echo "Uploading new assets to release..."
for file in ./bin/*; do
echo "Uploading $file to release..."
curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"$file" \
"https://uploads.github.com/repos/oneclickvirt/cpuTest/releases/$release_id/assets?name=$(basename "$file")"
"https://uploads.github.com/repos/oneclickvirt/cputest/releases/$release_id/assets?name=$(basename "$file")"
rm -rf $file
done
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cpuTest
# cputest

[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2FcpuTest&count_bg=%2323E01C&title_bg=%23555555&icon=sonarcloud.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com) [![Build and Release](https://github.com/oneclickvirt/cpuTest/actions/workflows/main.yaml/badge.svg)](https://github.com/oneclickvirt/cpuTest/actions/workflows/main.yaml)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2Fcputest&count_bg=%2323E01C&title_bg=%23555555&icon=sonarcloud.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com) [![Build and Release](https://github.com/oneclickvirt/cputest/actions/workflows/main.yaml/badge.svg)](https://github.com/oneclickvirt/cputest/actions/workflows/main.yaml)

CPU测试模块 (CPU Test Module)

Expand Down Expand Up @@ -56,7 +56,7 @@ Swap: 0 0 0
如需使用```geekbench```请事先执行

```
curl -L https://raw.githubusercontent.com/oneclickvirt/cpuTest/main/dgb.sh -o dgb.sh && chmod +x dgb.sh
curl -L https://raw.githubusercontent.com/oneclickvirt/cputest/main/dgb.sh -o dgb.sh && chmod +x dgb.sh
```

然后使用```-v```指定需要后续使用的geekbench版本```gb4``````gb5``````gb6```
Expand All @@ -72,5 +72,5 @@ bash dgb.sh -v gb6
# 使用(Usage)

```
curl https://raw.githubusercontent.com/oneclickvirt/cpuTest/main/ct_install.sh -sSf | sh
curl https://raw.githubusercontent.com/oneclickvirt/cputest/main/ct_install.sh -sSf | sh
```
16 changes: 8 additions & 8 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import (
"runtime"
"strings"

"github.com/oneclickvirt/cpuTest/cputest"
"github.com/oneclickvirt/cputest/cpu"
. "github.com/oneclickvirt/defaultset"
)

func main() {
go func() {
http.Get("https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2FcpuTest&count_bg=%2323E01C&title_bg=%23555555&icon=sonarcloud.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false")
http.Get("https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2Fcputest&count_bg=%2323E01C&title_bg=%23555555&icon=sonarcloud.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false")
}()
fmt.Println(Green("项目地址:"), Yellow("https://github.com/oneclickvirt/cpuTest"))
fmt.Println(Green("项目地址:"), Yellow("https://github.com/oneclickvirt/cputest"))
var showVersion bool
flag.BoolVar(&showVersion, "v", false, "show version")
languagePtr := flag.String("l", "", "Language parameter (en or zh)")
testMethodPtr := flag.String("m", "", "Specific Test Method (sysbench or geekbench)")
testThreadsPtr := flag.String("t", "", "Specific Test Threads (single or multi)")
flag.Parse()
if showVersion {
fmt.Println(cputest.CpuTestVersion)
fmt.Println(cpu.CpuTestVersion)
return
}
var language, res, testMethod, testThread string
Expand All @@ -43,16 +43,16 @@ func main() {
testThread = strings.TrimSpace(strings.ToLower(*testThreadsPtr))
}
if runtime.GOOS == "windows" {
res = cputest.WinsatTest(language, testThread)
res = cpu.WinsatTest(language, testThread)
} else {
if testMethod == "sysbench" {
res = cputest.SysBenchTest(language, testThread)
res = cpu.SysBenchTest(language, testThread)
if res == "" {
res = "sysbench test failed, switch to use dd test.\n"
res += cputest.GeekBenchTest(language, testThread)
res += cpu.GeekBenchTest(language, testThread)
}
} else if testMethod == "geekbench" {
res = cputest.GeekBenchTest(language, testThread)
res = cpu.GeekBenchTest(language, testThread)
}
}
fmt.Printf(res)
Expand Down
2 changes: 1 addition & 1 deletion cputest/cputest.go → cpu/cputest.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cputest
package cpu

import (
"bufio"
Expand Down
3 changes: 3 additions & 0 deletions cpu/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package cpu

const CpuTestVersion = "v0.0.2" // git tag v0.0.2
3 changes: 0 additions & 3 deletions cputest/version.go

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/oneclickvirt/cpuTest
module github.com/oneclickvirt/cputest

go 1.22.4

Expand Down

0 comments on commit 88d4241

Please sign in to comment.