Skip to content

Commit

Permalink
add github actions for lint & test (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
sivukhin authored Feb 12, 2024
1 parent e185452 commit 09feeec
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 3 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "tests"

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with: { version: latest }

test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Print system information
run: cat /proc/{meminfo,cpuinfo}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install dependencies
run: go get .
- name: Build
run: go build -v ./...
- name: Test with the Go CLI
run: TEST_FORMAT=github-actions make test

18 changes: 18 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
run:
go: '1.22'
linters:
enable:
- govet
- typecheck
- unused
- gofmt
- whitespace
- gosimple
- exportloopref
- nilerr
- goimports
- staticcheck
- ineffassign
- errcheck
disable:
- depguard
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.PHONY: test lint

TEST_FORMAT ?= standard-quiet
LINT_FORMAT ?= colored-line-number

all: test lint

test:
go install gotest.tools/gotestsum@latest
gotestsum --format $(TEST_FORMAT) -- -tags=test ./...
lint:
golangci-lint run --out-format $(LINT_FORMAT) --verbose
2 changes: 1 addition & 1 deletion djot_parser/djot_ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ type QuoteDirection int

const (
OpenQuote QuoteDirection = +1
CloseQuote = -1
CloseQuote QuoteDirection = -1
)

func detectQuoteDirection(document []byte, position int) QuoteDirection {
Expand Down
1 change: 0 additions & 1 deletion djot_tokenizer/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func MatchQuotedString(r tokenizer.TextReader, s tokenizer.ReaderState) ([]byte,
tokenizer.Assertf(ok, "MaskRepeat must match because minCount is zero")

value = append(value, r[start:next]...)
start = next
if endString, ok := r.Token(next, "\""); ok {
return value, endString, true
} else if escape, ok := r.Token(next, "\\"); ok {
Expand Down
3 changes: 2 additions & 1 deletion tokenizer/line_tokenizer_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package tokenizer

import (
"github.com/stretchr/testify/require"
"testing"

"github.com/stretchr/testify/require"
)

func TestLineTokenizer(t *testing.T) {
Expand Down

0 comments on commit 09feeec

Please sign in to comment.