Skip to content

Commit daa8e1c

Browse files
authored
Merge pull request #155 from estesp/gh-actions-ci
Migrate to GitHub Actions CI
2 parents f1c9af8 + 8c3ce1b commit daa8e1c

22 files changed

Lines changed: 183 additions & 46 deletions

.github/workflows/ci.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Continuity
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
11+
checks:
12+
name: CI Checks
13+
runs-on: ubuntu-18.04
14+
timeout-minutes: 5
15+
steps:
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v1
19+
with:
20+
go-version: 1.13
21+
id: go
22+
23+
- name: Setup Go binary path
24+
shell: bash
25+
run: |
26+
echo "::set-env name=GOPATH::${{ github.workspace }}"
27+
echo "::add-path::${{ github.workspace }}/bin"
28+
29+
- name: Check out code
30+
uses: actions/checkout@v2
31+
with:
32+
path: src/github.com/containerd/continuity
33+
fetch-depth: 25
34+
35+
- name: Checkout project
36+
uses: actions/checkout@v2
37+
with:
38+
repository: containerd/project
39+
path: src/github.com/containerd/project
40+
41+
- name: Install dependencies
42+
env:
43+
GO111MODULE: off
44+
run: |
45+
go get -u github.com/vbatts/git-validation
46+
go get -u github.com/kunalkushwaha/ltag
47+
48+
- name: Check DCO/whitespace/commit message
49+
env:
50+
GITHUB_COMMIT_URL: ${{ github.event.pull_request.commits_url }}
51+
DCO_VERBOSITY: "-q"
52+
DCO_RANGE: ""
53+
working-directory: src/github.com/containerd/continuity
54+
run: |
55+
if [ -z "${GITHUB_COMMIT_URL}" ]; then
56+
DCO_RANGE=$(jq -r '.before +".."+ .after' ${GITHUB_EVENT_PATH})
57+
else
58+
DCO_RANGE=$(curl ${GITHUB_COMMIT_URL} | jq -r '.[0].parents[0].sha +".."+ .[-1].sha')
59+
fi
60+
../project/script/validate/dco
61+
62+
- name: Check file headers
63+
run: ../project/script/validate/fileheader ../project/
64+
working-directory: src/github.com/containerd/continuity
65+
66+
- name: Check vendor
67+
run: ../project/script/validate/vendor
68+
working-directory: src/github.com/containerd/continuity
69+
70+
tests:
71+
name: CI Tests
72+
runs-on: ${{ matrix.os }}
73+
timeout-minutes: 10
74+
needs: [checks]
75+
76+
strategy:
77+
matrix:
78+
os: [ubuntu-18.04, macos-10.15, windows-2019]
79+
80+
steps:
81+
- name: Set up Go
82+
uses: actions/setup-go@v1
83+
with:
84+
go-version: 1.13
85+
86+
- name: Setup Go binary path
87+
shell: bash
88+
run: |
89+
echo "::set-env name=GOPATH::${{ github.workspace }}"
90+
echo "::add-path::${{ github.workspace }}/bin"
91+
92+
- name: Git line endings
93+
shell: bash
94+
run: |
95+
git config --global core.autocrlf false
96+
git config --global core.eol lf
97+
98+
- name: Check out code
99+
uses: actions/checkout@v2
100+
with:
101+
path: src/github.com/containerd/continuity
102+
fetch-depth: 25
103+
104+
- name: Dependencies
105+
env:
106+
GO111MODULE: on
107+
shell: bash
108+
run: go get github.com/golangci/golangci-lint/cmd/[email protected]
109+
110+
- name: Lint
111+
shell: bash
112+
run: make lint
113+
working-directory: src/github.com/containerd/continuity
114+
115+
- name: Build
116+
shell: bash
117+
run: make build binaries
118+
working-directory: src/github.com/containerd/continuity
119+
120+
- name: Linux Tests
121+
if: startsWith(matrix.os, 'ubuntu')
122+
run: |
123+
make test
124+
sudo GOPATH=$GOPATH make root-test
125+
working-directory: src/github.com/containerd/continuity
126+
127+
- name: Non-Linux Tests
128+
if: ${{ !startsWith(matrix.os, 'ubuntu') }}
129+
shell: bash
130+
run: make test-compile
131+
working-directory: src/github.com/containerd/continuity

.golangci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
linters:
2+
enable:
3+
- structcheck
4+
- varcheck
5+
- staticcheck
6+
- unconvert
7+
- gofmt
8+
- goimports
9+
- golint
10+
- ineffassign
11+
- vet
12+
- unused
13+
- misspell
14+
disable:
15+
- errcheck
16+
17+
run:
18+
timeout: 3m

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ before_script:
2929
script:
3030
- export GOOS=${TRAVIS_GOOS}
3131
- make build binaries
32-
- if [ "$GOOS" = "linux" ]; then make vet test; fi
32+
- if [ "$GOOS" = "linux" ]; then make test; fi
3333
- if [ "$GOOS" = "linux" ]; then sudo PATH=$PATH GOPATH=$GOPATH make root-test; fi
3434
- if [ "$GOOS" != "linux" ]; then make test-compile; fi
3535

