diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..b9a91fa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,20 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +## Describe the bug +A clear and concise description of what the bug is. + +## Steps to reproduce +Clear instructions so we can reproduce the bug. + +## Expected behavior +A clear and concise description of what you expected to happen. + +## Additional context +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..64a391b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +## Is your feature request related to a problem? +A clear and concise description of what the problem is. E.g. I'm always frustrated when ... + +## Describe the solution you'd like +A clear and concise description of what you want to happen. + +## Describe alternatives you've considered +A clear and concise description of any alternative solutions or features you've considered. + +## Additional context +Add any other context or screenshots about the feature request here. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5463252 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: gomod + directory: "/" + schedule: + interval: daily + time: "20:00" + open-pull-requests-limit: 10 + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml new file mode 100644 index 0000000..23468a4 --- /dev/null +++ b/.github/workflows/gosec.yml @@ -0,0 +1,19 @@ +name: Gosec +on: + workflow_dispatch: + push: + branches: [main] + pull_request: + branches: [main] +jobs: + tests: + runs-on: ubuntu-latest + env: + GO111MODULE: on + steps: + - name: Checkout Source + uses: actions/checkout@v4 + - name: Run Gosec Security Scanner + uses: securego/gosec@master + with: + args: --exclude-dir=examples --exclude-dir=aws ./... diff --git a/.github/workflows/linux_test.yml b/.github/workflows/linux_test.yml new file mode 100644 index 0000000..8c29670 --- /dev/null +++ b/.github/workflows/linux_test.yml @@ -0,0 +1,30 @@ +name: LinuxUnitTest + +on: + workflow_dispatch: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + unit_test: + name: Unit test (linux) + + strategy: + matrix: + platform: [ubuntu-latest] + + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v4 + with: + go-version: "1" + check-latest: true + + - name: Run tests with coverage report output + run: go test -cover -coverpkg=./... -coverprofile=coverage.out ./... + - uses: k1LoW/octocov-action@v0 diff --git a/.github/workflows/mac_test.yml b/.github/workflows/mac_test.yml new file mode 100644 index 0000000..baec95a --- /dev/null +++ b/.github/workflows/mac_test.yml @@ -0,0 +1,31 @@ +name: MacUnitTest + +on: + workflow_dispatch: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + unit_test: + name: Unit test (mac) + + strategy: + matrix: + platform: [macos-latest] + + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v4 + with: + go-version: "1" + check-latest: true + + - name: Run unit test + run: | + go mod download + go test -race -v ./... diff --git a/.github/workflows/multi_ver_unittest.yml b/.github/workflows/multi_ver_unittest.yml new file mode 100644 index 0000000..2f3f1e6 --- /dev/null +++ b/.github/workflows/multi_ver_unittest.yml @@ -0,0 +1,23 @@ +name: MultiVersionUnitTest + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + unit-test: + runs-on: ubuntu-latest + strategy: + matrix: + go-version: ["1.18", "1.21"] + steps: + - uses: actions/checkout@v4 + - name: Setup Go ${{ matrix.go-version }} + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + + - name: MultiVersionUnitTest + run: make test diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml new file mode 100644 index 0000000..3fb005b --- /dev/null +++ b/.github/workflows/reviewdog.yml @@ -0,0 +1,42 @@ +name: reviewdog +on: [pull_request] + +jobs: + golangci-lint: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: golangci-lint + uses: reviewdog/action-golangci-lint@v2 + with: + reporter: github-pr-review + level: warning + golangci_lint_flags: --timeout=5m + + misspell: + name: misspell + runs-on: ubuntu-latest + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: misspell + uses: reviewdog/action-misspell@v1 + with: + reporter: github-pr-review + level: warning + locale: "US" + + actionlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: reviewdog/action-actionlint@v1 + with: + reporter: github-pr-review + level: warning diff --git a/.github/workflows/windows_test.yml b/.github/workflows/windows_test.yml new file mode 100644 index 0000000..af2b295 --- /dev/null +++ b/.github/workflows/windows_test.yml @@ -0,0 +1,31 @@ +name: WindowsUnitTest + +on: + workflow_dispatch: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + unit_test: + name: Unit test (windows) + + strategy: + matrix: + platform: [windows-latest] + + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v4 + with: + go-version: "1" + check-latest: true + + - name: Run unit test + run: | + go mod download + go test -race -v ./... \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3b735ec..cb4dc7a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ # Go workspace file go.work +coverage.* +naraku diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..c8cb0fe --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,56 @@ +run: + go: "1.20" + +issues: + exclude-use-default: false + +linters: + disable-all: true + enable: + - deadcode + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - structcheck + - typecheck + - unused + - varcheck + - asciicheck + - bodyclose + - dogsled + - dupl + - durationcheck + - errorlint + - exhaustive + - exportloopref + - forcetypeassert + - gochecknoglobals + - gochecknoinits + - goconst + - gocritic + - goimports + - gomnd + - gosec + - ifshort + - misspell + - nakedret + - noctx + - paralleltest + - prealloc + - rowserrcheck + - sqlclosecheck + - stylecheck + - tagliatelle + - thelper + - unconvert + - unparam + - wastedassign + - whitespace +linters-settings: + tagliatelle: + case: + use-field-name: true + rules: + json: snake diff --git a/.octocov.yml b/.octocov.yml new file mode 100644 index 0000000..4ce08a6 --- /dev/null +++ b/.octocov.yml @@ -0,0 +1,28 @@ +# generated by octocov init +coverage: + if: true + acceptable: 60% +testExecutionTime: + if: true + acceptable: 1:1.1 + acceptable: current <= 1min && diff <= 2sec +diff: + datastores: + - artifact://${GITHUB_REPOSITORY} +comment: + if: is_pull_request +summary: + if: true +report: + if: is_default_branch + datastores: + - artifact://${GITHUB_REPOSITORY} +coverage: + badge: + path: docs/coverage.svg +codeToTestRatio: + badge: + path: docs/ratio.svg +testExecutionTime: + badge: + path: docs/time.svg \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..543a395 --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +.PHONY: build test clean + +APP = markdown +VERSION = $(shell git describe --tags --abbrev=0) +GIT_REVISION := $(shell git rev-parse HEAD) +GO = go +GO_BUILD = $(GO) build +GO_TEST = $(GO) test -v +GO_TOOL = $(GO) tool +GOOS = "" +GOARCH = "" +GO_PKGROOT = ./... +GO_PACKAGES = $(shell $(GO_LIST) $(GO_PKGROOT)) +GO_LDFLAGS = + +clean: ## Clean project + -rm -rf $(APP) cover.out cover.html + +test: ## Start unit test for server + env GOOS=$(GOOS) $(GO_TEST) -cover -coverpkg=$(GO_PKGROOT) -coverprofile=coverage.out $(GO_PKGROOT) + $(GO_TOOL) cover -html=coverage.out -o coverage.html + +.DEFAULT_GOAL := help +help: ## Show help message + @grep -E '^[0-9a-zA-Z_-]+[[:blank:]]*:.*?## .*$$' $(MAKEFILE_LIST) | sort \ + | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[1;32m%-15s\033[0m %s\n", $$1, $$2}' \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..fa35d60 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/go-spectest/markdown + +go 1.18 diff --git a/markdown.go b/markdown.go new file mode 100644 index 0000000..8285cd9 --- /dev/null +++ b/markdown.go @@ -0,0 +1,2 @@ +// Package markdown is markdown builder that includes to convert Markdown to HTML. +package markdown