Skip to content

Commit 5de3d47

Browse files
authored
Add message filtering option to reduce cardinality of dynamic parts (#9)
1 parent 6780980 commit 5de3d47

20 files changed

+458
-178
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
If feasible/relevant, please provide a code snippet (inline or with Go playground) to reproduce the issue.
15+
16+
17+
**Expected behavior**
18+
A clear and concise description of what you expected to happen.
19+
20+
**Additional context**
21+
Add any other context about the problem here.
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
Please use discussions https://github.com/bool64/logz/discussions/categories/ideas to share feature ideas.

.github/ISSUE_TEMPLATE/question.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Question
3+
about: Any question about features or usage
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
Please use discussions https://github.com/bool64/logz/discussions/categories/q-a to make your question more discoverable by other folks.

.github/workflows/bench.yml

+58-33
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,43 @@ on:
1212
description: 'New Ref'
1313
required: true
1414

15+
# Cancel the workflow in progress in newer build is about to start.
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
1520
env:
1621
GO111MODULE: "on"
1722
CACHE_BENCHMARK: "off" # Enables benchmark result reuse between runs, may skew latency results.
1823
RUN_BASE_BENCHMARK: "on" # Runs benchmark for PR base in case benchmark result is missing.
24+
GO_VERSION: 1.20.x
1925
jobs:
2026
bench:
21-
strategy:
22-
matrix:
23-
go-version: [ 1.17.x ]
2427
runs-on: ubuntu-latest
2528
steps:
26-
- name: Install Go
27-
uses: actions/setup-go@v2
29+
- name: Install Go stable
30+
if: env.GO_VERSION != 'tip'
31+
uses: actions/setup-go@v4
2832
with:
29-
go-version: ${{ matrix.go-version }}
33+
go-version: ${{ env.GO_VERSION }}
34+
35+
- name: Install Go tip
36+
if: env.GO_VERSION == 'tip'
37+
run: |
38+
curl -sL https://storage.googleapis.com/go-build-snap/go/linux-amd64/$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1;}').tar.gz -o gotip.tar.gz
39+
ls -lah gotip.tar.gz
40+
mkdir -p ~/sdk/gotip
41+
tar -C ~/sdk/gotip -xzf gotip.tar.gz
42+
~/sdk/gotip/bin/go version
43+
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV
44+
3045
- name: Checkout code
31-
uses: actions/checkout@v2
46+
uses: actions/checkout@v3
3247
with:
3348
ref: ${{ (github.event.inputs.new != '') && github.event.inputs.new || github.event.ref }}
49+
3450
- name: Go cache
35-
uses: actions/cache@v2
51+
uses: actions/cache@v3
3652
with:
3753
# In order:
3854
# * Module download cache
@@ -43,49 +59,58 @@ jobs:
4359
key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }}
4460
restore-keys: |
4561
${{ runner.os }}-go-cache
62+
4663
- name: Restore benchstat
47-
uses: actions/cache@v2
64+
uses: actions/cache@v3
4865
with:
4966
path: ~/go/bin/benchstat
50-
key: ${{ runner.os }}-benchstat
67+
key: ${{ runner.os }}-benchstat-legacy
68+
5169
- name: Restore base benchmark result
70+
id: base-benchmark
5271
if: env.CACHE_BENCHMARK == 'on'
53-
id: benchmark-base
54-
uses: actions/cache@v2
72+
uses: actions/cache@v3
5573
with:
5674
path: |
5775
bench-master.txt
5876
bench-main.txt
5977
# Use base sha for PR or new commit hash for master/main push in benchmark result key.
6078
key: ${{ runner.os }}-bench-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }}
61-
- name: Checkout base code
62-
if: env.RUN_BASE_BENCHMARK == 'on' && steps.benchmark-base.outputs.cache-hit != 'true' && (github.event.pull_request.base.sha != '' || github.event.inputs.old != '')
63-
uses: actions/checkout@v2
64-
with:
65-
ref: ${{ (github.event.pull_request.base.sha != '' ) && github.event.pull_request.base.sha || github.event.inputs.old }}
66-
path: __base
67-
- name: Run base benchmark
68-
if: env.RUN_BASE_BENCHMARK == 'on' && steps.benchmark-base.outputs.cache-hit != 'true' && (github.event.pull_request.base.sha != '' || github.event.inputs.old != '')
79+
80+
- name: Run benchmark
81+
run: |
82+
export REF_NAME=new
83+
make bench
84+
OUTPUT=$(make bench-stat-diff)
85+
echo "${OUTPUT}"
86+
echo "diff<<EOF" >> $GITHUB_OUTPUT && echo "$OUTPUT" >> $GITHUB_OUTPUT && echo "EOF" >> $GITHUB_OUTPUT
87+
OUTPUT=$(make bench-stat)
88+
echo "${OUTPUT}"
89+
echo "result<<EOF" >> $GITHUB_OUTPUT && echo "$OUTPUT" >> $GITHUB_OUTPUT && echo "EOF" >> $GITHUB_OUTPUT
90+
91+
- name: Run benchmark for base code
92+
if: env.RUN_BASE_BENCHMARK == 'on' && steps.base-benchmark.outputs.cache-hit != 'true' && (github.event.pull_request.base.sha != '' || github.event.inputs.old != '')
6993
run: |
94+
git fetch origin master ${{ github.event.pull_request.base.sha }}
95+
HEAD=$(git rev-parse HEAD)
96+
git reset --hard ${{ github.event.pull_request.base.sha }}
7097
export REF_NAME=master
71-
cd __base
72-
make | grep bench-run && (BENCH_COUNT=5 make bench-run bench-stat && cp bench-master.txt ../bench-master.txt) || echo "No benchmarks in base"
73-
- name: Benchmark
98+
make bench-run bench-stat
99+
git reset --hard $HEAD
100+
101+
- name: Benchmark stats
74102
id: bench
75103
run: |
76104
export REF_NAME=new
77-
BENCH_COUNT=5 make bench
78105
OUTPUT=$(make bench-stat-diff)
79-
OUTPUT="${OUTPUT//'%'/'%25'}"
80-
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
81-
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
82-
echo "::set-output name=diff::$OUTPUT"
106+
echo "${OUTPUT}"
107+
echo "diff<<EOF" >> $GITHUB_OUTPUT && echo "$OUTPUT" >> $GITHUB_OUTPUT && echo "EOF" >> $GITHUB_OUTPUT
83108
OUTPUT=$(make bench-stat)
84-
OUTPUT="${OUTPUT//'%'/'%25'}"
85-
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
86-
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
87-
echo "::set-output name=result::$OUTPUT"
88-
- name: Comment Benchmark Result
109+
echo "${OUTPUT}"
110+
echo "result<<EOF" >> $GITHUB_OUTPUT && echo "$OUTPUT" >> $GITHUB_OUTPUT && echo "EOF" >> $GITHUB_OUTPUT
111+
112+
- name: Comment benchmark result
113+
continue-on-error: true
89114
uses: marocchino/sticky-pull-request-comment@v2
90115
with:
91116
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/cloc.yml

