-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (124 loc) · 3.71 KB
/
cql.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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
name: cql
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
permissions:
id-token: write
contents: read
checks: write
jobs:
branch-naming-rules:
name: Check branch name
runs-on: ubuntu-latest
steps:
- uses: deepakputhraya/action-branch-name@master
with:
regex: '^(feature|bugfix|improvement|library|prerelease|release|hotfix|poc)\/[a-z0-9_.-]+$'
allowed_prefixes: 'feature,bugfix,improvement,library,prerelease,release,hotfix,poc'
ignore: main,dev
min_length: 5
max_length: 50
check-style:
name: Code style
needs: [branch-naming-rules]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: '^1.18'
cache: true
- name: lint
uses: golangci/golangci-lint-action@v3
with:
skip-cache: true
skip-pkg-cache: true
skip-build-cache: true
test:
name: test
needs: [check-style]
runs-on: ubuntu-latest
strategy:
matrix:
db: [postgresql, cockroachdb, mysql, sqlite, sqlserver]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: '^1.18'
cache: true
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Start containers
run: docker compose -f "docker/${{ matrix.db }}/docker-compose.yml" up -d
if: ${{ matrix.db != 'sqlite' }}
- uses: kanga333/variable-mapper@master
id: export
with:
key: ${{ matrix.db }}
map: |
{
"postgresql": {
"dialector": "postgres"
},
"cockroachdb": {
"dialector": "postgres"
},
"mysql": {
"dialector": "mysql"
},
"sqlite": {
"dialector": "sqlite"
},
"sqlserver": {
"dialector": "sqlserver"
}
}
export_to: env
- name: Run test
run: DB=${{ env.dialector }} gotestsum --junitfile tests-${{ matrix.db }}.xml ./... -tags=${{ matrix.db }} -coverpkg=./... -coverprofile=coverage_${{ matrix.db }}.out
- name: Test Report
uses: dorny/test-reporter@v1
if: always() # run this step even if previous steps failed
with:
name: ${{ matrix.db }} Tests Report # Name of the check run which will be created
path: tests-${{ matrix.db }}.xml # Path to test results
reporter: java-junit # Format of test results
- uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage_${{ matrix.db }}.out
- name: Stop containers
if: ${{ matrix.db != 'sqlite' }}
run: docker stop cql-test-db
sonarcloud:
name: SonarCloud
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download line coverage reports
uses: actions/download-artifact@v3
with:
name: coverage
- name: Download cli line coverage report
id: download-artifact
uses: dawidd6/action-download-artifact@v3
with:
workflow: cli.yml
workflow_conclusion: success
name: coverage_cli
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}