Skip to content

Commit e360dd3

Browse files
authored
Update deps and CI (#220)
1 parent 3750021 commit e360dd3

File tree

12 files changed

+75
-116
lines changed

12 files changed

+75
-116
lines changed

.github/workflows/bench.yml

Lines changed: 33 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,27 @@ 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-
2015
env:
2116
GO111MODULE: "on"
2217
CACHE_BENCHMARK: "off" # Enables benchmark result reuse between runs, may skew latency results.
2318
RUN_BASE_BENCHMARK: "on" # Runs benchmark for PR base in case benchmark result is missing.
24-
GO_VERSION: 1.23.x
2519
jobs:
2620
bench:
21+
strategy:
22+
matrix:
23+
go-version: [ stable ]
2724
runs-on: ubuntu-latest
2825
steps:
29-
- name: Install Go stable
30-
if: env.GO_VERSION != 'tip'
31-
uses: actions/setup-go@v4
26+
- name: Install Go
27+
uses: actions/setup-go@v5
3228
with:
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-
29+
go-version: ${{ matrix.go-version }}
4530
- name: Checkout code
46-
uses: actions/checkout@v3
31+
uses: actions/checkout@v4
4732
with:
4833
ref: ${{ (github.event.inputs.new != '') && github.event.inputs.new || github.event.ref }}
49-
5034
- name: Go cache
51-
uses: actions/cache@v3
35+
uses: actions/cache@v4
5236
with:
5337
# In order:
5438
# * Module download cache
@@ -59,58 +43,49 @@ jobs:
5943
key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }}
6044
restore-keys: |
6145
${{ runner.os }}-go-cache
62-
6346
- name: Restore benchstat
64-
uses: actions/cache@v3
47+
uses: actions/cache@v4
6548
with:
6649
path: ~/go/bin/benchstat
67-
key: ${{ runner.os }}-benchstat-legacy
68-
50+
key: ${{ runner.os }}-benchstat
6951
- name: Restore base benchmark result
70-
id: base-benchmark
7152
if: env.CACHE_BENCHMARK == 'on'
72-
uses: actions/cache@v3
53+
id: benchmark-base
54+
uses: actions/cache@v4
7355
with:
7456
path: |
7557
bench-master.txt
7658
bench-main.txt
7759
# Use base sha for PR or new commit hash for master/main push in benchmark result key.
7860
key: ${{ runner.os }}-bench-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }}
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 != '')
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@v4
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 != '')
9369
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 }}
9770
export REF_NAME=master
98-
make bench-run bench-stat
99-
git reset --hard $HEAD
100-
101-
- name: Benchmark stats
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
10274
id: bench
10375
run: |
10476
export REF_NAME=new
77+
BENCH_COUNT=5 make bench
10578
OUTPUT=$(make bench-stat-diff)
106-
echo "${OUTPUT}"
107-
echo "diff<<EOF" >> $GITHUB_OUTPUT && echo "$OUTPUT" >> $GITHUB_OUTPUT && echo "EOF" >> $GITHUB_OUTPUT
79+
OUTPUT="${OUTPUT//'%'/'%25'}"
80+
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
81+
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
82+
echo "::set-output name=diff::$OUTPUT"
10883
OUTPUT=$(make bench-stat)
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
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
11489
uses: marocchino/sticky-pull-request-comment@v2
11590
with:
11691
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/cloc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717
with:
1818
path: pr
1919
- name: Checkout base code
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121
with:
2222
ref: ${{ github.event.pull_request.base.sha }}
2323
path: base

.github/workflows/golangci-lint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ jobs:
1919
name: golangci-lint
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/setup-go@v3
22+
- uses: actions/setup-go@v5
2323
with:
24-
go-version: 1.23.x
25-
- uses: actions/checkout@v2
24+
go-version: stable
25+
- uses: actions/checkout@v4
2626
- name: golangci-lint
27-
uses: golangci/golangci-lint-action@v6.1.0
27+
uses: golangci/golangci-lint-action@v6.2.0
2828
with:
2929
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
30-
version: v1.61.0
30+
version: v1.63.4
3131

3232
# Optional: working directory, useful for monorepos
3333
# working-directory: somedir

.github/workflows/gorelease.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,19 @@ concurrency:
99
cancel-in-progress: true
1010