+16-9
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,37 @@
22
name: cloc
33
on:
44
pull_request:
5+
6+
# Cancel the workflow in progress in newer build is about to start.
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
511
jobs:
612
cloc:
713
runs-on: ubuntu-latest
814
steps:
915
- name: Checkout code
10-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1117
with:
1218
path: pr
1319
- name: Checkout base code
14-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
1521
with:
1622
ref: ${{ github.event.pull_request.base.sha }}
1723
path: base
18-
- name: Count Lines Of Code
24+
- name: Count lines of code
1925
id: loc
2026
run: |
21-
curl -OL https://github.com/vearutop/sccdiff/releases/download/v1.0.1/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz
27+
curl -sLO https://github.com/vearutop/sccdiff/releases/download/v1.0.3/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz
28+
sccdiff_hash=$(git hash-object ./sccdiff)
29+
[ "$sccdiff_hash" == "ae8a07b687bd3dba60861584efe724351aa7ff63" ] || (echo "::error::unexpected hash for sccdiff, possible tampering: $sccdiff_hash" && exit 1)
2230
OUTPUT=$(cd pr && ../sccdiff -basedir ../base)
23-
OUTPUT="${OUTPUT//'%'/'%25'}"
24-
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
25-
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
26-
echo "::set-output name=diff::$OUTPUT"
31+
echo "${OUTPUT}"
32+
echo "diff<<EOF" >> $GITHUB_OUTPUT && echo "$OUTPUT" >> $GITHUB_OUTPUT && echo "EOF" >> $GITHUB_OUTPUT
2733
28-
- name: Comment Code Lines
34+
- name: Comment lines of code
35+
continue-on-error: true
2936
uses: marocchino/sticky-pull-request-comment@v2
3037
with:
3138
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/golangci-lint.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,26 @@ on:
88
- master
99
- main
1010
pull_request:
11+
12+
# Cancel the workflow in progress in newer build is about to start.
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
1117
jobs:
1218
golangci:
1319
name: golangci-lint
1420
runs-on: ubuntu-latest
1521
steps:
22+
- uses: actions/setup-go@v3
23+
with:
24+
go-version: 1.20.x
1625
- uses: actions/checkout@v2
1726
- name: golangci-lint
18-
uses: golangci/golangci-lint-action@v2.5.2
27+
uses: golangci/golangci-lint-action@v3.4.0
1928
with:
2029
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
21-
version: v1.41.1
30+
version: v1.51.1
2231

