diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a83ef38 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: +- package-ecosystem: github-actions + directory: / + schedule: + interval: daily diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..9fa44ce --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,31 @@ +name: Release +on: + push: + tags: + - "v*" +env: + GO_VERSION: "1.17" +jobs: + release: + name: Release + runs-on: ubuntu-20.04 + steps: + - name: Install dependencies + run: | + sudo apt-get -y update + sudo apt-get -y install rpm + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Release + uses: goreleaser/goreleaser-action@v2 + with: + version: v1.0.0 + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..2a6d850 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,26 @@ +name: Test +on: + push: + branches: + - main + paths-ignore: + - '*.md' + - 'doc/**' + - 'LICENSE' + pull_request: +env: + GO_VERSION: "1.17" +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Run unit tests + run: make test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 382a383..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: go - -sudo: false -addons: - apt: - packages: - - ruby - - ruby-dev - - build-essential - - rpm - -go: - - "1.12.x" - -script: - - env GO111MODULE=on go mod vendor - - env GO111MODULE=on go build -install: true -deploy: -- provider: script - skip_cleanup: true - script: curl -sL https://git.io/goreleaser | bash - on: - tags: true - condition: $TRAVIS_OS_NAME = linux diff --git a/Makefile b/Makefile index 863f4e6..fb05b12 100644 --- a/Makefile +++ b/Makefile @@ -1,56 +1,17 @@ .PHONY: \ - all \ dep \ - depup \ - update \ build \ - install \ - lint \ vet \ - fmt \ - fmtcheck \ - clean \ - pretest \ test -VERSION := $(shell git describe --tags --abbrev=0) -SRCS = $(shell git ls-files '*.go') -PKGS = $(shell go list ./... | grep -v /vendor/) - -all: dep build test - dep: - go get -u github.com/golang/dep/... - dep ensure -vendor-only - -depup: - go get -u github.com/golang/dep/... - dep ensure -u + go mod download -build: main.go dep +build: main.go go build -o pet $< -install: main.go dep - go install - -lint: - @ go get -v github.com/golang/lint/golint - $(foreach file,$(SRCS),golint $(file) || exit;) +test: + go test ./... vet: - go vet $(PKGS) || exit; - -fmt: - gofmt -w $(SRCS) - -fmtcheck: - @ $(foreach file,$(SRCS),gofmt -s -l $(file);) - -clean: - go clean $(shell glide nv) - -pretest: vet fmtcheck - -test: pretest - go install - @ $(foreach pkg,$(PKGS), go test $(pkg) || exit;) + go vet \ No newline at end of file diff --git a/go.mod b/go.mod index 48a38e4..0f299c8 100644 --- a/go.mod +++ b/go.mod @@ -1,27 +1,36 @@ module github.com/knqyf263/pet +go 1.17 + require ( github.com/BurntSushi/toml v0.3.0 github.com/briandowns/spinner v0.0.0-20170614154858-48dbb65d7bd5 github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e github.com/fatih/color v1.7.0 - github.com/golang/protobuf v1.1.0 // indirect github.com/google/go-github v15.0.0+incompatible - github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jroimartin/gocui v0.4.0 - github.com/mattn/go-colorable v0.0.9 // indirect - github.com/mattn/go-isatty v0.0.3 // indirect github.com/mattn/go-runewidth v0.0.2 - github.com/nsf/termbox-go v0.0.0-20180509163535-21a4d435a862 // indirect github.com/pkg/errors v0.8.0 github.com/spf13/cobra v0.0.3 - github.com/spf13/pflag v1.0.1 // indirect github.com/xanzy/go-gitlab v0.10.5 golang.org/x/crypto v0.0.0-20180608092829-8ac0e0d97ce4 - golang.org/x/net v0.0.0-20180530234432-1e491301e022 // indirect golang.org/x/oauth2 v0.0.0-20180603041954-1e0a3fa8ba9a + gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61 +) + +require ( + github.com/alessio/shellescape v1.4.1 // indirect + github.com/chzyer/logex v1.1.10 // indirect + github.com/chzyer/test v0.0.0-20210722231415-061457976a23 // indirect + github.com/golang/protobuf v1.1.0 // indirect + github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/mattn/go-colorable v0.0.9 // indirect + github.com/mattn/go-isatty v0.0.3 // indirect + github.com/nsf/termbox-go v0.0.0-20180509163535-21a4d435a862 // indirect + github.com/spf13/pflag v1.0.1 // indirect + golang.org/x/net v0.0.0-20180530234432-1e491301e022 // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 // indirect google.golang.org/appengine v1.0.0 // indirect - gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61 // indirect ) diff --git a/go.sum b/go.sum index dbfed4f..e7992b7 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,15 @@ github.com/BurntSushi/toml v0.3.0 h1:e1/Ivsx3Z0FVTV0NSOv/aVgbUWyQuzj7DDnFblkRvsY= github.com/BurntSushi/toml v0.3.0/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= +github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= github.com/briandowns/spinner v0.0.0-20170614154858-48dbb65d7bd5 h1:osZyZB7J4kE1tKLeaUjV6+uZVBfS835T0I/RxmwWw1w= github.com/briandowns/spinner v0.0.0-20170614154858-48dbb65d7bd5/go.mod h1:hw/JEQBIE+c/BLI4aKM8UU8v+ZqrD3h7HC27kKt8JQU= +github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20210722231415-061457976a23 h1:dZ0/VyGgQdVGAss6Ju0dt5P0QltE0SFY5Woh6hbIfiQ= +github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/golang/protobuf v1.1.0 h1:0iH4Ffd/meGoXqF2lSAhZHt8X+cPgkfn/cb6Cce5Vpc= @@ -38,8 +44,8 @@ golang.org/x/net v0.0.0-20180530234432-1e491301e022 h1:MVYFTUmVD3/+ERcvRRI+P/C2+ golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/oauth2 v0.0.0-20180603041954-1e0a3fa8ba9a h1:1Fy38jwe/QZhQfFQBy6dMj9F/WU1C+jo3/zLNr/WhW4= golang.org/x/oauth2 v0.0.0-20180603041954-1e0a3fa8ba9a/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sys v0.0.0-20180606202747-9527bec2660b h1:5rOiLYVqtE+JehJPVJTXQJaP8aT3cpJC1Iy22+5WLFU= -golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= google.golang.org/appengine v1.0.0 h1:dN4LljjBKVChsv0XCSI+zbyzdqrkEwX5LQFUMRSGqOc= diff --git a/sync/gist.go b/sync/gist.go index 3e751e9..359b0c0 100644 --- a/sync/gist.go +++ b/sync/gist.go @@ -12,6 +12,7 @@ import ( "github.com/pkg/errors" "golang.org/x/oauth2" ) + const ( githubTokenEnvVariable = "PET_GITHUB_ACCESS_TOKEN" )