diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0c53bbb..47bb19a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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: diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 90fe7a5..2ce76f9 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -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 @@ -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 diff --git a/README.md b/README.md index 78922e9..d7debdd 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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``` @@ -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 ``` diff --git a/cmd/main.go b/cmd/main.go index f27788b..47e1311 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -7,15 +7,15 @@ 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)") @@ -23,7 +23,7 @@ func main() { 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 @@ -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) diff --git a/cputest/cputest.go b/cpu/cputest.go similarity index 99% rename from cputest/cputest.go rename to cpu/cputest.go index 70a8456..ed3bd91 100644 --- a/cputest/cputest.go +++ b/cpu/cputest.go @@ -1,4 +1,4 @@ -package cputest +package cpu import ( "bufio" diff --git a/cpu/version.go b/cpu/version.go new file mode 100644 index 0000000..39175dd --- /dev/null +++ b/cpu/version.go @@ -0,0 +1,3 @@ +package cpu + +const CpuTestVersion = "v0.0.2" // git tag v0.0.2 diff --git a/cputest/version.go b/cputest/version.go deleted file mode 100644 index 6286966..0000000 --- a/cputest/version.go +++ /dev/null @@ -1,3 +0,0 @@ -package cputest - -const CpuTestVersion = "v0.0.1" // git tag v0.0.1 diff --git a/go.mod b/go.mod index c1f2333..7fcce24 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/oneclickvirt/cpuTest +module github.com/oneclickvirt/cputest go 1.22.4