-
Notifications
You must be signed in to change notification settings - Fork 10
49 lines (49 loc) · 1.71 KB
/
ci.yml
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
name: CI Flow
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Compile Action
run: go build -v ./...
unit-testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Run Unit Test with Racecondition Detector
run: go test -race ./...
- name: Run Unit Tests with Coverage
run: go test -coverprofile=coverage.txt -covermode=atomic -v ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage.txt
flags: unit-tests
name: codecov-action
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false