1111
env:
12-
GO_VERSION: 1.23.x
12+
GO_VERSION: stable
1313
jobs:
1414
gorelease:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- name: Install Go stable
18-
if: env.GO_VERSION != 'tip'
19-
uses: actions/setup-go@v4
17+
- name: Install Go
18+
uses: actions/setup-go@v5
2019
with:
2120
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
3121
- name: Checkout code
32-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
3323
- name: Gorelease cache
34-
uses: actions/cache@v3
24+
uses: actions/cache@v4
3525
with:
3626
path: |
3727
~/go/bin/gorelease

.github/workflows/test-unit.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,25 @@ concurrency:
1515
env:
1616
GO111MODULE: "on"
1717
RUN_BASE_COVERAGE: "on" # Runs test for PR base in case base test coverage is missing.
18-
COV_GO_VERSION: 1.22.x # Version of Go to collect coverage
18+
COV_GO_VERSION: stable # Version of Go to collect coverage
1919
TARGET_DELTA_COV: 90 # Target coverage of changed lines, in percents
2020
jobs:
2121
test:
2222
strategy:
2323
matrix:
24-
go-version: [ 1.13.x, 1.22.x, 1.23.x ]
24+
go-version: [ 1.13.x, stable, oldstable ]
2525
runs-on: ubuntu-latest
2626
steps:
27-
- name: Install Go stable
28-
if: matrix.go-version != 'tip'
29-
uses: actions/setup-go@v4
27+
- name: Install Go
28+
uses: actions/setup-go@v5
3029
with:
3130
go-version: ${{ matrix.go-version }}
3231

33-
- name: Install Go tip
34-
if: matrix.go-version == 'tip'
35-
run: |
36-
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
37-
ls -lah gotip.tar.gz
38-
mkdir -p ~/sdk/gotip
39-
tar -C ~/sdk/gotip -xzf gotip.tar.gz
40-
~/sdk/gotip/bin/go version
41-
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV
42-
4332
- name: Checkout code
44-
uses: actions/checkout@v3
33+
uses: actions/checkout@v4
4534

4635
- name: Go cache
47-
uses: actions/cache@v3
36+
uses: actions/cache@v4
4837
with:
4938
# In order:
5039
# * Module download cache
@@ -59,7 +48,7 @@ jobs:
5948
- name: Restore base test coverage
6049
id: base-coverage
6150
if: matrix.go-version == env.COV_GO_VERSION && github.event.pull_request.base.sha != ''
62-
uses: actions/cache@v2
51+
uses: actions/cache@v4
6352
with:
6453
path: |
6554
unit-base.txt
@@ -130,7 +119,7 @@ jobs:
130119

131120
- name: Upload code coverage
132121
if: matrix.go-version == env.COV_GO_VERSION
133-
uses: codecov/codecov-action@v1
122+
uses: codecov/codecov-action@v5
134123
with:
135-
file: ./unit.coverprofile
124+
files: ./unit.coverprofile
136125
flags: unittests

.golangci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ linters:
2525
- err113
2626
- cyclop
2727
- gochecknoglobals
28-
- gomnd
2928
- wrapcheck
3029
- paralleltest
3130
- forbidigo
@@ -43,6 +42,7 @@ linters:
4342
- execinquery
4443
- mnd
4544
- testifylint
45+
- recvcheck
4646

4747
issues:
4848
exclude-use-default: false
@@ -52,19 +52,18 @@ issues:
5252
path: ".go"
5353
text: "\"io/ioutil\" has been deprecated since Go 1.19" # Keeping backwards compatibility with go1.13.
5454
- linters:
55+
- errcheck
5556
- canonicalheader
5657
- testifylint
5758
- gomnd
5859
- mnd
5960
- goconst
60-
- goerr113
6161
- noctx
6262
- funlen
6363
- dupl
6464
- structcheck
6565
- unused
6666
- unparam
67-
- nosnakecase
6867
path: "_test.go"
6968
- linters:
7069
- errcheck # Error checking omitted for brevity.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#GOLANGCI_LINT_VERSION := "v1.61.0" # Optional configuration to pinpoint golangci-lint version.
1+
#GOLANGCI_LINT_VERSION := "v1.63.4" # Optional configuration to pinpoint golangci-lint version.
22

