-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (42 loc) · 1.23 KB
/
test.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
name: Test
on:
pull_request:
types: [opened, synchronize, edited, reopened]
push:
branches:
- main
workflow_call:
env:
GO_VERSION: 1.21.1
jobs:
test-unit-coverage:
name: Unit & Coverage
runs-on: namespace-profile-linux-4vcpu-8gb-cached
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
## skip cache, use Namespace volume cache
cache: false
- name: Init Dummy Git config for testing
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-action"
- name: Setup Namespace cache
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: go
- name: Run unit tests with coverage
shell: 'script -q -e -c "bash {0}"'
run: make test-coverage
- name: Upload coverage to Codecov
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true
directory: "./"