Repository: twpayne/chezmoi
Pull request #449 (2019-10-04 22:44:37)

Add GitHub Actions


Patch:
diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml
new file mode 100644
index 000000000..5ef1de811
--- /dev/null
+++ b/.github/workflows/format.yml
@@ -0,0 +1,26 @@
+on:
+- push
+- pull_request
+name: test
+jobs:
+  format:
+    strategy:
+      matrix:
+        go-version:
+        - 1.13.x
+        platform:
+        - ubuntu-latest
+    runs-on: ${{ matrix.platform }}
+    steps:
+    - name: Setup Go
+      uses: actions/setup-go@v1
+      with:
+        go-version: ${{ matrix.go-version }}
+    - name: Install gofumports
+      run: GO111MODULE=off go get -u mvdan.cc/gofumpt/gofumports
+    - name: Checkout
+      uses: actions/checkout@v1
+    - name: Format
+      run: find . -name \*.go | xargs $(go env GOPATH)/bin/gofumports -w
+    - name: Check diff
+      run: git diff --exit-code
\ No newline at end of file
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 000000000..b208705f9
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,24 @@
+on:
+- push
+- pull_request
+name: test
+jobs:
+  lint:
+    strategy:
+      matrix:
+        go-version:
+        - 1.13.x
+        platform:
+        - ubuntu-latest
+    runs-on: ${{ matrix.platform }}
+    steps:
+    - name: Setup Go
+      uses: actions/setup-go@v1
+      with:
+        go-version: ${{ matrix.go-version }}
+    - name: Install golangci-lint
+      run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.19.1
+    - name: Checkout
+      uses: actions/checkout@v1
+    - name: Lint
+      run: $(go env GOPATH)/bin/golangci-lint run ./...
diff --git a/go.mod b/go.mod
index 97de8a202..6a1466970 100644
--- a/go.mod
+++ b/go.mod
@@ -32,7 +32,7 @@ require (
 	github.com/stretchr/objx v0.2.0 // indirect
 	github.com/stretchr/testify v1.3.0
 	github.com/twpayne/go-shell v0.0.3
-	github.com/twpayne/go-vfs v1.3.4
+	github.com/twpayne/go-vfs v1.3.5
 	github.com/twpayne/go-vfsafero v1.0.0
 	github.com/twpayne/go-xdg/v3 v3.1.0
 	github.com/zalando/go-keyring v0.0.0-20190603084339-02404fc6afd1
diff --git a/go.sum b/go.sum
index bb7083b07..7e8f59d97 100644
--- a/go.sum
+++ b/go.sum
@@ -179,10 +179,9 @@ github.com/twpayne/go-acl v0.0.2/go.mod h1:lVOy2syxHw2MVrvUnQhkFUXlPFKuFm3gdNMny
 github.com/twpayne/go-shell v0.0.3 h1:Tzi3t9zCNudAAsxd9UrmhZhqWfp7pjFh/xlJ6M8HmrQ=
 github.com/twpayne/go-shell v0.0.3/go.mod h1:H/gzux0DOH5jsjQSHXs6rs2Onxy+V4j6ycZTOulC0l8=
 github.com/twpayne/go-vfs v1.0.1/go.mod h1:OIXA6zWkcn7Jk46XT7ceYqBMeIkfzJ8WOBhGJM0W4y8=
-github.com/twpayne/go-vfs v1.0.5 h1:i45a6Ykg/asDB94fHH5OmScCQHFx/P9A//9M5dfXwQk=
 github.com/twpayne/go-vfs v1.0.5/go.mod h1:OIXA6zWkcn7Jk46XT7ceYqBMeIkfzJ8WOBhGJM0W4y8=
-github.com/twpayne/go-vfs v1.3.4 h1:vRfZShp5oWlOwHfDglwRGQYcPFpEjMFrtJzPMooGSD0=
-github.com/twpayne/go-vfs v1.3.4/go.mod h1:BH2oQurpkb3roQDR7hZH+9DITZidl6JHOEfHlCModXY=
+github.com/twpayne/go-vfs v1.3.5 h1:VMwA5IJF0zGGAMqofyFb7+nv324ilFHR9JPZC5m9c74=
+github.com/twpayne/go-vfs v1.3.5/go.mod h1:BH2oQurpkb3roQDR7hZH+9DITZidl6JHOEfHlCModXY=
 github.com/twpayne/go-vfsafero v1.0.0 h1:ZlH32HF4OoVX/aRqc5bZa+2+M+/ezmJ4XYpT0ShtZNc=
 github.com/twpayne/go-vfsafero v1.0.0/go.mod h1:rs2H15b2z0euJzwyoBS63eUHZgBhNXVQfIFfRp8DKEk=
 github.com/twpayne/go-xdg/v3 v3.1.0 h1:AxX5ZLJIzqYHJh+4uGxWT97ySh1ND1bJLjqMxdYF+xs=


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 000000000..4985bf35f
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,24 @@
+on:
+- push
+- pull_request
+name: test
+jobs:
+  test:
+    strategy:
+      matrix:
+        go-version:
+        - 1.13.x
+        platform:
+        - macos-latest
+        - ubuntu-latest
+        - windows-latest
+    runs-on: ${{ matrix.platform }}
+    steps:
+    - name: Setup Go
+      uses: actions/setup-go@v1
+      with:
+        go-version: ${{ matrix.go-version }}
+    - name: Checkout
+      uses: actions/checkout@v1
+    - name: Go test
+      run: go test ./...
diff --git a/cmd/add_test.go b/cmd/add_test.go
index a1bb127a2..5ce62547b 100644
--- a/cmd/add_test.go
+++ b/cmd/add_test.go
@@ -1,6 +1,7 @@
 package cmd
 
 import (
+	"path/filepath"
 	"testing"
 
 	"github.com/stretchr/testify/assert"
@@ -270,7 +271,7 @@ func TestAddCommand(t *testing.T) {
 			tests: []vfst.Test{
 				vfst.TestPath("/home/user/.chezmoi/symlink_foo",
 					vfst.TestModeIsRegular,
-					vfst.TestContentsString(".dotfiles/foo"),
+					vfst.TestContentsString(filepath.FromSlash(".dotfiles/foo")),
 				),
 			},
 		},
diff --git a/cmd/init_test.go b/cmd/init_test.go
index 04138a40c..eb0bbacda 100644
--- a/cmd/init_test.go
+++ b/cmd/init_test.go
@@ -116,11 +116,11 @@ func TestInitRepo(t *testing.T) {
 		),
 		vfst.TestPath("/home/user/.local/share/chezmoi/dot_bashrc",
 			vfst.TestModeIsRegular,
-			vfst.TestContentsString("# contents of .bashrc\n"),
+			vfst.TestContentsStringLines("# contents of .bashrc\n"),
 		),
 		vfst.TestPath("/home/user/.config/chezmoi/chezmoi.toml",
 			vfst.TestModeIsRegular,
-			vfst.TestContentsString("# contents of chezmoi.toml\n"),
+			vfst.TestContentsStringLines("# contents of chezmoi.toml\n"),
 		),
 	)
 }