Skip to content

Commit

Permalink
add unit tests to ci (#65)
Browse files Browse the repository at this point in the history
- **add unit test coverage to CI**
- **add Make target docker-test to run unit tests**
  • Loading branch information
mixmasala authored Jan 12, 2025
2 parents c9f4010 + 42f2440 commit dff70b1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
name: build
on: [push]
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [amd64]
go-version: [ "1.22.x"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: run unit tests
run: make docker-test

build_linux:
runs-on: ubuntu-22.04
steps:
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ $(cache_dir): $(cache_dir)/go
$(cache_dir)/go:
mkdir -p $(cache_dir)/go

docker-test: docker-$(distro)-base
$(docker) $(docker_run_cmd) --rm katzen/$(distro)_base \
go test -coverprofile=coverage.out -race -v -failfast -timeout 30m ./...

docker-build-linux: docker-$(distro)-base
@([ "$(distro)" = "debian" ] || [ "$(distro)" = "alpine" ]) || \
(echo "can only docker-build-linux for debian or alpine, not $(distro)" && false)
Expand Down

0 comments on commit dff70b1

Please sign in to comment.