Makefile

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ TEST_REQUIRES_ROOT_PACKAGES=$(filter \
3333
done | sort -u) \
3434
)
3535

36-
.PHONY: clean all fmt vet lint build test binaries
36+
.PHONY: clean all lint build test binaries
3737
.DEFAULT: default
38-
# skip lint at the moment
39-
all: AUTHORS clean fmt vet fmt build test binaries
38+
39+
all: AUTHORS clean lint build test binaries
4040

4141
AUTHORS: .mailmap .git/HEAD
4242
git log --format='%aN <%aE>' | sort -fu > $@
@@ -52,20 +52,9 @@ ${PREFIX}/bin/continuity: version/version.go $(shell find . -type f -name '*.go'
5252
generate:
5353
go generate -mod=vendor $(PACKAGES)
5454

55-
# Depends on binaries because vet will silently fail if it can't load compiled
56-
# imports
57-
vet: binaries
58-
@echo "+ $@"
59-
@go vet -mod=vendor $(PACKAGES)
60-
61-
fmt:
62-
@echo "+ $@"
63-
@test -z "$$(gofmt -s -l . | grep -v Godeps/_workspace/src/ | grep -v vendor/ | tee /dev/stderr)" || \
64-
echo "+ please format Go code with 'gofmt -s'"
65-
6655
lint:
6756
@echo "+ $@"
68-
@test -z "$$(golint $(PACKAGES) | grep -v Godeps/_workspace/src/ | grep -v vendor/ |tee /dev/stderr)"
57+
@golangci-lint run
6958

7059
build:
7160
@echo "+ $@"

commands/ls.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ var LSCmd = &cobra.Command{
4444
for _, entry := range bm.Resource {
4545
for _, path := range entry.Path {
4646
if os.FileMode(entry.Mode)&os.ModeSymlink != 0 {
47+
//nolint:unconvert
4748
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v -> %v\n", os.FileMode(entry.Mode), entry.User, entry.Group, humanize.Bytes(uint64(entry.Size)), path, entry.Target)
4849
} else {
50+
//nolint:unconvert
4951
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\n", os.FileMode(entry.Mode), entry.User, entry.Group, humanize.Bytes(uint64(entry.Size)), path)
5052
}
5153

context.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ func (c *context) Walk(fn filepath.WalkFunc) error {
596596
return err
597597
}
598598
}
599-
return c.pathDriver.Walk(root, func(p string, fi os.FileInfo, err error) error {
599+
return c.pathDriver.Walk(root, func(p string, fi os.FileInfo, _ error) error {
600600
contained, err := c.containWithRoot(p, root)
601601
return fn(contained, fi, err)
602602
})
@@ -613,12 +613,6 @@ func (c *context) fullpath(p string) (string, error) {
613613
return p, nil
614614
}
615615

616-
// contain cleans and santizes the filesystem path p to be an absolute path,
617-
// effectively relative to the context root.
618-
func (c *context) contain(p string) (string, error) {
619-
return c.containWithRoot(p, c.root)
620-
}
621-
622616
// containWithRoot cleans and santizes the filesystem path p to be an absolute path,
623617
// effectively relative to the passed root. Extra care should be used when calling this
624618
// instead of contain. This is needed for Walk, as if context root is a symlink,

continuityfs/fuse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type fileHandler struct {
131131
func (h *fileHandler) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error {
132132
if h.offset != req.Offset {
133133
if seeker, ok := h.reader.(io.Seeker); ok {
134-
if _, err := seeker.Seek(req.Offset, os.SEEK_SET); err != nil {
134+
if _, err := seeker.Seek(req.Offset, io.SeekStart); err != nil {
135135
logrus.Debugf("Error seeking: %v", err)
136136
return err
137137
}

devices/devices_unix.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func DeviceInfo(fi os.FileInfo) (uint64, uint64, error) {
3232
return 0, 0, fmt.Errorf("cannot extract device from os.FileInfo")
3333
}
3434

35+
//nolint:unconvert
3536
dev := uint64(sys.Rdev)
3637
return uint64(unix.Major(dev)), uint64(unix.Minor(dev)), nil
3738
}

digests.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,9 @@ func digestsMatch(as, bs []digest.Digest) bool {
8888
}
8989

9090
disjoint := len(as) + len(bs)
91-
if len(uniqified) == disjoint {
92-
// if these two sets have the same cardinality, we know both sides
93-
// didn't share any digests.
94-
return false
95-
}
96-
97-
return true
91+
// if these two sets have the same cardinality, we know both sides
92+
// didn't share any digests.
93+
return len(uniqified) != disjoint
9894
}
9995

10096
type digestSlice []digest.Digest

driver/driver_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build go1.13
2+
13
/*
24
Copyright The containerd Authors.
35
@@ -14,8 +16,6 @@
1416
limitations under the License.
1517
*/
1618

17-
// +build go1.13
18-
1919
// Go 1.13 is the minimally supported version for Windows.
2020
// Earlier golang releases have bug in os.Readlink
2121
// (see https://github.com/golang/go/issues/30463).

0 commit comments

Comments
 (0)