mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
Add code quality checks that run before tests: - gofmt formatting verification - golangci-lint static analysis
46 lines
938 B
YAML
46 lines
938 B
YAML
name: Test
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: 1.25
|
|
|
|
- name: Check formatting
|
|
run: |
|
|
if [ -n "$(gofmt -l .)" ]; then
|
|
echo "The following files are not formatted correctly:"
|
|
gofmt -l .
|
|
exit 1
|
|
fi
|
|
|
|
- name: Run golangci-lint
|
|
uses: golangci/golangci-lint-action@v6
|
|
with:
|
|
version: latest
|
|
|
|
- name: Run tests
|
|
run: go test -v ./...
|
|
|
|
- name: Run tests with race detector
|
|
run: go test -race ./...
|
|
|
|
- name: Generate coverage
|
|
run: go test -coverprofile=coverage.out ./...
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
files: ./coverage.out
|
|
flags: unittests
|
|
name: codecov-umbrella
|
|
continue-on-error: true
|