Skip to content

Commit

Permalink
enable ci checks
Browse files Browse the repository at this point in the history
  • Loading branch information
quasilyte committed Sep 20, 2023
1 parent f09a6a6 commit 9f2f557
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 110 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file adheres to the YAML5 style.
{
"name": "Go",
"on": ["push", "pull_request"],
"jobs": {
"build": {
"name": "Build",
"runs-on": "ubuntu-latest",
"steps": [
{
"name": "Set up Go 1.20",
"uses": "actions/setup-go@v1",
"with": {"go-version": 1.20},
"id": "go",
},
{"name": "Check out code into the Go module directory", "uses": "actions/checkout@v1"},
{"name": "Linter", "run": "make ci-lint"},
{"name": "Test", "run": "make test"},
],
},
},
}
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
GOPATH_DIR=`go env GOPATH`

test:
go test -count 2 ./...
go test -run=__ -bench=. ./...
cd _bench && go test -v -bench=. .
@echo "everything is OK"

ci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH_DIR)/bin v1.54.2
$(GOPATH_DIR)/bin/golangci-lint run ./...
@echo "everything is OK"

lint:
golangci-lint run ./...
@echo "everything is OK"

.PHONY: ci-lint lint test
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# quasilyte/pathing

![Build Status](https://github.com/quasilyte/pathing/workflows/Go/badge.svg)
[![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/quasilyte/pathing)](https://pkg.go.dev/mod/github.com/quasilyte/pathing)

A very fast & zero-allocation, grid-based, pathfinding library for Go.

## Overview
Expand Down
14 changes: 8 additions & 6 deletions _bench/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ module github.com/quasilyte/pathing/_bench
go 1.21

require (
github.com/beefsack/go-astar v0.0.0-20200827232313-4ecf9e304482 // indirect
github.com/fzipp/astar v0.2.0 // indirect
github.com/quasilyte/gmath v0.0.0-20230723114625-7e8674b9f7b8 // indirect
github.com/quasilyte/pathing v0.0.0-20230915100554-44e61adb82ec // indirect
github.com/beefsack/go-astar v0.0.0-20200827232313-4ecf9e304482
github.com/fzipp/astar v0.2.0
github.com/quasilyte/pathing v0.0.0-20230920175739-f09a6a6e624b
github.com/s0rg/grid v1.4.0
github.com/solarlune/paths v0.0.0-20230130082802-0494358a2ca6
)

require (
github.com/s0rg/array2d v1.1.1 // indirect
github.com/s0rg/grid v1.4.0 // indirect
github.com/s0rg/set v1.0.1 // indirect
github.com/s0rg/vec2d v1.1.1 // indirect
github.com/segmentio/fasthash v1.0.3 // indirect
github.com/solarlune/paths v0.0.0-20230130082802-0494358a2ca6 // indirect
github.com/zyedidia/generic v1.2.1 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
)
6 changes: 2 additions & 4 deletions _bench/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ github.com/beefsack/go-astar v0.0.0-20200827232313-4ecf9e304482 h1:p4g4uok3+r6Tg
github.com/beefsack/go-astar v0.0.0-20200827232313-4ecf9e304482/go.mod h1:Cu3t5VeqE8kXjUBeNXWQprfuaP5UCIc5ggGjgMx9KFc=
github.com/fzipp/astar v0.2.0 h1:vEmeszAm62kB02Qh/oXQNrVR8p6G00WAJIkVRJYzekc=
github.com/fzipp/astar v0.2.0/go.mod h1:1zYE8kcTMuS0g+b9Vh9lfR7t0MleOH6EneyA3esiLEc=
github.com/quasilyte/gmath v0.0.0-20230723114625-7e8674b9f7b8 h1:sn3OqS/7OZBPrhEhhtEp8nHdatc/RNODsEHNxNRpyz8=
github.com/quasilyte/gmath v0.0.0-20230723114625-7e8674b9f7b8/go.mod h1:EbI+KMbALSVE2s0YFOQpR4uj66zBh9ter5P4CBMSuvA=
github.com/quasilyte/pathing v0.0.0-20230915100554-44e61adb82ec h1:0xEwQZ0CihQ5OPd/UvlUj6k4KjdN2S9A71lxSg/uzT4=
github.com/quasilyte/pathing v0.0.0-20230915100554-44e61adb82ec/go.mod h1:ixjYf4Sk6dLp/SekkpGSqvSkODKfuZOwwi0nPR0AMTw=
github.com/quasilyte/pathing v0.0.0-20230920175739-f09a6a6e624b h1:FC97/sIYUluRLue9kB0epP788FN4Lc7B/QrbzlN+JQg=
github.com/quasilyte/pathing v0.0.0-20230920175739-f09a6a6e624b/go.mod h1:ixjYf4Sk6dLp/SekkpGSqvSkODKfuZOwwi0nPR0AMTw=
github.com/s0rg/array2d v1.1.1 h1:fPZDbolqx9P0gCaD9yFTZT0TcWa6o/gK4t0YnGRpp/0=
github.com/s0rg/array2d v1.1.1/go.mod h1:XUVXpxRB1bSnngbrTAyfEcLl6GP+8OpyFLEkwvQOukI=
github.com/s0rg/grid v1.4.0 h1:h/sx1d3PBV4VEXRbbxrJu7D6119mJn2JGTV6FWpPt6c=
Expand Down
11 changes: 7 additions & 4 deletions _bench/quasilyte_pathing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/quasilyte/pathing"
)

var pathingLayer = pathing.MakeGridLayer(1, 0, 0, 0)
var pathingLayer = pathing.MakeGridLayer([4]uint8{1, 0, 0, 0})

type quasilytePathingTester struct {
tc *testCase
Expand All @@ -20,9 +20,12 @@ func newQuasilytePathingTester() *quasilytePathingTester {
func (t *quasilytePathingTester) Init(tc *testCase) {
t.tc = tc
t.bfs = pathing.NewGreedyBFS(tc.numCols, tc.numRows)
width := float64(tc.cellWidth) * float64(tc.numCols)
height := float64(tc.cellHeight) * float64(tc.numRows)
t.grid = pathing.NewGrid(width, height, 0)
width := tc.cellWidth * tc.numCols
height := tc.cellHeight * tc.numRows
t.grid = pathing.NewGrid(pathing.GridConfig{
WorldWidth: uint(width),
WorldHeight: uint(height),
})
}

func (t *quasilytePathingTester) BuildPath() (pathing.GridPath, gridCoord) {
Expand Down
2 changes: 1 addition & 1 deletion example_detailed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/quasilyte/pathing"
)

func ExampleDetailed() {
func Example() {
// Grid is a "map" that stores cell info.
const cellSize = 40
g := pathing.NewGrid(pathing.GridConfig{
Expand Down
94 changes: 0 additions & 94 deletions example_quickstart_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/quasilyte/pathing

go 1.21
go 1.20

0 comments on commit 9f2f557

Please sign in to comment.