From d51a928592ff4414e68e37656dcc9c7042502d8b Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Wed, 1 May 2024 08:32:57 +0000 Subject: [PATCH] update --- .github/workflows/go.yaml | 20 ++++++ .github/workflows/release.yaml | 109 +++++++++++++++++++++++++++++++++ README.md | 8 +++ backtrace_install.sh | 13 ++++ 4 files changed, 150 insertions(+) create mode 100644 .github/workflows/go.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 backtrace_install.sh diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml new file mode 100644 index 0000000..b8ad002 --- /dev/null +++ b/.github/workflows/go.yaml @@ -0,0 +1,20 @@ +name: Go + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 'stable' + - name: Build + run: go build -v ./... + - name: Test + run: go test -v ./... \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..c47bed9 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,109 @@ +name: Release + +on: + release: + types: [published] + +jobs: + releases-matrix: + name: Release Go Binary + runs-on: ubuntu-latest + strategy: + matrix: + # Include amd64 on all platforms. + goos: [windows, freebsd, openbsd, linux, dragonfly, darwin] + goarch: [amd64, 386] + exclude: + # Exclude i386 on darwin and dragonfly. + - goarch: 386 + goos: dragonfly + - goarch: 386 + goos: darwin + include: + # BEIGIN MacOS ARM64 + - goos: darwin + goarch: arm64 + # END macOS ARM64 + # BEGIN Linux ARM 5 6 7 + - goos: linux + goarch: arm + goarm: 7 + - goos: linux + goarch: arm + goarm: 6 + - goos: linux + goarch: arm + goarm: 5 + # END Linux ARM 5 6 7 + # BEGIN Android ARM 8 + - goos: android + goarch: arm64 + # END Android ARM 8 + # Windows ARM + - goos: windows + goarch: arm64 + - goos: windows + goarch: arm + goarm: 7 + # BEGIN Other architectures + # BEGIN riscv64 & ARM64 + - goos: linux + goarch: arm64 + - goos: linux + goarch: riscv64 + # END riscv64 & ARM64 + # BEGIN MIPS + - goos: linux + goarch: mips64 + - goos: linux + goarch: mips64le + - goos: linux + goarch: mipsle + - goos: linux + goarch: mips + - goos: linux + goarch: mipsle + gomips: softfloat + - goos: linux + goarch: mips + gomips: softfloat + # END MIPS + # BEGIN PPC + - goos: linux + goarch: ppc64 + - goos: linux + goarch: ppc64le + # END PPC + # BEGIN FreeBSD ARM + - goos: freebsd + goarch: arm64 + - goos: freebsd + goarch: arm + goarm: 7 + # END FreeBSD ARM + # BEGIN S390X + - goos: linux + goarch: s390x + # END S390X + # END Other architectures + # BEGIN OPENBSD ARM + - goos: openbsd + goarch: arm64 + - goos: openbsd + goarch: arm + goarm: 7 + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + GOARM: ${{ matrix.goarm }} + GOMIPS: ${{ matrix.gomips }} + CGO_ENABLED: 0 + steps: + - uses: actions/checkout@v3 + - uses: wangyoucao577/go-release-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + asset_name: backtrace-${{ matrix.goos }}-${{ matrix.goarch }} + ldflags: -s -w \ No newline at end of file diff --git a/README.md b/README.md index d473585..3884962 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,11 @@ [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2Fbacktrace&count_bg=%2323E01C&title_bg=%23555555&icon=sonarcloud.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com) 基于 https://github.com/zhanghanyun/backtrace 的重构和优化版本 + +## 使用 + +终端下运行 + +```shell +curl https://raw.githubusercontent.com/oneclickvirt/backtrace/main/backtrace_install.sh -sSf | sh +``` diff --git a/backtrace_install.sh b/backtrace_install.sh new file mode 100644 index 0000000..f30474e --- /dev/null +++ b/backtrace_install.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +arch=$(uname -m) +if [ "$arch" = "x86_64" ]; then + wget -q -O backtrace.tar.gz https://github.com/oneclickvirt/backtrace/releases/latest/download/backtrace-linux-amd64.tar.gz +else + wget -q -O backtrace.tar.gz https://github.com/oneclickvirt/backtrace/releases/latest/download/backtrace-linux-arm64.tar.gz +fi + +tar -xf backtrace.tar.gz +rm backtrace.tar.gz +mv backtrace /usr/bin/ +backtrace \ No newline at end of file