2332
# Optional: working directory, useful for monorepos
2433
# working-directory: somedir

.github/workflows/gorelease.yml

+29-18
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,54 @@
22
name: gorelease
33
on:
44
pull_request:
5+
6+
# Cancel the workflow in progress in newer build is about to start.
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
511
env:
6-
GO111MODULE: "on"
12+
GO_VERSION: 1.20.x
713
jobs:
814
gorelease:
9-
strategy:
10-
matrix:
11-
go-version: [ 1.17.x ]
1215
runs-on: ubuntu-latest
1316
steps:
14-
- name: Install Go
15-
uses: actions/setup-go@v2
17+
- name: Install Go stable
18+
if: env.GO_VERSION != 'tip'
19+
uses: actions/setup-go@v4
1620
with:
17-
go-version: ${{ matrix.go-version }}
21+
go-version: ${{ env.GO_VERSION }}
22+
- name: Install Go tip
23+
if: env.GO_VERSION == 'tip'
24+
run: |
25+
curl -sL https://storage.googleapis.com/go-build-snap/go/linux-amd64/$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1;}').tar.gz -o gotip.tar.gz
26+
ls -lah gotip.tar.gz
27+
mkdir -p ~/sdk/gotip
28+
tar -C ~/sdk/gotip -xzf gotip.tar.gz
29+
~/sdk/gotip/bin/go version
30+
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV
1831
- name: Checkout code
19-
uses: actions/checkout@v2
32+
uses: actions/checkout@v3
2033
- name: Gorelease cache
21-
uses: actions/cache@v2
34+
uses: actions/cache@v3
2235
with:
2336
path: |
2437
~/go/bin/gorelease
25-
key: ${{ runner.os }}-gorelease
38+
key: ${{ runner.os }}-gorelease-generic
2639
- name: Gorelease
2740
id: gorelease
2841
run: |
2942
test -e ~/go/bin/gorelease || go install golang.org/x/exp/cmd/gorelease@latest
30-
OUTPUT=$(gorelease || exit 0)
31-
OUTPUT="${OUTPUT//'%'/'%25'}"
32-
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
33-
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
34-
echo "::set-output name=report::$OUTPUT"
35-
- name: Comment Report
43+
OUTPUT=$(gorelease 2>&1 || exit 0)
44+
echo "${OUTPUT}"
45+
echo "report<<EOF" >> $GITHUB_OUTPUT && echo "$OUTPUT" >> $GITHUB_OUTPUT && echo "EOF" >> $GITHUB_OUTPUT
46+
- name: Comment report
47+
continue-on-error: true
3648
uses: marocchino/sticky-pull-request-comment@v2
3749
with:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3950
header: gorelease
4051
message: |
41-
### API Changes
52+
### Go API Changes
4253
4354
<pre>
4455
${{ steps.gorelease.outputs.report }}

0 commit comments

Comments
 (0)