Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test
on: push

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd refine this to run only on pull requests or pushes targeted to main, otherwise, every pull to every repo will trigger (too much cost and runners competing)

on:
  pull_request:
    branches: [ main ]
  push:
    branches: [ main ]
    tags:
      - 'v*.*.*'

jobs:
unit:
name: Unit tests
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.19'
- name: Checkout
uses: actions/checkout@v4
- name: Restore cache
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Run tests
run: |
git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure --prefix /usr
make
sudo make install
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig/
cd ..
Comment on lines +21 to +27

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd create a make command for that and call here. Seems like a setup that must be done in the local development as well

make test
- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ stop-deps:
test: test-services test-run

test-run:
@$(GINKGO) -r --randomizeAllSpecs --randomizeSuites --cover .
@$(MAKE) test-coverage-func
@go test -p 1 -v -cover -coverprofile=coverage.out ./...

test-coverage-func:
@mkdir -p _build
Expand Down
2 changes: 1 addition & 1 deletion config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ workers:
port: 6333
db: 0
pass:
tlsEnabled: true
tlsEnabled: false
topicTemplate: "%s-%s-c"
feedbackListener:
flushInterval: 5000
Expand Down
1 change: 1 addition & 0 deletions config/test-faulty-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ workers:
port: 6333
db: 0
pass:
tlsEnabled: false
topicTemplate: "%s-%s-c"
feedbackListener:
flushInterval: 5000
Expand Down
1 change: 1 addition & 0 deletions config/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ workers:
port: 6333
db: 0
pass:
tlsEnabled: false
topicTemplate: "%s-%s-c"
feedbackListener:
flushInterval: 5000
Expand Down