chore: add circle ci and remove travis
This commit is contained in:
parent
f255f1016d
commit
dac43d0669
@ -1,19 +1,63 @@
|
|||||||
version: 2
|
version: 2
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
linting:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/golang:1.9
|
- image: circleci/golang:1.9
|
||||||
|
|
||||||
working_directory: /go/src/github.com/filebrowser/filebrowser
|
working_directory: /go/src/github.com/filebrowser/filebrowser
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
command: |
|
command: |
|
||||||
|
cd cmd/filebrowser && go get ./... && cd ../..
|
||||||
go get github.com/alecthomas/gometalinter
|
go get github.com/alecthomas/gometalinter
|
||||||
/go/bin/gometalinter --install
|
gometalinter --install
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: Run linting
|
name: Run linting
|
||||||
command: gometalinter --disable-all -E gofmt -E misspell -E ineffassign -E goimports -E deadcode --exclude="rice-box.go" --tests ./...
|
command: |
|
||||||
|
gometalinter --exclude="rice-box.go" \
|
||||||
|
-D goconst \
|
||||||
|
-D gocyclo \
|
||||||
|
-D vetshadow \
|
||||||
|
-D errcheck \
|
||||||
|
-D golint \
|
||||||
|
-D gas
|
||||||
|
build:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:1.9
|
||||||
|
working_directory: /go/src/github.com/filebrowser/filebrowser
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Install Dependencies
|
||||||
|
command: |
|
||||||
|
cd cmd/filebrowser
|
||||||
|
go get ./...
|
||||||
|
- run:
|
||||||
|
name: Building
|
||||||
|
command: go build
|
||||||
|
deploy:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:1.9
|
||||||
|
working_directory: /go/src/github.com/filebrowser/filebrowser
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Deploy
|
||||||
|
command: curl -sL https://git.io/goreleaser | bash
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
build-deploy:
|
||||||
|
jobs:
|
||||||
|
- linting
|
||||||
|
- build
|
||||||
|
- deploy:
|
||||||
|
requires:
|
||||||
|
- linting
|
||||||
|
- build
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
|
||||||
|
branches:
|
||||||
|
ignore: /.*/
|
||||||
|
|||||||
22
.travis.yml
22
.travis.yml
@ -1,22 +0,0 @@
|
|||||||
language: go
|
|
||||||
|
|
||||||
go: 1.x
|
|
||||||
|
|
||||||
env:
|
|
||||||
- "PATH=/home/travis/gopath/bin:$PATH"
|
|
||||||
|
|
||||||
install:
|
|
||||||
- go get ./...
|
|
||||||
# Install gometalinter and certain linters
|
|
||||||
- go get github.com/alecthomas/gometalinter
|
|
||||||
- go get github.com/client9/misspell/cmd/misspell
|
|
||||||
- go get github.com/gordonklaus/ineffassign
|
|
||||||
- go get golang.org/x/tools/cmd/goimports
|
|
||||||
- go get github.com/tsenart/deadcode
|
|
||||||
|
|
||||||
script:
|
|
||||||
- gometalinter --disable-all -E gofmt -E misspell -E ineffassign -E goimports -E deadcode --exclude="rice-box.go" --tests ./...
|
|
||||||
- go test ./... -timeout 30s
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- test -n "$TRAVIS_TAG" && curl -sL https://git.io/goreleaser | bash
|
|
||||||
@ -210,14 +210,6 @@ func (m *FileBrowser) Setup() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove this after 1.5
|
|
||||||
for _, user := range users {
|
|
||||||
if user.ViewMode != ListViewMode && user.ViewMode != MosaicViewMode {
|
|
||||||
user.ViewMode = ListViewMode
|
|
||||||
m.Store.Users.Update(user, "ViewMode")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m.DefaultUser.Username = ""
|
m.DefaultUser.Username = ""
|
||||||
m.DefaultUser.Password = ""
|
m.DefaultUser.Password = ""
|
||||||
|
|
||||||
@ -320,7 +312,7 @@ func (m FileBrowser) Runner(event string, path string, destination string, user
|
|||||||
|
|
||||||
cmd := exec.Command(command, args...)
|
cmd := exec.Command(command, args...)
|
||||||
cmd.Env = append(os.Environ(), fmt.Sprintf("FILE=%s", path))
|
cmd.Env = append(os.Environ(), fmt.Sprintf("FILE=%s", path))
|
||||||
cmd.Env = append(cmd.Env, fmt.Sprintf("ROOT=%s", string(user.Scope)))
|
cmd.Env = append(cmd.Env, fmt.Sprintf("ROOT=%s", user.Scope))
|
||||||
cmd.Env = append(cmd.Env, fmt.Sprintf("TRIGGER=%s", event))
|
cmd.Env = append(cmd.Env, fmt.Sprintf("TRIGGER=%s", event))
|
||||||
cmd.Env = append(cmd.Env, fmt.Sprintf("USERNAME=%s", user.Username))
|
cmd.Env = append(cmd.Env, fmt.Sprintf("USERNAME=%s", user.Username))
|
||||||
|
|
||||||
@ -372,42 +364,42 @@ type User struct {
|
|||||||
// ID is the required primary key with auto increment0
|
// ID is the required primary key with auto increment0
|
||||||
ID int `storm:"id,increment"`
|
ID int `storm:"id,increment"`
|
||||||
|
|
||||||
// Username is the user username used to login.
|
// Tells if this user is an admin.
|
||||||
Username string `json:"username" storm:"index,unique"`
|
Admin bool `json:"admin"`
|
||||||
|
|
||||||
|
// These indicate if the user can perform certain actions.
|
||||||
|
AllowCommands bool `json:"allowCommands"` // Execute commands
|
||||||
|
AllowEdit bool `json:"allowEdit"` // Edit/rename files
|
||||||
|
AllowNew bool `json:"allowNew"` // Create files and folders
|
||||||
|
AllowPublish bool `json:"allowPublish"` // Publish content (to use with static gen)
|
||||||
|
|
||||||
|
// Prevents the user to change its password.
|
||||||
|
LockPassword bool `json:"lockPassword"`
|
||||||
|
|
||||||
|
// Commands is the list of commands the user can execute.
|
||||||
|
Commands []string `json:"commands"`
|
||||||
|
|
||||||
|
// Custom styles for this user.
|
||||||
|
CSS string `json:"css"`
|
||||||
|
|
||||||
|
// FileSystem is the virtual file system the user has access.
|
||||||
|
FileSystem FileSystem `json:"-"`
|
||||||
|
|
||||||
|
// Locale is the language of the user.
|
||||||
|
Locale string `json:"locale"`
|
||||||
|
|
||||||
// The hashed password. This never reaches the front-end because it's temporarily
|
// The hashed password. This never reaches the front-end because it's temporarily
|
||||||
// emptied during JSON marshall.
|
// emptied during JSON marshall.
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
|
|
||||||
// Tells if this user is an admin.
|
// Rules is an array of access and deny rules.
|
||||||
Admin bool `json:"admin"`
|
Rules []*Rule `json:"rules"`
|
||||||
|
|
||||||
// Scope is the path the user has access to.
|
// Scope is the path the user has access to.
|
||||||
Scope string `json:"filesystem"`
|
Scope string `json:"filesystem"`
|
||||||
|
|
||||||
// FileSystem is the virtual file system the user has access.
|
// Username is the user username used to login.
|
||||||
FileSystem FileSystem `json:"-"`
|
Username string `json:"username" storm:"index,unique"`
|
||||||
|
|
||||||
// Rules is an array of access and deny rules.
|
|
||||||
Rules []*Rule `json:"rules"`
|
|
||||||
|
|
||||||
// Custom styles for this user.
|
|
||||||
CSS string `json:"css"`
|
|
||||||
|
|
||||||
// Locale is the language of the user.
|
|
||||||
Locale string `json:"locale"`
|
|
||||||
|
|
||||||
// Prevents the user to change its password.
|
|
||||||
LockPassword bool `json:"lockPassword"`
|
|
||||||
|
|
||||||
// These indicate if the user can perform certain actions.
|
|
||||||
AllowNew bool `json:"allowNew"` // Create files and folders
|
|
||||||
AllowEdit bool `json:"allowEdit"` // Edit/rename files
|
|
||||||
AllowCommands bool `json:"allowCommands"` // Execute commands
|
|
||||||
AllowPublish bool `json:"allowPublish"` // Publish content (to use with static gen)
|
|
||||||
|
|
||||||
// Commands is the list of commands the user can execute.
|
|
||||||
Commands []string `json:"commands"`
|
|
||||||
|
|
||||||
// User view mode for files and folders.
|
// User view mode for files and folders.
|
||||||
ViewMode string `json:"viewMode"`
|
ViewMode string `json:"viewMode"`
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user