diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dba5e89..d4fb019 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,3 +21,25 @@ jobs: - name: Audit code run: | make audit + + test: + name: Test + needs: qualitycheck + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + check-latest: true + - name: Run tests + run: make test + - name: Generate coverage report + run: make test/cover + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: vwhitteron/gt-telemetry \ No newline at end of file diff --git a/.gitignore b/.gitignore index bc22b1f..e0d41a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,8 @@ +# MacOS hidden files .DS_Store + +# Build files examples/bin/ + +# Coverage reports +*.out \ No newline at end of file diff --git a/Makefile b/Makefile index f7ff800..b05685c 100644 --- a/Makefile +++ b/Makefile @@ -60,8 +60,12 @@ test: ## test/cover: run all tests and display coverage .PHONY: test/cover test/cover: - go test -v -race -buildvcs -coverprofile=/tmp/coverage.out ./... - go tool cover -html=/tmp/coverage.out + go test -v -race -buildvcs -coverprofile=coverage.out ./... + +## test/cover/show: run all tests and display coverage in a browser +.PHONY: test/cover/show +test/cover/show: test/cover + go tool cover -html=coverage.out ## kaitai: compile the GT telemetry package from the Kaitai Struct .PHONY: build/kaitai @@ -106,4 +110,5 @@ run/live: .PHONY: clean clean: @go clean - @rm -rf examples/bin \ No newline at end of file + @rm -rf examples/bin + @rm -f coverage.out \ No newline at end of file