Test: Add Go linting (gofmt) to CI

This commit is contained in:
Ralph Slooten
2025-06-21 00:11:02 +12:00
parent 1886277b6e
commit 3cacede2d7

View File

@@ -8,7 +8,7 @@ jobs:
test:
strategy:
matrix:
go-version: ['1.23']
go-version: [stable]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
@@ -17,7 +17,7 @@ jobs:
go-version: ${{ matrix.go-version }}
cache: false
- uses: actions/checkout@v4
- name: Run Go tests
- name: Set up Go environment
uses: actions/cache@v4
with:
path: |
@@ -26,11 +26,17 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go test -p 1 ./internal/storage ./server ./internal/smtpd ./internal/pop3 ./internal/tools ./internal/html2text ./internal/htmlcheck ./internal/linkcheck -v
- run: go test -p 1 ./internal/storage ./internal/html2text -bench=.
- name: Test Go linting (gofmt)
if: startsWith(matrix.os, 'ubuntu') == true
# https://olegk.dev/github-actions-and-go
run: gofmt -s -w . && git diff --exit-code
- name: Run Go tests
run: go test -p 1 ./internal/storage ./server ./internal/smtpd ./internal/pop3 ./internal/tools ./internal/html2text ./internal/htmlcheck ./internal/linkcheck -v
- name: Run Go benchmarking
run: go test -p 1 ./internal/storage ./internal/html2text -bench=.
# build the assets
- name: Build web UI
- name: Set up node environment
if: startsWith(matrix.os, 'ubuntu') == true
uses: actions/setup-node@v4
with: