feat: complete enhanced Makefile commands with hotfix workflow #8
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: Feature Branch CI | |
| on: | |
| push: | |
| branches: [ 'feature/*' ] | |
| pull_request: | |
| branches: [ 'develop' ] | |
| env: | |
| GO_VERSION: '1.24.0' | |
| COVERAGE_THRESHOLD: 75 | |
| jobs: | |
| validate: | |
| name: Validate Feature | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Run linter | |
| uses: golangci/golangci-lint-action@v3 | |
| with: | |
| version: latest | |
| args: --config .golangci.yml | |
| - name: Check file sizes | |
| run: make check-file-length | |
| - name: Run tests with coverage | |
| run: | | |
| go test -v -race -coverprofile=coverage.out ./... | |
| go tool cover -html=coverage.out -o coverage.html | |
| - name: Check coverage threshold | |
| run: | | |
| COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//') | |
| echo "Current coverage: ${COVERAGE}%" | |
| if (( $(echo "$COVERAGE < $COVERAGE_THRESHOLD" | bc -l) )); then | |
| echo "Coverage ${COVERAGE}% is below threshold ${COVERAGE_THRESHOLD}%" | |
| exit 1 | |
| fi | |
| echo "Coverage ${COVERAGE}% meets threshold ${COVERAGE_THRESHOLD}%" | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.out | |
| flags: feature-tests | |
| name: feature-coverage | |
| - name: Build application | |
| run: make build | |
| - name: Security scan | |
| uses: securecodewarrior/github-action-gosec@master | |
| with: | |
| args: '-no-fail -fmt sarif -out results.sarif ./...' | |
| - name: Upload security results | |
| uses: github/codeql-action/upload-sarif@v2 | |
| with: | |
| sarif_file: results.sarif | |
| if: always() | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: feature-build-${{ github.sha }} | |
| path: bin/ | |
| if: success() |