Skip to content

Commit

Permalink
Merge pull request #64 from huangnauh/master
Browse files Browse the repository at this point in the history
add lint and action
  • Loading branch information
huangnauh authored Jan 6, 2021
2 parents dc19296 + bc739a6 commit 193c847
Show file tree
Hide file tree
Showing 14 changed files with 172 additions and 23 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: build
on: [push, pull_request]

jobs:
build:
strategy:
matrix:
go-version: [~1.12, ^1]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
GO111MODULE: "on"
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v2

- name: Download Go modules
run: go mod download

- name: Build
run: go build -v .
27 changes: 27 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: goreleaser

on:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: lint
on:
push:
pull_request:

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.31
# Optional: golangci-lint command line arguments.
args: --issues-exit-code=0
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.*
upx
*.swo
*.swp
*.swn
upx-*
release
release
dist
29 changes: 29 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
run:
tests: false

issues:
max-issues-per-linter: 0
max-same-issues: 0

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- depguard
- dogsled
- dupl
- gochecknoinits
- gocyclo
- gofmt
- goimports
- goprintffuncname
- govet
- interfacer
- misspell
- nolintlint
- scopelint
- typecheck
- unconvert
- unparam
- whitespace
47 changes: 47 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
env:
- GO111MODULE=on
before:
hooks:
- go mod download
builds:
- id: "upx"
env:
- CGO_ENABLED=0
binary: upx
flags:
- -trimpath
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
- 386
- arm
goarm:
- 6
- 7

archives:
- id: default
builds:
- upx
format_overrides:
- goos: windows
format: zip
replacements:
windows: Windows
darwin: Darwin
386: i386
amd64: x86_64
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
21 changes: 8 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ifndef VER
VER= 'latest'
VER= latest
endif

APP= upx
Expand All @@ -14,23 +14,18 @@ test:
go test -v .

release:
rm -rf release
for OS in linux windows darwin; do \
for ARCH in amd64 386; do \
GOOS=$$OS GOARCH=$$ARCH go build -o release/upx-$$OS-$$ARCH-$(VER) .; \
done \
done
tar -zcf release/upx-$(VER).tar.gz release/*
goreleaser --rm-dist

upload: release
./upx pwd
for OS in linux darwin; do \
for ARCH in amd64 386; do \
./upx put release/upx-$$OS-$$ARCH-$(VER) /softwares/upx/; \
done \
./upx put dist/upx_darwin_amd64/upx /softwares/upx/upx_darwin_amd64_$(VER); \

for ARCH in amd64 386 arm64 arm_6 arm_7; do \
./upx put dist/upx_linux_$$ARCH/upx /softwares/upx/upx_linux_$$ARCH_$(VER); \
done

for ARCH in amd64 386; do \
./upx put release/upx-windows-$$ARCH-$(VER) /softwares/upx/upx-windows-$$ARCH-$(VER).exe; \
./upx put dist/upx_windows_$$ARCH/upx.exe /softwares/upx/upx_windows_$$ARCH_$(VER).exe; \
done

.PHONY: app test release upload
3 changes: 2 additions & 1 deletion db.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package main

import (
"encoding/json"
"github.com/syndtr/goleveldb/leveldb"
"io/ioutil"
"os"
"path"
"path/filepath"
"runtime"

"github.com/syndtr/goleveldb/leveldb"
)

var db *leveldb.DB
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
github.com/syndtr/goleveldb v1.0.0
github.com/upyun/go-sdk/v3 v3.0.0
github.com/upyun/go-sdk/v3 v3.0.1
github.com/urfave/cli v1.22.4
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5I
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/upyun/go-sdk/v3 v3.0.0 h1:AXmeuTWJp3oZUjXX/45RssJTndcxAbvGZqtsgKxuMIM=
github.com/upyun/go-sdk/v3 v3.0.0/go.mod h1:P/SnuuwhrIgAVRd/ZpzDWqCsBAf/oHg7UggbAxyZa0E=
github.com/upyun/go-sdk/v3 v3.0.1 h1:5F260VBi9bhrLkxdR/AyXayZQ9mGKkzrQ21t5F3/Jc4=
github.com/upyun/go-sdk/v3 v3.0.1/go.mod h1:P/SnuuwhrIgAVRd/ZpzDWqCsBAf/oHg7UggbAxyZa0E=
github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA=
github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
3 changes: 2 additions & 1 deletion match.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"github.com/upyun/go-sdk/v3/upyun"
"path/filepath"
"time"

"github.com/upyun/go-sdk/v3/upyun"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion progress.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package main

import (
"github.com/gosuri/uiprogress"
"time"

"github.com/gosuri/uiprogress"
)

var progress *uiprogress.Progress
Expand Down
1 change: 0 additions & 1 deletion session.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,6 @@ func (sess *Session) tree(upPath, prefix string, output chan string) (folders, f
ObjectsChan: upInfos,
})
wg.Wait()

return
}

Expand Down
3 changes: 2 additions & 1 deletion upx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package main

import (
"fmt"
"github.com/urfave/cli"
"os"
"runtime"
"time"

"github.com/urfave/cli"
)

const VERSION = "v0.3.1"
Expand Down

0 comments on commit 193c847

Please sign in to comment.