Skip to content

Commit 5f445aa

Browse files
committed
update workflow
1 parent db35f55 commit 5f445aa

2 files changed

Lines changed: 51 additions & 12 deletions

File tree

.github/workflows/tests.yml

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,60 @@
11
name: Tests
2-
on: [push]
3-
jobs:
42

5-
tests-on:
6-
name: ${{matrix.go-version}} ${{matrix.os}}
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
test:
11+
name: Test Go ${{matrix.go-version}} on ${{matrix.os}}
712
runs-on: ${{ matrix.os }}
813
strategy:
914
matrix:
10-
go-version: [1.24.x]
11-
os: [macos-latest, ubuntu-latest]
15+
go-version: ['1.24.x']
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
1218
steps:
13-
- name: Checkout Code
14-
uses: actions/checkout@v1
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
1524
with:
16-
fetch-depth: 1
17-
- name: Test
25+
go-version: ${{ matrix.go-version }}
26+
cache-dependency-path: go.sum
27+
28+
- name: Verify Go version
29+
run: go version
30+
31+
- name: Download dependencies
32+
run: go mod download
33+
34+
- name: Verify dependencies
35+
run: go mod verify
36+
37+
- name: Run tests
38+
run: go test -race -coverprofile=coverage.out ./...
39+
40+
- name: Check formatting
1841
run: |
19-
go mod tidy -v
20-
go test -race ./...
42+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
43+
echo "Code is not formatted. Please run 'gofmt -s -w .'"
44+
gofmt -s -l .
45+
exit 1
46+
fi
47+
if: runner.os != 'Windows'
48+
49+
- name: Run go vet
50+
run: go vet ./...
51+
52+
- name: Upload coverage to Codecov
53+
uses: codecov/codecov-action@v4
54+
with:
55+
file: ./coverage.out
56+
flags: unittests
57+
name: codecov-umbrella
58+
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.24.x'
2159

2260

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 🎯 Remark - Advanced Markdown Processing & HTML Generation
22

33
[![Tests](https://github.com/gopherguides/remark/workflows/Tests/badge.svg)](https://github.com/gopherguides/remark/actions)
4+
[![codecov](https://codecov.io/gh/gopherguides/remark/branch/main/graph/badge.svg)](https://codecov.io/gh/gopherguides/remark)
45
[![GoDoc](https://godoc.org/github.com/gopherguides/remark?status.svg)](https://godoc.org/github.com/gopherguides/remark)
56
[![Go Report Card](https://goreportcard.com/badge/github.com/gopherguides/remark)](https://goreportcard.com/report/github.com/gopherguides/remark)
67

0 commit comments

Comments
 (0)