-
Notifications
You must be signed in to change notification settings - Fork 3
116 lines (98 loc) · 2.79 KB
/
test.yml
File metadata and controls
116 lines (98 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Tests
# Testing Strategy:
# - Tests run on Linux, macOS, and Windows (cross-platform library)
# - HDF5 is a cross-platform file format - must work everywhere
# - Go 1.25+ required (matches go.mod requirement)
#
# Branch Strategy (GitHub Flow):
# - feature/** branches: Development work
# - fix/** branches: Bug fixes
# - release/** branches: Pre-release testing
# - main branch: Production-ready code only (protected)
# - Pull requests: Must pass all tests before merge (--squash)
on:
push:
branches:
- main
- 'feature/**'
- 'fix/**'
- 'release/**'
pull_request:
branches:
- main
jobs:
# Unit tests - Cross-platform
unit-tests:
name: Unit Tests - ${{ matrix.os }} - Go ${{ matrix.go-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ['1.25'] # Match go.mod requirement
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Run go vet
if: matrix.os == 'ubuntu-latest'
run: go vet ./...
- name: Run unit tests with race detector
shell: bash
run: go test -short -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.25'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.txt
flags: unittests
name: codecov-unit
fail_ci_if_error: false
verbose: true
lint:
name: Lint
runs-on: ubuntu-latest
continue-on-error: false # Strict for production library
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: latest
args: --timeout=5m
# Formatting check
formatting:
name: Code Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: Check formatting
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "ERROR: The following files are not formatted:"
gofmt -l .
echo ""
echo "Run 'go fmt ./...' to fix formatting issues."
exit 1
fi
echo "All files are properly formatted ✓"