33
# The head of Makefile determines location of dev-go to include standard targets.
44
GO ?= go

_examples/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ replace github.com/swaggest/rest => ../
66

77
require (
88
github.com/bool64/ctxd v1.2.1
9-
github.com/bool64/dev v0.2.37
9+
github.com/bool64/dev v0.2.38
1010
github.com/bool64/httpmock v0.1.15
1111
github.com/bool64/httptestbench v0.1.4
1212
github.com/gin-gonic/gin v1.10.0
@@ -17,7 +17,7 @@ require (
1717
github.com/rs/cors v1.11.1
1818
github.com/stretchr/testify v1.9.0
1919
github.com/swaggest/assertjson v1.9.0
20-
github.com/swaggest/jsonschema-go v0.3.72
20+
github.com/swaggest/jsonschema-go v0.3.73
2121
github.com/swaggest/openapi-go v0.2.54
2222
github.com/swaggest/rest v0.0.0-00010101000000-000000000000
2323
github.com/swaggest/swgui v1.8.2

_examples/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ github.com/bool64/ctxd v1.2.1 h1:hARFteq0zdn4bwfmxLhak3fXFuvtJVKDH2X29VV/2ls=
44
github.com/bool64/ctxd v1.2.1/go.mod h1:ZG6QkeGVLTiUl2mxPpyHmFhDzFZCyocr9hluBV3LYuc=
55
github.com/bool64/dev v0.2.5/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
66
github.com/bool64/dev v0.2.25/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
7-
github.com/bool64/dev v0.2.37 h1:3y7C32+knfKaE3MqWftysRkK1bGLUD3Q4/seiWVhmnI=
8-
github.com/bool64/dev v0.2.37/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
7+
github.com/bool64/dev v0.2.38 h1:C5H9wkx/BhTYRfV14X90iIQKpSuhzsG+OHQvWdQ5YQ4=
8+
github.com/bool64/dev v0.2.38/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
99
github.com/bool64/httpmock v0.1.15 h1:PWvuqpew/FEigT7cvv03/t9G+UeE3wD2QP8PVyBBUwc=
1010
github.com/bool64/httpmock v0.1.15/go.mod h1:Ht82vaR7YJu8YHcJoK5mDi5OG6NJfv/MmYfdfod1huQ=
1111
github.com/bool64/httptestbench v0.1.4 h1:35f9RwWqcnQRXM+sA+GUhWVGSa6XEFlKpNSH9oYzOjI=
@@ -129,8 +129,8 @@ github.com/swaggest/assertjson v1.9.0 h1:dKu0BfJkIxv/xe//mkCrK5yZbs79jL7OVf9Ija7
129129
github.com/swaggest/assertjson v1.9.0/go.mod h1:b+ZKX2VRiUjxfUIal0HDN85W0nHPAYUbYH5WkkSsFsU=
130130
github.com/swaggest/form/v5 v5.1.1 h1:ct6/rOQBGrqWUQ0FUv3vW5sHvTUb31AwTUWj947N6cY=
131131
github.com/swaggest/form/v5 v5.1.1/go.mod h1:X1hraaoONee20PMnGNLQpO32f9zbQ0Czfm7iZThuEKg=
132-
github.com/swaggest/jsonschema-go v0.3.72 h1:IHaGlR1bdBUBPfhe4tfacN2TGAPKENEGiNyNzvnVHv4=
133-
github.com/swaggest/jsonschema-go v0.3.72/go.mod h1:OrGyEoVqpfSFJ4Am4V/FQcQ3mlEC1vVeleA+5ggbVW4=
132+
github.com/swaggest/jsonschema-go v0.3.73 h1:gU1pBzF3pkZ1GDD3dRMdQoCjrA0sldJ+QcM7aSSPgvc=
133+
github.com/swaggest/jsonschema-go v0.3.73/go.mod h1:qp+Ym2DIXHlHzch3HKz50gPf2wJhKOrAB/VYqLS2oJU=
134134
github.com/swaggest/openapi-go v0.2.54 h1:WnFKIHAgR2RIOiYys3qvSuYmsFd2a17MIoC9Tcvog5c=
135135
github.com/swaggest/openapi-go v0.2.54/go.mod h1:2Q7NpuG9NgpGeTaNOo852GSR6cCzSP4IznA9DNdUTQw=
136136
github.com/swaggest/refl v1.3.0 h1:PEUWIku+ZznYfsoyheF97ypSduvMApYyGkYF3nabS0I=

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/swaggest/rest
33
go 1.17
44

55
require (
6-
github.com/bool64/dev v0.2.37
6+
github.com/bool64/dev v0.2.38
77
github.com/bool64/httpmock v0.1.15
88
github.com/bool64/shared v0.1.5
99
github.com/cespare/xxhash/v2 v2.3.0
@@ -13,7 +13,7 @@ require (
1313
github.com/stretchr/testify v1.8.2
1414
github.com/swaggest/assertjson v1.9.0
1515
github.com/swaggest/form/v5 v5.1.1
16-
github.com/swaggest/jsonschema-go v0.3.72
16+
github.com/swaggest/jsonschema-go v0.3.73
1717
github.com/swaggest/openapi-go v0.2.54
1818
github.com/swaggest/refl v1.3.0
1919
github.com/swaggest/usecase v1.3.1

go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ github.com/bool64/dev v0.2.31/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8
55
github.com/bool64/dev v0.2.32/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
66
github.com/bool64/dev v0.2.35/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
77
github.com/bool64/dev v0.2.36/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
8-
github.com/bool64/dev v0.2.37 h1:3y7C32+knfKaE3MqWftysRkK1bGLUD3Q4/seiWVhmnI=
9-
github.com/bool64/dev v0.2.37/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
8+
github.com/bool64/dev v0.2.38 h1:C5H9wkx/BhTYRfV14X90iIQKpSuhzsG+OHQvWdQ5YQ4=
9+
github.com/bool64/dev v0.2.38/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
1010
github.com/bool64/httpmock v0.1.15 h1:PWvuqpew/FEigT7cvv03/t9G+UeE3wD2QP8PVyBBUwc=
1111
github.com/bool64/httpmock v0.1.15/go.mod h1:Ht82vaR7YJu8YHcJoK5mDi5OG6NJfv/MmYfdfod1huQ=
1212
github.com/bool64/shared v0.1.5 h1:fp3eUhBsrSjNCQPcSdQqZxxh9bBwrYiZ+zOKFkM0/2E=
@@ -77,8 +77,9 @@ github.com/swaggest/assertjson v1.9.0 h1:dKu0BfJkIxv/xe//mkCrK5yZbs79jL7OVf9Ija7
7777
github.com/swaggest/assertjson v1.9.0/go.mod h1:b+ZKX2VRiUjxfUIal0HDN85W0nHPAYUbYH5WkkSsFsU=
7878
github.com/swaggest/form/v5 v5.1.1 h1:ct6/rOQBGrqWUQ0FUv3vW5sHvTUb31AwTUWj947N6cY=
7979
github.com/swaggest/form/v5 v5.1.1/go.mod h1:X1hraaoONee20PMnGNLQpO32f9zbQ0Czfm7iZThuEKg=
80-
github.com/swaggest/jsonschema-go v0.3.72 h1:IHaGlR1bdBUBPfhe4tfacN2TGAPKENEGiNyNzvnVHv4=
8180
github.com/swaggest/jsonschema-go v0.3.72/go.mod h1:OrGyEoVqpfSFJ4Am4V/FQcQ3mlEC1vVeleA+5ggbVW4=
81+
github.com/swaggest/jsonschema-go v0.3.73 h1:gU1pBzF3pkZ1GDD3dRMdQoCjrA0sldJ+QcM7aSSPgvc=
82+
github.com/swaggest/jsonschema-go v0.3.73/go.mod h1:qp+Ym2DIXHlHzch3HKz50gPf2wJhKOrAB/VYqLS2oJU=
8283
github.com/swaggest/openapi-go v0.2.54 h1:WnFKIHAgR2RIOiYys3qvSuYmsFd2a17MIoC9Tcvog5c=
8384
github.com/swaggest/openapi-go v0.2.54/go.mod h1:2Q7NpuG9NgpGeTaNOo852GSR6cCzSP4IznA9DNdUTQw=
8485
github.com/swaggest/refl v1.3.0 h1:PEUWIku+ZznYfsoyheF97ypSduvMApYyGkYF3nabS0I=

0 commit comments

Comments
 (0)