Skip to content

Commit

Permalink
Merge pull request #18 from maxcnunes/fix-ci
Browse files Browse the repository at this point in the history
Fix CI tasks
maxcnunes authored Aug 8, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 1fde628 + edee555 commit 5a02122
Showing 11 changed files with 92 additions and 83 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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 }}
39 changes: 39 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -55,3 +55,6 @@ A single test:
go test -run TestSimplePost ./...
```

### Release

The release runs automatically with a Github action on pushed git tags.
18 changes: 3 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -3,26 +3,14 @@ TEST_PACKAGES := $(shell go list ./... | grep -v cmd)
COVER_PACKAGES := $(shell go list ./... | grep -v cmd | paste -sd "," -)
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:
@go build -o ./gaper cmd/gaper/main.go

## 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:
@gometalinter \
--deadline=120s \
--line-length=120 \
--enable-all \
--disable=gochecknoinits --disable=gochecknoglobals \
--vendor ./...
@golangci-lint run

test:
@go test -p=1 -coverpkg $(COVER_PACKAGES) \
31 changes: 0 additions & 31 deletions appveyor.yml

This file was deleted.

1 change: 0 additions & 1 deletion builder.go
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@ type Builder interface {
type builder struct {
dir string
binary string
errors string
wd string
buildArgs []string
}
4 changes: 1 addition & 3 deletions gaper.go
Original file line number Diff line number Diff line change
@@ -212,9 +212,7 @@ func setupConfig(cfg *Config) error {
var extensions []string
for i := range cfg.Extensions {
values := strings.Split(cfg.Extensions[i], ",")
for _, e := range values {
extensions = append(extensions, e)
}
extensions = append(extensions, values...)
}
cfg.Extensions = extensions

Empty file added testdata/.hidden-file
Empty file.
Empty file.
13 changes: 9 additions & 4 deletions watcher_test.go
Original file line number Diff line number Diff line change
@@ -104,14 +104,19 @@ func TestWatcherWatchChange(t *testing.T) {
time.Sleep(time.Millisecond * 500)

// update hidden files and dirs to check builtin hidden ignore is working
os.Chtimes(hiddenfile1, time.Now(), time.Now())
os.Chtimes(hiddenfile2, time.Now(), time.Now())
err = os.Chtimes(hiddenfile1, time.Now(), time.Now())
assert.Nil(t, err, "chtimes error")

err = os.Chtimes(hiddenfile2, time.Now(), time.Now())
assert.Nil(t, err, "chtimes error")

// update testfile first to check ignore is working
os.Chtimes(testfile, time.Now(), time.Now())
err = os.Chtimes(testfile, time.Now(), time.Now())
assert.Nil(t, err, "chtimes error")

time.Sleep(time.Millisecond * 500)
os.Chtimes(mainfile, time.Now(), time.Now())
err = os.Chtimes(mainfile, time.Now(), time.Now())
assert.Nil(t, err, "chtimes error")

select {
case event := <-w.Events():

0 comments on commit 5a02122

Please sign in to comment.