-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (68 loc) · 1.89 KB
/
tests.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Tests
on:
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
- name: fmt
run: |
check=$(go fmt)
if [["${check}" -ne ""]]; then
exit 1
fi
unittests:
name: go_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
- uses: mirromutth/[email protected]
with:
host port: 3306
container port: 3306
mysql database: 'cosmoappy'
mysql root password: 'root'
mysql user: 'root'
mysql password: 'root'
- name: run tests
env:
TOKEN_API_TEST: "test"
PASS_DB: "root"
run: |
go test ./... -covermode=count -coverprofile ./coverage.out
- name: coverage
run: |
total_cov=$(go tool cover -func ./coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+')
if [[ "$total_cov" < 80.0 ]]; then
echo "not enought tests"
echo "::warning title=not enought tests::${total_cov}%"
#exit 1
fi
configlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: yaml-lint
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: conf
config_data: "{extends: default, rules: {line-length: disable}}"
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]