fixed https://git.miaurizius.de/MiauRizius/MiauInv/issues/10 #11
@@ -1,30 +1,33 @@
|
|||||||
name: Code Quality and Testing
|
name: test-and-lint
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: [ main, 'feature/**', 'bugfix/**', 'chore/**', 'refactor/**' ]
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-and-lint:
|
test-and-lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: go-1.26
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Check formatting
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '1.22'
|
|
||||||
|
|
||||||
- name: Check Go Formatting (gofmt)
|
|
||||||
run: |
|
run: |
|
||||||
if [ -n "$(gofmt -l .)" ]; then
|
files="$(gofmt -l .)"
|
||||||
echo "The following files are not properly formatted. Please run 'gofmt -w .'"
|
if [ -n "$files" ]; then
|
||||||
gofmt -l .
|
echo "$files"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Run Unit Tests
|
- name: Check modules
|
||||||
run: go test -v ./...
|
run: |
|
||||||
|
go mod tidy
|
||||||
|
git diff --exit-code go.mod go.sum
|
||||||
|
|
||||||
|
- name: Vet
|
||||||
|
run: go vet ./...
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: go test ./...
|
||||||
Reference in New Issue
Block a user