diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7cfa7ac --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + pull_request: + branches: [main] + +jobs: + test: + name: Go Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Install gotestfmt + run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest + + - name: Run tests + run: | + go test ./cmd/... ./pkg/cli/... ./pkg/helpers/proxy/... ./pkg/helpers/routes/... \ + -json -coverprofile=coverage.out -covermode=atomic \ + 2>&1 | tee /tmp/gotest.log | gotestfmt + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + files: coverage.out + fail_ci_if_error: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index 8d8d135..a803a31 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ background doc +[![CI](https://github.com/felipegenef/gothicframework/actions/workflows/ci.yml/badge.svg)](https://github.com/felipegenef/gothicframework/actions/workflows/ci.yml) +[![codecov](https://codecov.io/gh/felipegenef/gothicframework/branch/main/graph/badge.svg)](https://codecov.io/gh/felipegenef/gothicframework) +