-
Notifications
You must be signed in to change notification settings - Fork 4
121 lines (95 loc) · 3.66 KB
/
Copy pathtest.yml
File metadata and controls
121 lines (95 loc) · 3.66 KB
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
name: "Test"
on:
workflow_call:
env:
GIT_CONFIG_GLOBAL: "/root/.gitconfig" # fix path in container (https://github.com/actions/runner/issues/2033)
defaults:
run:
shell: "bash"
jobs:
### LINT ###
lint:
runs-on: "ubuntu-latest"
container:
image: "ghcr.io/tarantool/sdvg-ci:0.0.2"
steps:
- uses: "actions/checkout@v4"
- name: "Run linter"
run: "golangci-lint run --print-issued-lines=false --out-format code-climate:lint.json,line-number --timeout 5m"
- uses: "actions/upload-artifact@v4"
with:
name: "codequality"
path: "lint.json"
### UNIT ###
unit:
runs-on: "ubuntu-latest"
container:
image: "ghcr.io/tarantool/sdvg-ci:0.0.2"
steps:
- uses: "actions/checkout@v4"
- name: "Run unit tests"
run: "make test/unit"
### COVER ###
cover:
runs-on: "ubuntu-latest"
container:
image: "ghcr.io/tarantool/sdvg-ci:0.0.2"
steps:
- uses: "actions/checkout@v4"
- name: "Measuring test coverage"
run: "make test/cover | tee coverage.log; exit ${PIPESTATUS[0]}"
- name: "Upload coverage to badge"
if: "${{ github.ref_name == github.event.repository.default_branch }}"
run: |
RESULT=$(grep -E 'total:\s+\(statements\)\s+[0-9]+\.[0-9]+%' coverage.log | grep -Eo '[0-9]+\.[0-9]+%' | sed 's/%/%25/g')
curl -LX PUT --header "Authorization: Bearer ${{ secrets.BADGEN_TOKEN }}" \
"https://badgen.net/memo/tarantool-sdvg-coverage-master/coverage/${RESULT}/green"
### PERFORMANCE ###
performance:
name: "performance"
runs-on: "ubuntu-latest"
env:
BENCH_MASTER_ARTIFACT_KEY: "bench-master"
BENCH_MASTER_INFO_DIR: "bench-master-info"
BENCH_MASTER_FILE_PATH: "bench-master-info/benchmark-master.txt"
BENCH_MASTER_SHA_FILE_PATH: "bench-master-info/benchmark-master-sha.txt"
container:
image: "ghcr.io/tarantool/sdvg-ci:0.0.2"
steps:
- uses: "actions/checkout@v4"
- name: "Download master benchmark artifact"
uses: "dawidd6/action-download-artifact@v11"
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
branch: "${{ github.event.repository.default_branch }}"
if_no_artifact_found: "warn"
allow_forks: false
name: "${{ env.BENCH_MASTER_ARTIFACT_KEY }}"
path: "${{ env.BENCH_MASTER_INFO_DIR }}"
- name: "Run benchmarks on current branch"
run: "make test/performance | tee benchmark.txt; exit ${PIPESTATUS[0]}"
- name: "Make comparison report"
run: |
python ./build/ci/compare_benchmarks.py \
--old-commit-sha-path "$BENCH_MASTER_SHA_FILE_PATH" \
"$BENCH_MASTER_FILE_PATH" \
benchmark.txt \
>> performance-report.md
cat performance-report.md >> $GITHUB_STEP_SUMMARY
- name: "Upload perf comparison report as artifact"
uses: "actions/upload-artifact@v4"
with:
name: "perf-report"
path: "performance-report.md"
- name: "Prepare master benchmark info for uploading as artifact"
if: "${{ github.ref_name == github.event.repository.default_branch }}"
run: |
mkdir -p ${{ env.BENCH_MASTER_INFO_DIR }}
mv benchmark.txt "${{ env.BENCH_MASTER_FILE_PATH }}"
echo "${GITHUB_SHA:0:7}" > ${{ env.BENCH_MASTER_SHA_FILE_PATH }}
- name: "Upload master benchmark artifact"
if: "${{ github.ref_name == github.event.repository.default_branch }}"
uses: "actions/upload-artifact@v4"
with:
name: "${{ env.BENCH_MASTER_ARTIFACT_KEY }}"
path: "${{ env.BENCH_MASTER_INFO_DIR }}"