forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accept git 1.7.2 as the minimum version (go-gitea#90)
* Add an head ref for the sake of using self repo for testing * Add test for CommitCount * Add testing with git-1.7.2 * Add test for GetLatestCommitTime The test checks that latest commit time is before now and more recent than the commit this PR is based at Test no error is raised by time parsing and GetLatestCommitTime Print actual time when tests fail * Accept git 1.7.2 as the minimum version Debian old old (very old) distribution (6.0 aka Squeeze) ships version 1.7.10.4. The version requirement was raised in go-gitea#46 supposedly for the need of "symbolic-ref" command, but that command is supported by the 1.7.2 version too, and possibly even older versions. * Reduce output from drone, add comments Reduce steps, concatenating them in logical steps * Interrupt step upon first failure * Add Dockerfile for use with ci * Use ad-hoc docker image for testing git-1.7.2 * Avoid running build/vet/clean twice * Set HEAD ref also in testing-1-7 step
- Loading branch information
Showing
6 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2017 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package git | ||
|
||
import ( | ||
"testing" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestCommitsCount(t *testing.T) { | ||
commitsCount, _ := CommitsCount(".", "d86a90f801dbe279db095437a8c7ea42c60e8d98") | ||
assert.Equal(t, int64(3), commitsCount) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM webhippie/golang:edge | ||
RUN apk add --update autoconf zlib-dev > /dev/null && \ | ||
mkdir build && \ | ||
curl -sL "https://github.com/git/git/archive/v1.7.2.tar.gz" -o git.tar.gz && \ | ||
tar -C build -xzf git.tar.gz && \ | ||
cd build/git-1.7.2 && \ | ||
{ autoconf 2> err || { cat err && false; } } && \ | ||
./configure --without-tcltk --prefix=/opt/git-1.7.2 > /dev/null && \ | ||
{ make install NO_PERL=please > /dev/null 2> err || { cat err && false; } } && \ | ||
cd ../.. && \ | ||
rm -rf build git.tar.gz \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
git-1.7: | ||
docker build -t gitea/ci:git-1.7 -f Dockerfile-git-1.7 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2017 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package git | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGetLatestCommitTime(t *testing.T) { | ||
lct, err := GetLatestCommitTime(".") | ||
assert.NoError(t, err) | ||
// Time is in the past | ||
now := time.Now() | ||
assert.True(t, lct.Unix() < now.Unix(), "%d not smaller than %d", lct, now) | ||
// Time is after Mon Oct 23 03:52:09 2017 +0300 | ||
// which is the time of commit | ||
// d47b98c44c9a6472e44ab80efe65235e11c6da2a | ||
refTime, err := time.Parse("Mon Jan 02 15:04:05 2006 -0700", "Mon Oct 23 03:52:09 2017 +0300") | ||
assert.NoError(t, err) | ||
assert.True(t, lct.Unix() > refTime.Unix(), "%d not greater than %d", lct, refTime) | ||
} |