Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI pipeline #1

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: GoURN CI

on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- '*'

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20.x
uses: actions/setup-go@v4
with:
go-version: 1.20.x
cache-dependency-path: go.sum

- name: Checkout Code
uses: actions/checkout@v3

- name: go-fmt
run: |
if [ -n "$(gofmt -s -l .)" ]; then
echo "Go code is not formatted, run 'gofmt -s -w .'"
exit 1
fi

- name: go-vet
run: go vet ./...

- name: revive
run: |
go install github.com/mgechev/[email protected]
revive -config .revive.toml -formatter friendly ./...

test:
name: Test
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Go 1.20.x
uses: actions/setup-go@v4
with:
go-version: 1.20.x
cache-dependency-path: go.sum

- name: Test GoURN
run: go test -v -covermode=count -coverprofile=coverage.out ./...
28 changes: 28 additions & 0 deletions .revive.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ignoreGeneratedHeader = false
severity = "warning"
confidence = 0.8
errorCode = 1
warningCode = 1

[rule.blank-imports]
[rule.context-as-argument]
[rule.context-keys-type]
[rule.dot-imports]
[rule.empty-block]
[rule.error-naming]
[rule.error-return]
[rule.error-strings]
[rule.errorf]
[rule.exported]
[rule.increment-decrement]
[rule.indent-error-flow]
[rule.range]
[rule.receiver-naming]
[rule.redefines-builtin-id]
[rule.superfluous-else]
[rule.time-naming]
[rule.unexported-return]
[rule.unreachable-code]
[rule.unused-parameter]
[rule.var-declaration]
[rule.var-naming]
1 change: 1 addition & 0 deletions urn.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
)

var (
// ErrInvalidURN represents an error for invalid URN
ErrInvalidURN = errors.New("invalid URN")
genericPattern = regexp.MustCompile(`^(?i)urn:(?P<nid>[a-z0-9][a-z0-9-]{0,31}):(?P<nss>(?:[-a-z0-9()+,.:=@;$_!*'&~/]|%[0-9a-fA-F]{2})+)$`)
)
Expand Down
Loading