Merge pull request #5 from nunenuh/dev #32
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: CodeCoverage Action | |
on: | |
push: | |
branches: [ "main", "stag", "dev" ] | |
pull_request: | |
branches: [ "main", "stag", "dev" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: 'bitnami/postgresql:14.8.0' | |
env: | |
POSTGRES_USER: testuser | |
POSTGRES_PASSWORD: testpass | |
POSTGRES_DB: iquote_fastapi | |
ports: | |
- 5432:5432 | |
# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.21' # Adjust to your desired Go version | |
- name: Install dependencies | |
run: make deps | |
- name: Test with Go Test | |
run: make test | |
- name: Test with Go Test with Coverage | |
run: make test-coverage | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
files: coverage.out | |
fail_ci_if_error: true # optional (default = false) |