summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md17
-rw-r--r--.github/workflows/prerelease.yml9
-rw-r--r--.github/workflows/release.yml31
-rw-r--r--CHANGELOG.md2
-rw-r--r--README.md55
-rw-r--r--cmd/gotop/main.go29
-rw-r--r--config.go2
-rw-r--r--devices/cpu.go2
-rw-r--r--devices/cpu_cpu.go6
-rw-r--r--docs/releasing.md50
10 files changed, 150 insertions, 53 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 6c1ca65..527ab69 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -6,12 +6,15 @@ about: Template to report bugs.
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Also please test using the latest build to make sure your issue has not already been fixed. -->
-Required information:
-
-- gotop version (`gotop -V`):
-- The output of `uname -a`:
-- Terminal emulator (e.g. iTerm or gnome terminal):
-- Any relevenat hardware info:
-- tmux version if using tmux:
+##### gotop version:
+`gotop -V`, or if built from source, `git rev-parse HEAD`
+##### OS/Arch:
+Linux: `uname -or`, OSX: `sw_vers`; Windows: `systeminfo | findstr /B /C:"OS Name" /C:"OS Version"`
+##### Terminal emulator:
+e.g. iTerm, kitty, xterm, PowerShell
+##### Any relevant hardware info:
+If the issue is clearly related to a specific piece of hardware, e.g., the network
+##### tmux version:
+`tmux -V`, if using tmux
Also please copy or attach `~/.local/state/gotop/errors.log` if it exists and contains logs:
diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml
index e060746..86cb1d6 100644
--- a/.github/workflows/prerelease.yml
+++ b/.github/workflows/prerelease.yml
@@ -1,4 +1,4 @@
-name: Build Go binaries
+name: Create pre-release
on:
push:
@@ -20,11 +20,16 @@ jobs:
env:
COMPRESS_FILES: true
+ - name: Get tag name
+ shell: bash
+ run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF##*/})"
+ id: tag_name
+
- name: Pre-release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
- automatic_release_tag: "${{ GITHUB_REF }}"
+ automatic_release_tag: "${{ steps.tag_name.outputs.tag }}"
draft: true
title: "Release candidate"
files: |
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..6390f46
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,31 @@
+name: Post release triggers
+
+on:
+ release:
+ types: [published]
+
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Get tag name
+ shell: bash
+ run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF##*/})"
+ id: tag_name
+
+ - name: Update Homebrew recipe
+ uses: peter-evans/repository-dispatch@v1
+ with:
+ token: ${{ secrets.REPO_ACCESS_TOKEN }}
+ repository: xxxserxxx/homebrew-gotop
+ event-type: my-release
+ client-payload: '{"tag": "${{ steps.tag_name.outputs.tag }}"}'
+
+ - name: Update Arch AURs
+ uses: peter-evans/repository-dispatch@v1
+ with:
+ token: ${{ secrets.REPO_ACCESS_TOKEN }}
+ repository: xxxserxxx/gotop-linux
+ event-type: my-release
+ client-payload: '{"tag": "${{ steps.tag_name.outputs.tag }}"}'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b5b7380..a489c8f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
> - **Fixed**: for any bug fixes.
> - **Security**: in case of vulnerabilities.
-## [3.4.4] - ??
+## [3.4.5] - ??
### Added
diff --git a/README.md b/README.md
index 9cd91ea..432188b 100644
--- a/README.md
+++ b/README.md
@@ -16,29 +16,56 @@ The original author of gotop has re-implemented the application in Rust, as [yto
## Installation
-Working and tested on Linux, FreeBSD and macOS. Windows support is planned. OpenBSD works with some caveats.
+![](https://github.com/xxxserxxx/gotop/workflows/Build%20Go%20binaries/badge.svg)
+![](https://github.com/xxxserxxx/gotop/workflows/Create%20pre-release/badge.svg)
-### Source
+Working and tested on Linux, FreeBSD and MacOS. Windows binaries are provided, but have limited testing. OpenBSD works with some caveats; cross-compiling is difficult and binaries are not provided.
+
+### Arch
+
+AUR contains entries for `gotop` and `gotop-bin`. `gotop-git` still points at the old, unmaintained, repository for the moment.
+
+```
+yay -S gotop-bin
+```
+
+### OSX
+
+gotop can be installed with [Homebrew](https://brew.sh/); you'll need to tap the recipe. If you'd previously tapped cjbassi's recipe, you'll want to untap that first. The old version of gotop is also included in Homebrew's core library, and that will always be chosen before any taps, so you have to specify the tap specifically.
-```bash
-go get github.com/xxxserxxx/gotop/cmd/gotop
+```
+brew uninstall gotop # If previously installed
+brew untap cjbassi/gotop # If previously tapped
+brew tap xxxserxxx/gotop
+brew install xxxserxxx/gotop
```
### Prebuilt binaries
-**Note**: Doesn't require Go.
+This doesn't require Go, is easy, and works across distributions. You have to manually upgrade the executable yourself, though, so using your distribution's package (if one is available) is a better approach.
+
+Visit [the releases page](https://github.com/xxxserxxx/gotop/releases) with your web browser and download the appropriate file for your OS. Unzip it (the archive contains a single file) and then move the resulting `gotop` binary into your `$PATH` somewhere. If you're on a Debian or Redhat derivative, you can download an `.rpm` or `.deb` and install that.
-Visit [here](https://github.com/xxxserxxx/gotop/releases) with your web browser and download a version that works for you.
+### Source
-Unzip it and then move `gotop` into your `$PATH` somewhere. If you're on a Debian or Redhat derivative, you can download an `.rpm` or `.deb` to install.
+This requires Go, and at the moment, Go 1.14 specifically.
+
+```bash
+go get -u github.com/xxxserxxx/gotop/cmd/gotop
+```
### Building
-The easiest way is to
+This is the download & compile approach.
+
```
-go get github.com/xxxserxxx/gotop/cmd/gotop
+git clone https://github.com/xxxserxxx/gotop.git
+cd gotop
+go build -o gotop ./cmd/gotop
```
+Move `gotop` to somewhere in your `$PATH`.
+
To create the cross-compile builds, there's a `make.sh` script; it has a lot of dependencies and has only been tested on my computer. When it works, it creates archives for numerous OSes & architectures. There's no testing for whether dependencies are available; it assumes they are and will fail in strange ways when they aren't.
- bash
@@ -49,6 +76,10 @@ To create the cross-compile builds, there's a `make.sh` script; it has a lot of
It is *just* smart enough to not rebuild things when it doesn't have to, and it tries to keep the darwin docker container around so it's not building from scratch every time. There are no guarantees.
+#### Note
+
+`make.sh` will probably go away soon as the project has shifted to using the github workflow engine to do builds.
+
## Usage
### Keybinds
@@ -185,8 +216,10 @@ Interfaces can also be ignored using `!`
#### "-l battery"
<img src="./assets/screenshots/battery.png" />
+
#### "-l minimal"
<img src="./assets/screenshots/minimal.png" />
+
#### Custom (layouts/procs)
<img src="./assets/screenshots/procs.png" />
@@ -198,3 +231,7 @@ Interfaces can also be ignored using `!`
- [shirou/gopsutil](https://github.com/shirou/gopsutil)
- [goreleaser/nfpm](https://github.com/goreleaser/nfpm)
- [distatus/battery](https://github.com/distatus/battery)
+
+## Stargazers over time
+
+[![Stargazers over time](https://starcharts.herokuapp.com/xxxserxxx/gotop.svg)](https://starcharts.herokuapp.com/xxxserxxx/gotop)
diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go
index 6afdf87..f6b6dfc 100644
--- a/cmd/gotop/main.go
+++ b/cmd/gotop/main.go
@@ -28,7 +28,6 @@ import (
const (
appName = "gotop"
- version = "3.4.4"
graphHorizontalScaleDelta = 3
defaultUI = "cpu\ndisk/1 2:mem/2\ntemp\nnet procs"
@@ -38,6 +37,8 @@ const (
)
var (
+ // TODO: Set this at compile time; having to check this in sucks.
+ Version = "3.4.5"
conf gotop.Config
help *w.HelpMenu
bar *w.StatusBar
@@ -49,7 +50,7 @@ var (
// TODO: state:merge #135 linux console font (cmatsuoka/console-font)
// TODO: state:deferred 157 FreeBSD fixes & Nvidia GPU support (kraust/master). Significant CPU use impact for NVidia changes.
// TODO: Virtual devices from Prometeus metrics @feature
-// TODO: state:merge #167 configuration file (jrswab/configFile111)
+// TODO: Abstract out the UI toolkit. mum4k/termdash, VladimirMarkelov/clui, gcla/gowid, rivo/tview, marcusolsson/tui-go might work better for some OS/Archs. Performance/memory use comparison would be interesting.
func parseArgs(conf *gotop.Config) error {
usage := `
Usage: gotop [options]
@@ -70,6 +71,7 @@ Options:
-i, --interface=NAME Select network interface [default: all]. Several interfaces can be defined using comma separated values. Interfaces can also be ignored using !
-x, --export=PORT Enable metrics for export on the specified port.
-X, --extensions=NAMES Enables the listed extensions. This is a comma-separated list without the .so suffix. The current and config directories will be searched.
+ --test Runs tests and exits with success/failure code
Built-in layouts:
@@ -94,7 +96,7 @@ Colorschemes:
return err
}
- args, err := docopt.ParseArgs(usage, os.Args[1:], version)
+ args, err := docopt.ParseArgs(usage, os.Args[1:], Version)
if err != nil {
return err
}
@@ -152,6 +154,9 @@ Colorschemes:
exs, _ := args["--extensions"].(string)
conf.Extensions = strings.Split(exs, ",")
}
+ if val, _ := args["--test"]; val != nil {
+ conf.Test = val.(bool)
+ }
return nil
}
@@ -385,6 +390,15 @@ func main() {
}
defer logfile.Close()
+ lstream := getLayout(conf)
+ ly := layout.ParseLayout(lstream)
+
+ loadExtensions(conf)
+
+ if conf.Test {
+ os.Exit(runTests(conf))
+ }
+
if err := ui.Init(); err != nil {
stderrLogger.Fatalf("failed to initialize termui: %v", err)
}
@@ -396,10 +410,6 @@ func main() {
bar = w.NewStatusBar()
}
- loadExtensions(conf)
-
- lstream := getLayout(conf)
- ly := layout.ParseLayout(lstream)
grid, err := layout.Layout(ly, conf)
if err != nil {
stderrLogger.Fatalf("failed to initialize termui: %v", err)
@@ -496,3 +506,8 @@ func loadExtensions(conf gotop.Config) {
os.Exit(1)
}
}
+
+func runTests(conf gotop.Config) int {
+ fmt.Printf("PASS")
+ return 0
+}
diff --git a/config.go b/config.go
index 272a376..d072dee 100644
--- a/config.go
+++ b/config.go
@@ -32,6 +32,8 @@ type Config struct {
MaxLogSize int64
ExportPort string
Extensions []string
+
+ Test bool
}
func Parse(in io.Reader, conf *Config) error {
diff --git a/devices/cpu.go b/devices/cpu.go
index 436ccb1..1d8d23d 100644
--- a/devices/cpu.go
+++ b/devices/cpu.go
@@ -1,5 +1,7 @@
package devices
+// TODO: https://github.com/elastic/go-sysinfo
+
import (
"log"
"time"
diff --git a/devices/cpu_cpu.go b/devices/cpu_cpu.go
index a1d20cd..42eff2e 100644
--- a/devices/cpu_cpu.go
+++ b/devices/cpu_cpu.go
@@ -23,7 +23,11 @@ func init() {
}
for i := 0; i < len(vals); i++ {
key := fmt.Sprintf(formatString, i)
- cpus[key] = int(vals[i])
+ v := vals[i]
+ if v > 100 {
+ v = 100
+ }
+ cpus[key] = int(v)
}
return nil
}
diff --git a/docs/releasing.md b/docs/releasing.md
index 540c950..d77b6dd 100644
--- a/docs/releasing.md
+++ b/docs/releasing.md
@@ -5,33 +5,31 @@ Current steps for a release:
2. Update CHANGELOG.md
3. Tag
4. Push everything
-5. ./make.sh
-6. Create github release
+5. When the github workflows complete, finish the draft release and publish.
+6. After the [Homebrew](https://github.com/xxxserxxx/homebrew-gotop) and [AUR](https://github.com/xxxserxxx/gotop-linux] projects are done, check out gotop-linux and run `aurpublish aur` and `aurpublish aur-bin`
+
+
+Homebrew is automatically updated. The AUR project still needs secret
+credentials to aurpublish to the AUR repository, so the final publish step is
+still currently manual.
+
+Oh, what a tangled web.
-### Homebrew
-1. Change homebrew-gotop
-```
-curl --output - -L https://github.com/xxxserxxx/gotop/releases/download/v3.3.2/gotop_3.3.2_linux_amd64.tgz | sha256sum
-curl --output - -L https://github.com/xxxserxxx/gotop/releases/download/v3.3.2/gotop_3.3.2_darwin_amd64.tgz | sha256sum
-```
-### AUR
-1. Update aur/PKGBUILD
-2. namcap PKGBUILD
-3. makepkg
-4. makepkg -g
-5. makepkg --printsrcinfo \> .SRCINFO
-6. Commit everything
-7. push
+Nix adds new and interesting complexities to the release.
+
+1. cd to the nixpkgs directory
+2. docker run -it --rm --mount type=bind,source="\$(pwd)",target=/mnt nixos/nix sh
+3. cd /mnt
+4. nix-prefetch-url --unpack https://github.com/xxxserxxx/gotop/archive/v3.3.2.tar.gz
+5. Copy the sha256
+6. Update the version and hash in nixpkgs/pkgs/tools/system/gotop/default.nix
+8. In docker, install & run vgo2nix to update deps.nix
+7. nix-build -A gotop
+
+
+For plugin development:
```
-curl -L https://github.com/xxxserxxx/gotop/archive/v3.3.2.tar.gz | sha256sum
+V=$(git show -s --format=%cI HEAD | cut -b -19 | tr -cd '[:digit:]')-$(git rev-parse HEAD | cut -b -12)
+go build -ldflags "-X main.Version=$V" -o gotop ./cmd/gotop
```
-
-### AUR-BIN
-1. Update aur-bin/PKGBUILD
-2. namcap PKGBUILD
-3. makepkg
-4. makepkg -g
-5. makepkg --printsrcinfo \> .SRCINFO
-6. Commit everything
-7. push aur-bin