-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from snipem/develop-release
Add gorelease
- Loading branch information
Showing
4 changed files
with
157 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
on: | ||
create: | ||
tags: | ||
- v* | ||
push: | ||
branches: | ||
- develop-release #for testing this | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
go-version: [1.14.x] | ||
platform: [ubuntu-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Setup env | ||
shell: bash | ||
run: | | ||
echo "::set-env name=GOPATH::${{ github.workspace }}/../go" | ||
echo "::add-path::${{ github.workspace }}/../go/bin" | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Dependencies | ||
run: make --always-make deps theme | ||
|
||
- name: Reset go.mod and go.sum | ||
run: git checkout -- go.mod go.sum | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v1 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
key: ${{ secrets.YOUR_PRIVATE_KEY }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
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,13 @@ | ||
builds: | ||
- | ||
|
||
main: ./cmd/monako | ||
|
||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
|
||
goarch: | ||
- 386 | ||
- amd64 |
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package compose | ||
|
||
// run: go test ./pkg/compose -run TestFrontmatterExpanding | ||
// run: go test ./pkg/compose -run TestGetWebLink | ||
|
||
import ( | ||
"fmt" | ||
"path/filepath" | ||
"testing" | ||
|
||
|
@@ -139,3 +140,69 @@ Also on new line` | |
assert.Contains(t, frontmatter, "content: linetwo\n") | ||
}) | ||
} | ||
|
||
func TestGetWebLink(t *testing.T) { | ||
|
||
cases := []struct { | ||
gitURL, branch, remotePath, Expected string | ||
}{ | ||
{"https://github.com/snipem/monako-test.git", | ||
"master", "test_doc_asciidoc.adoc", | ||
"https://github.com/snipem/monako-test/blob/master/test_doc_asciidoc.adoc"}, | ||
|
||
{"https://gitlab.com/snipem/monako-test.git", | ||
"test-branch", "README.md", | ||
"https://gitlab.com/snipem/monako-test/blob/test-branch/README.md"}, | ||
|
||
{"https://bitbucket.org/snipem/monako-test.git", | ||
"develop", "README.md", | ||
"https://bitbucket.org/snipem/monako-test/src/develop/README.md"}, | ||
|
||
{"/file/local", | ||
"develop", "README.md", | ||
""}, | ||
|
||
{"[email protected]:snipem/monako-test.git", | ||
"master", "README.md", | ||
""}, | ||
} | ||
|
||
for _, tc := range cases { | ||
t.Run(fmt.Sprintf("%s, %s, %s -> %s", tc.gitURL, tc.branch, tc.remotePath, tc.Expected), func(t *testing.T) { | ||
assert.Equal(t, tc.Expected, getWebLinkForFileInGit(tc.gitURL, tc.branch, tc.remotePath)) | ||
}) | ||
} | ||
} | ||
|
||
func TestGetCommitWebLink(t *testing.T) { | ||
|
||
cases := []struct { | ||
gitURL, commitID, Expected string | ||
}{ | ||
{"https://github.com/snipem/monako-test.git", | ||
"b744ffe4761cb3a282dcb30ac23b129ec19c9a53", | ||
"https://github.com/snipem/monako-test/commit/b744ffe4761cb3a282dcb30ac23b129ec19c9a53"}, | ||
|
||
{"https://gitlab.com/snipem/monako-test.git", | ||
"1559b863ff3a9cc1c077ebc480215fd54b621693", | ||
"https://gitlab.com/snipem/monako-test/commit/1559b863ff3a9cc1c077ebc480215fd54b621693"}, | ||
|
||
{"https://bitbucket.org/snipem/monako-test.git", | ||
"e99f32612df02ee18de15bd42326a10e4195be3d", | ||
"https://bitbucket.org/snipem/monako-test/commits/e99f32612df02ee18de15bd42326a10e4195be3d"}, | ||
|
||
{"/file/local", | ||
"commitID4711", | ||
""}, | ||
|
||
{"[email protected]:snipem/monako-test.git", | ||
"commitID4711", | ||
""}, | ||
} | ||
|
||
for _, tc := range cases { | ||
t.Run(fmt.Sprintf("%s, %s -> %s", tc.gitURL, tc.commitID, tc.Expected), func(t *testing.T) { | ||
assert.Equal(t, tc.Expected, getWebLinkForGitCommit(tc.gitURL, tc.commitID)) | ||
}) | ||
} | ||
} |