Merge pull request #7 from B87/fix/more-tests #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: | |
- '**' | |
jobs: | |
test-and-coverage: | |
name: Test and Upload Coverage to Codacy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.21' # Set the Go version as per your project requirement | |
- name: Test and Generate Coverage Report | |
run: | | |
mkdir -p .coverage | |
if ! go test -v -coverprofile=.coverage/cover.out ./...; then | |
echo "Test failed." | |
exit 1 | |
fi | |
- name: Codacy Coverage Reporter | |
if: success() | |
env: | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
run: | | |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report --force-coverage-parser go -r .coverage/cover.out |