From 367f38063b863d4c155b3cebac0b30104c455a6b Mon Sep 17 00:00:00 2001 From: srdtrk Date: Fri, 9 Feb 2024 22:46:54 +0100 Subject: [PATCH] ci: added unit tests to ci --- .github/workflows/build.yml | 2 +- .github/workflows/unit-test.yml | 20 ++++++++++++++++++++ Makefile | 7 +++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/unit-test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53640bb..e6965b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: permissions: contents: read jobs: - interceptor: + build: name: Build runs-on: ubuntu-latest steps: diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 0000000..f573590 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,20 @@ +name: unit-test +on: + push: + branches: [main] + pull_request: + paths: + - '**.go' +permissions: + contents: read +jobs: + test: + name: Unit Test go-codegen + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v4 + with: + go-version: "1.21" + - uses: actions/checkout@v4 + - name: Unit Test go-codegen + run: make unit-test diff --git a/Makefile b/Makefile index 9904073..6939ed8 100644 --- a/Makefile +++ b/Makefile @@ -9,3 +9,10 @@ build: @echo "Building go-codegen..." @go build -o $(BUILD_DIR)/go-codegen main.go @echo "Build complete!" + +.PHONY: unit-test + +unit-test: + @echo "Running unit tests..." + @go test -v -mod=readonly ./... + @echo "Unit tests complete!"