From 9d0f15c4fa712cdacfa3887e9baac918f093fbf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ximo=20Cuadros?= Date: Sun, 15 Mar 2020 21:18:32 +0100 Subject: [PATCH] ci: based on github actions --- .github/workflows/test.yml | 75 +++++++++++++++++++++++-- .travis.yml | 37 ------------ CONTRIBUTING.md | 15 +---- DCO | 36 ------------ MAINTAINERS | 3 - Makefile | 14 ++--- appveyor.yml | 21 ------- go.mod | 2 +- go.sum | 8 +-- plumbing/format/idxfile/decoder_test.go | 6 +- plumbing/format/packfile/parser_test.go | 12 +--- repository_test.go | 6 +- storage/filesystem/object_test.go | 18 +----- storage/test/storage_suite.go | 2 +- worktree_test.go | 4 +- 15 files changed, 90 insertions(+), 169 deletions(-) delete mode 100644 .travis.yml delete mode 100644 DCO delete mode 100644 MAINTAINERS delete mode 100644 appveyor.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf1651ee6..16640a66e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,18 +1,85 @@ on: [push, pull_request] name: Test jobs: - test: + version-matrix: strategy: + fail-fast: false matrix: - go-version: [1.12.x, 1.13.x, 1.14.x] + go-version: [1.13.x, 1.14.x] platform: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.platform }} steps: - name: Install Go uses: actions/setup-go@v1 with: - go-version: ${{ matrix.go-version }} + go-version: ${{ matrix.go-version }} + - name: Checkout code uses: actions/checkout@v2 + + - name: Configure known hosts + if: matrix.platform != 'ubuntu-latest' + run: | + mkdir -p ~/.ssh + ssh-keyscan -H github.com > ~/.ssh/known_hosts + + - name: Set Git config + run: | + git config --global user.email "gha@example.com" + git config --global user.name "GitHub Actions" + - name: Test - run: go test -v ./... \ No newline at end of file + run: make test-coverage + + - name: Convert coverage to lcov + if: matrix.platform == 'ubuntu-latest' && matrix.go-version == '1.14.x' + uses: jandelgado/gcov2lcov-action@v1.0.0 + with: + infile: coverage.out + outfile: coverage.lcov + + - name: Coveralls + if: matrix.platform == 'ubuntu-latest' && matrix.go-version == '1.14.x' + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: coverage.lcov + + git-matrix: + strategy: + fail-fast: false + matrix: + git: [[master, ubuntu-latest], [v2.11.0, ubuntu-latest]] + + runs-on: ${{ matrix.git[1] }} + env: + GIT_VERSION: ${{ matrix.git[0] }} + GIT_DIST_PATH: .git-dist/${{ matrix.git[0] }} + + steps: + - name: Install Go + uses: actions/setup-go@v1 + with: + go-version: 1.14.x + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install build dependencies + run: sudo apt-get install gettext + + - name: Git Build + run: make build-git + + - name: Set Git config + run: | + git config --global user.email "gha@example.com" + git config --global user.name "GitHub Actions" + export PATH=$GIT_DIST_PATH:$PATH + + + - name: Test + env: + GIT_EXEC_PATH: ${{ env.GIT_DIST_PATH }} + run: make test-coverage diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 00b478e38..000000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: go - -go: - - "1.11" - - "1.12" - -go_import_path: github.com/go-git/go-git/v5 - -env: - - GIT_VERSION=master - - GIT_VERSION=v1.9.3 - - GIT_VERSION=v2.11.0 - -cache: - directories: - - $HOME/.git-dist - -before_script: - - export GIT_DIST_PATH=$HOME/.git-dist - - make build-git - -before_install: - - git config --global user.email "travis@example.com" - - git config --global user.name "Travis CI" - -install: - - go get -v -t ./... - -script: - - export GIT_EXEC_PATH=$GIT_DIST_PATH - - export PATH=$GIT_DIST_PATH:$PATH - - git version - - make test-coverage - - go vet ./... - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bdb5f7334..fce25328a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,25 +5,12 @@ contributions via GitHub pull requests. This document outlines some of the conventions on development workflow, commit message formatting, contact points, and other resources to make it easier to get your contribution accepted. -## Certificate of Origin - -By contributing to this project you agree to the [Developer Certificate of -Origin (DCO)](DCO). This document was created by the Linux Kernel community and is a -simple statement that you, as a contributor, have the legal right to make the -contribution. - -In order to show your agreement with the DCO you should include at the end of commit message, -the following line: `Signed-off-by: John Doe `, using your real name. - -This can be done easily using the [`-s`](https://github.com/git/git/blob/b2c150d3aa82f6583b9aadfecc5f8fa1c74aca09/Documentation/git-commit.txt#L154-L161) flag on the `git commit`. - ## Support Channels The official support channels, for both users and contributors, are: - [StackOverflow go-git tag](https://stackoverflow.com/questions/tagged/go-git) for user questions. - GitHub [Issues](https://github.com/src-d/go-git/issues)* for bug reports and feature requests. -- Slack: #go-git room in the [source{d} Slack](https://join.slack.com/t/sourced-community/shared_invite/enQtMjc4Njk5MzEyNzM2LTFjNzY4NjEwZGEwMzRiNTM4MzRlMzQ4MmIzZjkwZmZlM2NjODUxZmJjNDI1OTcxNDAyMmZlNmFjODZlNTg0YWM) *Before opening a new issue or submitting a new pull request, it's helpful to search the project - it's likely that another user has already reported the @@ -42,7 +29,7 @@ In order for a PR to be accepted it needs to pass a list of requirements: - They should in general include tests, and those shall pass. - If the PR is a bug fix, it has to include a suite of unit tests for the new functionality. - If the PR is a new feature, it has to come with a suite of unit tests, that tests the new functionality. -- In any case, all the PRs have to pass the personal evaluation of at least one of the [maintainers](MAINTAINERS) of go-git. +- In any case, all the PRs have to pass the personal evaluation of at least one of the maintainers of go-git. ### Format of the commit message diff --git a/DCO b/DCO deleted file mode 100644 index 3aca339de..000000000 --- a/DCO +++ /dev/null @@ -1,36 +0,0 @@ -Developer Certificate of Origin -Version 1.1 - -Copyright (C) 2004, 2006 The Linux Foundation and its contributors. -660 York Street, Suite 102, -San Francisco, CA 94110 USA - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - - -Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -(a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -(b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -(c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -(d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. \ No newline at end of file diff --git a/MAINTAINERS b/MAINTAINERS deleted file mode 100644 index ff2129c45..000000000 --- a/MAINTAINERS +++ /dev/null @@ -1,3 +0,0 @@ -Máximo Cuadros (@mcuadros) -Jeremy Stribling (@strib) -Ori Rawlings (@orirawlings) diff --git a/Makefile b/Makefile index 6acd03581..d10922fb1 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ WORKDIR = $(PWD) # Go parameters GOCMD = go -GOTEST = $(GOCMD) test -v +GOTEST = $(GOCMD) test # Git config GIT_VERSION ?= @@ -11,12 +11,8 @@ GIT_DIST_PATH ?= $(PWD)/.git-dist GIT_REPOSITORY = http://github.com/git/git.git # Coverage -COVERAGE_REPORT = coverage.txt -COVERAGE_MODE = atomic - -ifneq ($(origin CI), undefined) - WORKDIR := $(GOPATH)/src/github.com/go-git/go-git/v5 -endif +COVERAGE_REPORT = coverage.out +COVERAGE_MODE = count build-git: @if [ -f $(GIT_DIST_PATH)/git ]; then \ @@ -30,11 +26,11 @@ build-git: fi test: - @cd $(WORKDIR); \ + @echo "running against `git version`"; \ $(GOTEST) ./... test-coverage: - @cd $(WORKDIR); \ + @echo "running against `git version`"; \ echo "" > $(COVERAGE_REPORT); \ $(GOTEST) -coverprofile=$(COVERAGE_REPORT) -coverpkg=./... -covermode=$(COVERAGE_MODE) ./... diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 160616bec..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: "{build}" -platform: x64 - -matrix: - allow_failures: - - platform: x64 - -clone_folder: c:\gopath\src\gopkg.in\src-d\go-git.v4 - -environment: - GOPATH: c:\gopath - -install: - - set PATH=%GOPATH%\bin;c:\go\bin;"C:\Program Files\Git\mingw64\bin";%PATH% - - go version - - go get -v -t ./... - - git config --global user.email "travis@example.com" - - git config --global user.name "Travis CI - -build_script: - - go test -v ./... diff --git a/go.mod b/go.mod index 31c4086a5..6d8da35c3 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/gliderlabs/ssh v0.2.2 github.com/go-git/gcfg v1.5.0 github.com/go-git/go-billy/v5 v5.0.0 - github.com/go-git/go-git-fixtures/v4 v4.0.0 + github.com/go-git/go-git-fixtures/v4 v4.0.1 github.com/google/go-cmp v0.3.0 github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 github.com/jessevdk/go-flags v1.4.0 diff --git a/go.sum b/go.sum index c07aafd22..a73585e90 100644 --- a/go.sum +++ b/go.sum @@ -14,14 +14,12 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjr github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-git/gcfg v1.4.0 h1:+MzT7ImUasMEDSPwAGvAj2pFbN28BYzw5vM/4UZIIfE= -github.com/go-git/gcfg v1.4.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.0.0 h1:7NQHvd9FVid8VL4qVUMm8XifBK+2xCoZ2lSk0agRrHM= github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-git-fixtures/v4 v4.0.0 h1:2CMMjgatjbdysXcvT23ctyFjkR2w4420flyGwGvDQ6E= -github.com/go-git/go-git-fixtures/v4 v4.0.0/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= +github.com/go-git/go-git-fixtures/v4 v4.0.1 h1:q+IFMfLx200Q3scvt2hN79JsEzy4AmBTp/pqnefH+Bc= +github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= @@ -47,8 +45,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4= -github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= diff --git a/plumbing/format/idxfile/decoder_test.go b/plumbing/format/idxfile/decoder_test.go index 467e2420f..94059ccb3 100644 --- a/plumbing/format/idxfile/decoder_test.go +++ b/plumbing/format/idxfile/decoder_test.go @@ -124,11 +124,7 @@ func BenchmarkDecode(b *testing.B) { b.Errorf("unexpected error reading idx file: %s", err) } - defer func() { - if err := fixtures.Clean(); err != nil { - b.Errorf("unexpected error cleaning fixtures: %s", err) - } - }() + defer fixtures.Clean() for i := 0; i < b.N; i++ { f := bytes.NewBuffer(fixture) diff --git a/plumbing/format/packfile/parser_test.go b/plumbing/format/packfile/parser_test.go index fb5fb7f11..57a9c1771 100644 --- a/plumbing/format/packfile/parser_test.go +++ b/plumbing/format/packfile/parser_test.go @@ -192,11 +192,7 @@ func (t *testObserver) put(pos int64, o observerObject) { } func BenchmarkParse(b *testing.B) { - defer func() { - if err := fixtures.Clean(); err != nil { - b.Fatal(err) - } - }() + defer fixtures.Clean() for _, f := range fixtures.ByTag("packfile") { b.Run(f.URL, func(b *testing.B) { @@ -216,11 +212,7 @@ func BenchmarkParse(b *testing.B) { } func BenchmarkParseBasic(b *testing.B) { - defer func() { - if err := fixtures.Clean(); err != nil { - b.Fatal(err) - } - }() + defer fixtures.Clean() f := fixtures.Basic().One() for i := 0; i < b.N; i++ { diff --git a/repository_test.go b/repository_test.go index f13a755f5..e3663734f 100644 --- a/repository_test.go +++ b/repository_test.go @@ -2844,11 +2844,7 @@ func (s *RepositorySuite) TestBrokenMultipleShallowFetch(c *C) { } func BenchmarkObjects(b *testing.B) { - defer func() { - if err := fixtures.Clean(); err != nil { - b.Fatal(err) - } - }() + defer fixtures.Clean() for _, f := range fixtures.ByTag("packfile") { if f.DotGitHash == "" { diff --git a/storage/filesystem/object_test.go b/storage/filesystem/object_test.go index 6c3512901..2d6f5689b 100644 --- a/storage/filesystem/object_test.go +++ b/storage/filesystem/object_test.go @@ -333,11 +333,7 @@ func (s *FsSuite) TestGetFromObjectFileSharedCache(c *C) { } func BenchmarkPackfileIter(b *testing.B) { - defer func() { - if err := fixtures.Clean(); err != nil { - b.Fatal(err) - } - }() + defer fixtures.Clean() for _, f := range fixtures.ByTag(".git") { b.Run(f.URL, func(b *testing.B) { @@ -385,11 +381,7 @@ func BenchmarkPackfileIter(b *testing.B) { } func BenchmarkPackfileIterReadContent(b *testing.B) { - defer func() { - if err := fixtures.Clean(); err != nil { - b.Fatal(err) - } - }() + defer fixtures.Clean() for _, f := range fixtures.ByTag(".git") { b.Run(f.URL, func(b *testing.B) { @@ -447,11 +439,7 @@ func BenchmarkPackfileIterReadContent(b *testing.B) { } func BenchmarkGetObjectFromPackfile(b *testing.B) { - defer func() { - if err := fixtures.Clean(); err != nil { - b.Fatal(err) - } - }() + defer fixtures.Clean() for _, f := range fixtures.Basic() { b.Run(f.URL, func(b *testing.B) { diff --git a/storage/test/storage_suite.go b/storage/test/storage_suite.go index a646fad2d..d87a7dd4c 100644 --- a/storage/test/storage_suite.go +++ b/storage/test/storage_suite.go @@ -66,7 +66,7 @@ func NewBaseStorageSuite(s Storer) BaseStorageSuite { } func (s *BaseStorageSuite) TearDownTest(c *C) { - c.Assert(fixtures.Clean(), IsNil) + fixtures.Clean() } func (s *BaseStorageSuite) TestSetEncodedObjectAndEncodedObject(c *C) { diff --git a/worktree_test.go b/worktree_test.go index 14851895c..838762f4c 100644 --- a/worktree_test.go +++ b/worktree_test.go @@ -12,6 +12,7 @@ import ( "testing" "time" + fixtures "github.com/go-git/go-git-fixtures/v4" "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/filemode" @@ -25,7 +26,6 @@ import ( "github.com/go-git/go-billy/v5/util" "golang.org/x/text/unicode/norm" . "gopkg.in/check.v1" - "github.com/go-git/go-git-fixtures/v4" ) type WorktreeSuite struct { @@ -692,7 +692,7 @@ func (s *WorktreeSuite) TestCheckoutBisect(c *C) { c.Skip("skipping test in short mode.") } - s.testCheckoutBisect(c, "https://github.com/src-d/go-git.git") + s.testCheckoutBisect(c, "https://github.com/go-git/go-git.git") } func (s *WorktreeSuite) TestCheckoutBisectSubmodules(c *C) {