mirror of https://github.com/maxcnunes/gaper.git
Compare commits
No commits in common. "5a02122f332b733b1b4a5961df3c688e61b392b3" and "1fde6281f19cb91611759326eadc27bd4a2b4256" have entirely different histories.
5a02122f33
...
1fde6281f1
|
@ -1,37 +0,0 @@
|
||||||
name: goreleaser
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
# run only against tags
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
goreleaser:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
-
|
|
||||||
name: Fetch all tags
|
|
||||||
run: git fetch --force --tags
|
|
||||||
-
|
|
||||||
name: Set up Go
|
|
||||||
uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
go-version: 1.19
|
|
||||||
-
|
|
||||||
name: Run GoReleaser
|
|
||||||
uses: goreleaser/goreleaser-action@v2
|
|
||||||
with:
|
|
||||||
distribution: goreleaser
|
|
||||||
version: latest
|
|
||||||
args: release --rm-dist
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
@ -1,39 +0,0 @@
|
||||||
name: dev-workflow
|
|
||||||
|
|
||||||
on:
|
|
||||||
- push
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
- ubuntu-latest
|
|
||||||
# - macos-latest
|
|
||||||
# - windows-latest
|
|
||||||
go:
|
|
||||||
- '1.19'
|
|
||||||
# - '1.18'
|
|
||||||
# - '1.17'
|
|
||||||
# - '1.16'
|
|
||||||
# - '1.15'
|
|
||||||
env:
|
|
||||||
OS: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
|
|
||||||
- name: Setup Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go }}
|
|
||||||
|
|
||||||
- name: golangci-lint
|
|
||||||
uses: golangci/golangci-lint-action@v3
|
|
||||||
with:
|
|
||||||
version: v1.48
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: make test
|
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
|
||||||
uses: codecov/codecov-action@v3
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
language: go
|
||||||
|
|
||||||
|
go:
|
||||||
|
# - 1.7.x
|
||||||
|
# - 1.8.x
|
||||||
|
# - 1.9.x
|
||||||
|
- 1.10.x
|
||||||
|
# - master
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- go version
|
||||||
|
- make setup
|
||||||
|
- make lint
|
||||||
|
|
||||||
|
script:
|
||||||
|
- make test
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email: false
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
- provider: script
|
||||||
|
skip_cleanup: true
|
||||||
|
script: curl -sL http://git.io/goreleaser | bash
|
||||||
|
on:
|
||||||
|
tags: true
|
|
@ -55,6 +55,3 @@ A single test:
|
||||||
go test -run TestSimplePost ./...
|
go test -run TestSimplePost ./...
|
||||||
```
|
```
|
||||||
|
|
||||||
### Release
|
|
||||||
|
|
||||||
The release runs automatically with a Github action on pushed git tags.
|
|
||||||
|
|
18
Makefile
18
Makefile
|
@ -3,14 +3,26 @@ TEST_PACKAGES := $(shell go list ./... | grep -v cmd)
|
||||||
COVER_PACKAGES := $(shell go list ./... | grep -v cmd | paste -sd "," -)
|
COVER_PACKAGES := $(shell go list ./... | grep -v cmd | paste -sd "," -)
|
||||||
LINTER := $(shell command -v gometalinter 2> /dev/null)
|
LINTER := $(shell command -v gometalinter 2> /dev/null)
|
||||||
|
|
||||||
|
.PHONY: setup
|
||||||
|
|
||||||
|
setup:
|
||||||
|
ifndef LINTER
|
||||||
|
@echo "Installing linter"
|
||||||
|
@go get -u github.com/alecthomas/gometalinter
|
||||||
|
@gometalinter --install
|
||||||
|
endif
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@go build -o ./gaper cmd/gaper/main.go
|
@go build -o ./gaper cmd/gaper/main.go
|
||||||
|
|
||||||
## lint: Validate golang code
|
## lint: Validate golang code
|
||||||
# Install it following this doc https://golangci-lint.run/usage/install/#local-installation,
|
|
||||||
# please use the same version from .github/workflows/workflow.yml.
|
|
||||||
lint:
|
lint:
|
||||||
@golangci-lint run
|
@gometalinter \
|
||||||
|
--deadline=120s \
|
||||||
|
--line-length=120 \
|
||||||
|
--enable-all \
|
||||||
|
--disable=gochecknoinits --disable=gochecknoglobals \
|
||||||
|
--vendor ./...
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@go test -p=1 -coverpkg $(COVER_PACKAGES) \
|
@go test -p=1 -coverpkg $(COVER_PACKAGES) \
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
version: "{build}"
|
||||||
|
|
||||||
|
# Source Config
|
||||||
|
|
||||||
|
clone_folder: c:\gopath\src\github.com\maxcnunes\gaper
|
||||||
|
|
||||||
|
# Build host
|
||||||
|
|
||||||
|
environment:
|
||||||
|
GOPATH: c:\gopath
|
||||||
|
GOBIN: c:\gopath\bin
|
||||||
|
|
||||||
|
init:
|
||||||
|
- git config --global core.autocrlf input
|
||||||
|
|
||||||
|
# Build
|
||||||
|
|
||||||
|
install:
|
||||||
|
- set Path=c:\go\bin;c:\gopath\bin;%Path%
|
||||||
|
- go version
|
||||||
|
- go env
|
||||||
|
- go get -u github.com/golang/dep/cmd/dep
|
||||||
|
- choco install make
|
||||||
|
- make setup
|
||||||
|
|
||||||
|
build: false
|
||||||
|
deploy: false
|
||||||
|
|
||||||
|
test_script:
|
||||||
|
- go build github.com/maxcnunes/gaper/cmd/gaper
|
||||||
|
- make test
|
|
@ -17,6 +17,7 @@ type Builder interface {
|
||||||
type builder struct {
|
type builder struct {
|
||||||
dir string
|
dir string
|
||||||
binary string
|
binary string
|
||||||
|
errors string
|
||||||
wd string
|
wd string
|
||||||
buildArgs []string
|
buildArgs []string
|
||||||
}
|
}
|
||||||
|
|
4
gaper.go
4
gaper.go
|
@ -212,7 +212,9 @@ func setupConfig(cfg *Config) error {
|
||||||
var extensions []string
|
var extensions []string
|
||||||
for i := range cfg.Extensions {
|
for i := range cfg.Extensions {
|
||||||
values := strings.Split(cfg.Extensions[i], ",")
|
values := strings.Split(cfg.Extensions[i], ",")
|
||||||
extensions = append(extensions, values...)
|
for _, e := range values {
|
||||||
|
extensions = append(extensions, e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cfg.Extensions = extensions
|
cfg.Extensions = extensions
|
||||||
|
|
||||||
|
|
|
@ -104,19 +104,14 @@ func TestWatcherWatchChange(t *testing.T) {
|
||||||
time.Sleep(time.Millisecond * 500)
|
time.Sleep(time.Millisecond * 500)
|
||||||
|
|
||||||
// update hidden files and dirs to check builtin hidden ignore is working
|
// update hidden files and dirs to check builtin hidden ignore is working
|
||||||
err = os.Chtimes(hiddenfile1, time.Now(), time.Now())
|
os.Chtimes(hiddenfile1, time.Now(), time.Now())
|
||||||
assert.Nil(t, err, "chtimes error")
|
os.Chtimes(hiddenfile2, time.Now(), time.Now())
|
||||||
|
|
||||||
err = os.Chtimes(hiddenfile2, time.Now(), time.Now())
|
|
||||||
assert.Nil(t, err, "chtimes error")
|
|
||||||
|
|
||||||
// update testfile first to check ignore is working
|
// update testfile first to check ignore is working
|
||||||
err = os.Chtimes(testfile, time.Now(), time.Now())
|
os.Chtimes(testfile, time.Now(), time.Now())
|
||||||
assert.Nil(t, err, "chtimes error")
|
|
||||||
|
|
||||||
time.Sleep(time.Millisecond * 500)
|
time.Sleep(time.Millisecond * 500)
|
||||||
err = os.Chtimes(mainfile, time.Now(), time.Now())
|
os.Chtimes(mainfile, time.Now(), time.Now())
|
||||||
assert.Nil(t, err, "chtimes error")
|
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case event := <-w.Events():
|
case event := <-w.Events():
|
||||||
|
|
Loading…
Reference in New Issue