Skip to content

Commit

Permalink
Merge pull request #1 from go-spectest/first-pr
Browse files Browse the repository at this point in the history
First PR
  • Loading branch information
nao1215 authored Oct 21, 2023
2 parents f79596a + 0edb6bd commit 3be95b0
Show file tree
Hide file tree
Showing 15 changed files with 346 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -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.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -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.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
19 changes: 19 additions & 0 deletions .github/workflows/gosec.yml
Original file line number Diff line number Diff line change
@@ -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 ./...
30 changes: 30 additions & 0 deletions .github/workflows/linux_test.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions .github/workflows/mac_test.yml
Original file line number Diff line number Diff line change
@@ -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 ./...
23 changes: 23 additions & 0 deletions .github/workflows/multi_ver_unittest.yml
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions .github/workflows/windows_test.yml
Original file line number Diff line number Diff line change
@@ -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 ./...
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@

# Go workspace file
go.work
coverage.*
naraku
56 changes: 56 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions .octocov.yml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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}'
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/go-spectest/markdown

go 1.18
2 changes: 2 additions & 0 deletions markdown.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package markdown is markdown builder that includes to convert Markdown to HTML.
package markdown

0 comments on commit 3be95b0

Please sign in to comment.