mirror of
https://github.com/MedUnes/go-kata.git
synced 2026-03-12 21:55:53 +07:00
76 lines
2.0 KiB
YAML
76 lines
2.0 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: go.mod
|
|
check-latest: true
|
|
- name: Check Go formatting
|
|
run: |
|
|
UNFORMATTED_FILES=$(gofmt -l .)
|
|
if [ -n "$UNFORMATTED_FILES" ]; then
|
|
echo "::error::The following files are not formatted correctly:"
|
|
echo "$UNFORMATTED_FILES"
|
|
gofmt -d
|
|
exit 1
|
|
fi
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
os: [ ubuntu-latest, macos-latest ]
|
|
go: [ 1.25 ]
|
|
include:
|
|
- os: ubuntu-latest
|
|
go-build: ~/.cache/go-build
|
|
- os: macos-latest
|
|
go-build: /Users/runner/Library/Caches/go-build
|
|
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOPROXY: https://proxy.golang.org
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go }}
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
|
|
- uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
${{ matrix.go-build }}
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
- name: Tests
|
|
run: |
|
|
go run gotest.tools/gotestsum@latest --format=testdox -- -covermode=atomic -coverprofile=coverage.txt ./...
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
flags: ${{ matrix.os }},go-${{ matrix.go }}
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
slug: medunes/go-kata |