-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always set a fake identity and disable commit signing inside of temporary repos used in tests. Authored-by: Owen Nelson <[email protected]>
- Loading branch information
1 parent
636d996
commit d36d166
Showing
3 changed files
with
17 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,30 +2,28 @@ name: Build | |
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.16 | ||
go-version-file: go.mod | ||
|
||
- name: Test | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "Talisman Maintainers" | ||
go test -covermode=count -coverprofile=coverage.out -v ./... | ||
- name: Codecov | ||
# You may pin to the exact commit or the version. | ||
# uses: codecov/codecov-action@e156083f13aff6830c92fc5faa23505779fbf649 | ||
uses: codecov/[email protected] | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -23,20 +23,21 @@ func Init(gitRoot string) *GitTesting { | |
testingRepo := &GitTesting{gitRoot} | ||
output := testingRepo.ExecCommand("git", "init", ".") | ||
logrus.Debugf("Git init result %v", string(output)) | ||
if os.Getenv("CI") != "" { | ||
fmt.Println("Setting up git_repo") | ||
testingRepo.ExecCommand("git", "config", "--global", "user.email", "[email protected]") | ||
testingRepo.ExecCommand("git", "config", "--global", "user.name", "Talisman Test User") | ||
} | ||
testingRepo.ExecCommand("git", "config", "user.email", "[email protected]") | ||
testingRepo.ExecCommand("git", "config", "user.name", "Talisman Test User") | ||
testingRepo.ExecCommand("git", "config", "commit.gpgsign", "false") | ||
return testingRepo | ||
} | ||
|
||
func (git *GitTesting) GitClone(cloneName string) *GitTesting { | ||
result := git.ExecCommand("git", "clone", git.gitRoot, cloneName) | ||
Logger.Debugf("Clone result : %s\n", result) | ||
Logger.Debugf("GitRoot :%s \t CloneRoot: %s\n", git.gitRoot, cloneName) | ||
retval := &GitTesting{cloneName} | ||
return retval | ||
clone := &GitTesting{cloneName} | ||
clone.ExecCommand("git", "config", "user.email", "[email protected]") | ||
clone.ExecCommand("git", "config", "user.name", "Talisman Test User") | ||
clone.ExecCommand("git", "config", "commit.gpgsign", "false") | ||
return clone | ||
} | ||
|
||
func (git *GitTesting) SetupBaselineFiles(filenames ...string) { | ||
|
@@ -125,7 +126,7 @@ func (git *GitTesting) Commit(fileName string, message string) { | |
git.ExecCommand("git", "commit", "-m", message) | ||
} | ||
|
||
//GetBlobDetails returns git blob details for a path | ||
// GetBlobDetails returns git blob details for a path | ||
func (git *GitTesting) GetBlobDetails(fileName string) string { | ||
var output []byte | ||
objectHashAndFilename := "" | ||
|
@@ -145,7 +146,7 @@ func (git *GitTesting) GetBlobDetails(fileName string) string { | |
return objectHashAndFilename | ||
} | ||
|
||
//ExecCommand executes a command with given arguments in the git repo directory | ||
// ExecCommand executes a command with given arguments in the git repo directory | ||
func (git *GitTesting) ExecCommand(commandName string, args ...string) string { | ||
var output []byte | ||
git.doInGitRoot(func() { | ||
|
@@ -176,12 +177,12 @@ func (git *GitTesting) doInGitRoot(operation func()) { | |
operation() | ||
} | ||
|
||
//GetRoot returns the root directory of the git-testing repo | ||
// GetRoot returns the root directory of the git-testing repo | ||
func (git *GitTesting) GetRoot() string { | ||
return git.gitRoot | ||
} | ||
|
||
//RemoveHooks removes all file-system hooks from git-test repo | ||
// RemoveHooks removes all file-system hooks from git-test repo | ||
func (git *GitTesting) RemoveHooks() { | ||
git.ExecCommand("rm", "-rf", ".git/hooks/") | ||
} |