Update github actions #21
Workflow file for this run
This file contains hidden or 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: quality-gate | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| permissions: read-all | |
| jobs: | |
| # ========================================== | |
| # Formatting and linting | |
| # ========================================== | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache-dependency-path: 'go.sum' | |
| - name: formatting | |
| run: | | |
| fmt=$(gofmt -l .) | |
| if [ -n "$fmt" ]; then | |
| echo "$fmt" | |
| exit 1 | |
| fi | |
| - name: static-check | |
| run: go vet ./... | |
| # ========================================== | |
| # TEST & COVERAGE | |
| # ========================================== | |
| test-and-coverage: | |
| runs-on: ubuntu-latest | |
| needs: [lint] | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache-dependency-path: 'go.sum' | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Run Tests & Generate Coverage | |
| run: make coverage-ci | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.txt |