Add .travis.yml and reconfigure release process

- travis-ci used to publish binaries to the GitHub releases tab on new release
- Will also publish .deb and .rpm packages
- Haven't gotten the checksums file to work yet
- OSX x86 also isn't working
- No longer using goreleaser to publish binaries
    - didn't support cgo cross compilation which made things difficult
- Remove obsolete Makefile
This commit is contained in:
Caleb Bassi 2019-02-06 19:23:56 -08:00
parent 4ba6ee3cfe
commit 180ab4c804
8 changed files with 90 additions and 100 deletions

52
.travis.yml Normal file
View File

@ -0,0 +1,52 @@
language: go
go:
- 1.11.x
os:
- linux
- osx
git:
depth: 1
env:
global:
- NAME=gotop
install: true
script:
- ./ci/script.sh
matrix:
include:
# Linux
- env: _GOOS=linux _GOARCH=amd64
os: linux
- env: _GOOS=linux _GOARCH=386
os: linux
- env: _GOOS=linux _GOARCH=arm GOARM=5
os: linux
- env: _GOOS=linux _GOARCH=arm GOARM=6
os: linux
- env: _GOOS=linux _GOARCH=arm GOARM=7
os: linux
- env: _GOOS=linux _GOARCH=arm64
os: linux
# OSX
- env: _GOOS=darwin _GOARCH=amd64
os: osx
deploy:
provider: releases
api_key: $GITHUB_TOKEN
file_glob: true
file: "./dist/*"
skip_cleanup: true
on:
tags: true
notifications:
email:
on_success: never

View File

@ -1,32 +0,0 @@
VERSION=$(shell awk '/([0-9]{1}.?){3}/ {print $$4;}' main.go)
.PHONY: all
all: dist/gotop.rpm dist/gotop.deb
dist/gotop:
@GOOS=linux GOARCH=amd64 go build -o $@
dist:
@mkdir $@
dist/gotop.rpm: dist dist/gotop
@docker run --rm \
-v "$(PWD)/build:/tmp/build" \
-v "$(PWD)/dist:/tmp/dist" \
-e "VERSION=$(VERSION)" \
goreleaser/nfpm pkg \
--config /tmp/build/gotop-nfpm.yml \
--target /tmp/dist/gotop.rpm
dist/gotop.deb: dist dist/gotop
@docker run --rm \
-v "$(PWD)/build:/tmp/build" \
-v "$(PWD)/dist:/tmp/dist" \
-e "VERSION=$(VERSION)" \
goreleaser/nfpm pkg \
--config /tmp/build/gotop-nfpm.yml \
--target /tmp/dist/gotop.deb
.PHONY: clean
clean:
@-rm -rf dist

View File

@ -98,16 +98,6 @@ To make a custom colorscheme, check out the [template](./colorschemes/template.g
`-s`, `--statusbar` Show a statusbar with the time.
`-b`, `--battery` Show battery level widget (`minimal` turns off). [widget preview](./assets/battery.png)
## Building deb/rpms
To build dep/rpms using [nfpm](https://github.com/goreleaser/nfpm):
```bash
make all
```
This will place the built packages into the `dist` folder.
## Credits
- [mdnazmulhasan27771](https://github.com/mdnazmulhasan27771) for the [logo](./assets/logo.png)
@ -119,7 +109,7 @@ This will place the built packages into the `dist` folder.
- [nsf/termbox](https://github.com/nsf/termbox-go)
- [exrook/drawille-go](https://github.com/exrook/drawille-go)
- [shirou/gopsutil](https://github.com/shirou/gopsutil)
- [goreleaser/goreleaser](https://github.com/goreleaser/goreleaser)
- [goreleaser/nfpm](https://github.com/goreleaser/nfpm)
- [distatus/battery](https://github.com/distatus/battery)
## Stargazers over time

View File

@ -1,22 +0,0 @@
builds:
- binary: gotop
goos:
- linux
goarch:
- amd64
- 386
- arm
- arm64
goarm:
- 5
- 6
- 7
hooks:
post: ./build/build-darwin-cgo.sh
archive:
name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}{{ .Arm }}{{ end }}"
replacements:
arm64: arm8
format: tgz
files:
- none*

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
version=$(go run main.go -v)
xgo --targets="darwin/386,darwin/amd64" .
mv gotop-darwin-10.6-386 gotop
tar czf gotop_${version}_darwin_386.tgz gotop
rm -f gotop
mv gotop-darwin-10.6-amd64 gotop
tar czf gotop_${version}_darwin_amd64.tgz gotop
rm -f gotop

View File

@ -1,21 +0,0 @@
Dependencies:
- goreleaser: `go get github.com/goreleaser/goreleaser`
- xgo: `docker pull karalabe/xgo-latest; go get github.com/karalabe/xgo`
- dockerd
make sure gotop builds and runs
update version number in main.go
commit changes
tag commit with version number
push changes
export GitHub token in shell
make sure dockerd is running
run `goreleaser --rm-dist -f build/.goreleaser.yml`
update GitHub release with Darwin builds
update homebrew-gotop
version numbers (there's 3)
sha256 (run `sha256sum {archived file}`)
update gotop and gotop-bin AUR packages
reset pkgrel
version number
sha256sum

View File

@ -12,4 +12,4 @@ homepage: "https://github.com/cjbassi/gotop"
license: "GNU Affero General Public License v3.0"
bindir: "/usr/local/bin"
files:
/tmp/dist/gotop: "/usr/local/bin/gotop"
/tmp/pkg/gotop: "/usr/local/bin/gotop"

36
ci/script.sh Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
GOARCH=${_GOARCH}
GOOS=${_GOOS}
if [[ ! ${GOARCH} ]]; then
exit
fi
env GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -o ${NAME}
mkdir -p dist
if [[ ${GOARCH} == "arm64" ]]; then
FILE=${NAME}_${TRAVIS_BRANCH}_${GOOS}_arm8
else
FILE=${NAME}_${TRAVIS_BRANCH}_${GOOS}_${GOARCH}${GOARM}
fi
tar -czf dist/${FILE}.tgz ${NAME}
if [[ ${GOOS} == "linux" && ${GOARCH} == "amd64" ]]; then
VERSION=$(go run main.go -v) # used by nfpm
docker run --rm \
-v $PWD:/tmp/pkg \
-e VERSION=${VERSION} \
goreleaser/nfpm pkg \
--config /tmp/pkg/ci/nfpm.yml \
--target /tmp/pkg/dist/${FILE}.deb
docker run --rm \
-v $PWD:/tmp/pkg \
-e VERSION=${VERSION} \
goreleaser/nfpm pkg \
--config /tmp/pkg/ci/nfpm.yml \
--target /tmp/pkg/dist/${FILE}.rpm
fi