Skip to content

Commit

Permalink
ci: add Github Actions test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mdawar committed Aug 11, 2024
1 parent 97b1d25 commit 7dcde77
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Tests

on:
push:
branches: ['main']
pull_request:
branches: ['main']

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.22']

steps:
- uses: actions/checkout@v4

- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: Install dependencies
run: go get .

- name: Test
run: make test
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
go test -race -cover -count 1
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# pubsub

[![Tests](https://github.com/mdawar/pubsub/actions/workflows/test.yml/badge.svg?branch=main&event=push)](https://github.com/mdawar/pubsub/actions)

`pubsub` is a simple and generic **topic-based** **publish/subscribe** library for in-process communication in **Go**.

## Installation
Expand Down Expand Up @@ -115,3 +117,13 @@ topicsCount := broker.NumTopics()
// Get the subscribers count on a specific topic.
count := broker.Subs("events")
```

## Tests

```sh
go test -race -cover
# If you have "just" installed.
just test
# Or using make.
make test
```

0 comments on commit 7dcde77

Please sign in to comment.