Skip to content

Commit 2c64ab5

Browse files
Merge pull request #177 from keboola/jt-taskfile
feat: Use Taskfile
2 parents 6381d52 + 989e123 commit 2c64ab5

File tree

10 files changed

+191
-293
lines changed

10 files changed

+191
-293
lines changed

.github/workflows/push.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ jobs:
44
build:
55
name: Build
66
runs-on: ubuntu-latest
7-
concurrency:
8-
group: e2e-tests
9-
cancel-in-progress: false
107
steps:
118
- name: Check out source code
129
uses: actions/checkout@v4
1310

1411
- name: Set up Go
1512
uses: actions/setup-go@v5
1613
with:
17-
cache: false
18-
go-version-file: 'go.mod'
14+
go-version-file: go.mod
15+
16+
- name: Install Task
17+
shell: bash
18+
run: |
19+
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
1920
2021
- name: Set TEST_KBC_PROJECTS_FILE entries
2122
uses: ./.github/export-kbc-projects
@@ -24,14 +25,13 @@ jobs:
2425

2526
- name: Install tools
2627
run: |
27-
make install-tools
28+
task tools
2829
2930
- name: Lint and test
30-
run: |
31-
make lint
32-
make tests
3331
env:
3432
TEST_KBC_PROJECTS_LOCK_HOST: ${{ vars.TEST_KBC_PROJECTS_LOCK_HOST }}
3533
TEST_KBC_PROJECTS_LOCK_PASSWORD: ${{ secrets.TEST_KBC_PROJECTS_LOCK_PASSWORD }}
3634
TEST_KBC_PROJECTS_FILE: '${{ github.workspace }}/${{ vars.TEST_KBC_PROJECTS_FILE }}'
37-
35+
run: |
36+
task lint
37+
task tests

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ ENV PATH="$PATH:$GOPATH/bin"
1010
RUN apt-get update && apt-get install -y nano
1111
ENV EDITOR=nano
1212

13+
# Install Task
14+
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
15+
1316
# Install tools
1417
RUN mkdir -p /tmp/build
15-
COPY Makefile /tmp/build/Makefile
18+
COPY Taskfile.yml /tmp/build/Taskfile.yml
1619
COPY scripts /tmp/build/scripts
17-
RUN cd /tmp/build && make install-tools && rm -rf /tmp/build
20+
RUN cd /tmp/build && task tools && rm -rf /tmp/build
1821

1922
# Set prompt
2023
RUN mkdir -p ~ && \

Makefile

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func main() {
133133
if err != nil {
134134
fmt.Printf("Error handled: %v\n", err)
135135
}
136-
136+
137137
// Using query parameters
138138
var users []User
139139
_, _, err = request.NewHTTPRequest(c).
@@ -146,7 +146,7 @@ func main() {
146146
log.Fatalf("Error: %v", err)
147147
}
148148
fmt.Printf("Users: %+v\n", users)
149-
149+
150150
// Using path parameters
151151
var project User
152152
_, _, err = request.NewHTTPRequest(c).
@@ -159,7 +159,7 @@ func main() {
159159
log.Fatalf("Error: %v", err)
160160
}
161161
fmt.Printf("Project: %+v\n", project)
162-
162+
163163
// Using callbacks
164164
_, _, err = request.NewHTTPRequest(c).
165165
WithGet("/users/123").
@@ -176,7 +176,7 @@ func main() {
176176
if err != nil {
177177
log.Fatalf("Error: %v", err)
178178
}
179-
179+
180180
// Using form body
181181
var loginResponse struct {
182182
Token string `json:"token"`
@@ -205,13 +205,13 @@ docker-compose run --rm -u "$UID:$GID" --service-ports dev bash
205205

206206
Run lint and tests in container:
207207
```sh
208-
make lint
209-
make tests
208+
task lint
209+
task tests
210210
```
211211

212212
Run HTTP server with documentation:
213213
```sh
214-
make godoc
214+
task godoc
215215
```
216216

217217
Open `http://localhost:6060/pkg/github.com/keboola/go-client/pkg/` in browser.

Taskfile.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: '3'
2+
3+
tasks:
4+
tools:
5+
cmds:
6+
- bash ./scripts/tools.sh
7+
8+
lint:
9+
cmds:
10+
- bash ./scripts/lint.sh
11+
12+
fix:
13+
cmds:
14+
- bash ./scripts/fix.sh
15+
16+
tests:
17+
cmds:
18+
- go tool gotestsum --no-color=false --format testname -- -timeout 600s -p 8 -parallel 8 -v -race -coverprofile=/tmp/profile.out ./pkg/...
19+
20+
godoc:
21+
cmds:
22+
- go tool godoc -http=0.0.0.0:6060
23+
24+
update:
25+
cmds:
26+
- go tool go-mod-upgrade
27+
- go mod tidy
28+
- go mod vendor

go.mod

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ require (
4343
cloud.google.com/go/compute/metadata v0.6.0 // indirect
4444
cloud.google.com/go/iam v1.5.0 // indirect
4545
cloud.google.com/go/monitoring v1.24.1 // indirect
46+
github.com/AlecAivazis/survey/v2 v2.3.2 // indirect
4647
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.9.0 // indirect
4748
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 // indirect
4849
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
@@ -51,6 +52,8 @@ require (
5152
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0 // indirect
5253
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 // indirect
5354
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 // indirect
55+
github.com/Masterminds/semver/v3 v3.1.1 // indirect
56+
github.com/apex/log v1.9.0 // indirect
5457
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.10 // indirect
5558
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 // indirect
5659
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.72 // indirect
@@ -67,13 +70,19 @@ require (
6770
github.com/aws/aws-sdk-go-v2/service/sts v1.33.19 // indirect
6871
github.com/aws/smithy-go v1.22.3 // indirect
6972
github.com/beorn7/perks v1.0.1 // indirect
73+
github.com/bitfield/gotestdox v0.2.2 // indirect
74+
github.com/briandowns/spinner v1.16.0 // indirect
7075
github.com/bsm/redislock v0.9.4 // indirect
7176
github.com/cespare/xxhash/v2 v2.3.0 // indirect
7277
github.com/cncf/xds/go v0.0.0-20250326154945-ae57f3c0d45f // indirect
78+
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
7379
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
80+
github.com/dnephin/pflag v1.0.7 // indirect
7481
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
7582
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
83+
github.com/fatih/color v1.17.0 // indirect
7684
github.com/felixge/httpsnoop v1.0.4 // indirect
85+
github.com/fsnotify/fsnotify v1.8.0 // indirect
7786
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
7887
github.com/go-logr/logr v1.4.2 // indirect
7988
github.com/go-logr/stdr v1.2.2 // indirect
@@ -84,33 +93,47 @@ require (
8493
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
8594
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
8695
github.com/google/s2a-go v0.1.9 // indirect
96+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
8797
github.com/google/uuid v1.6.0 // indirect
8898
github.com/google/wire v0.6.0 // indirect
8999
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
90100
github.com/hashicorp/errwrap v1.1.0 // indirect
91101
github.com/jmespath/go-jmespath v0.4.0 // indirect
102+
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
92103
github.com/kylelemons/godebug v1.1.0 // indirect
93104
github.com/leodido/go-urn v1.4.0 // indirect
105+
github.com/mattn/go-colorable v0.1.13 // indirect
106+
github.com/mattn/go-isatty v0.0.20 // indirect
107+
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
94108
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
95109
github.com/modern-go/reflect2 v1.0.2 // indirect
96110
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
111+
github.com/oligot/go-mod-upgrade v0.11.0 // indirect
97112
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
113+
github.com/pkg/errors v0.8.1 // indirect
98114
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
99115
github.com/pmezard/go-difflib v1.0.0 // indirect
100116
github.com/prometheus/client_golang v1.22.0 // indirect
101117
github.com/prometheus/client_model v0.6.2 // indirect
102118
github.com/prometheus/common v0.63.0 // indirect
103119
github.com/prometheus/procfs v0.16.0 // indirect
104120
github.com/redis/go-redis/v9 v9.7.3 // indirect
121+
github.com/russross/blackfriday/v2 v2.0.1 // indirect
122+
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
123+
github.com/urfave/cli/v2 v2.3.0 // indirect
124+
github.com/yuin/goldmark v1.4.13 // indirect
105125
go.opencensus.io v0.24.0 // indirect
106126
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
107127
go.opentelemetry.io/contrib/detectors/gcp v1.35.0 // indirect
108128
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
109129
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
110130
golang.org/x/crypto v0.37.0 // indirect
131+
golang.org/x/mod v0.24.0 // indirect
111132
golang.org/x/sys v0.32.0 // indirect
133+
golang.org/x/term v0.31.0 // indirect
112134
golang.org/x/text v0.24.0 // indirect
113135
golang.org/x/time v0.11.0 // indirect
136+
golang.org/x/tools v0.32.0 // indirect
114137
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
115138
google.golang.org/api v0.228.0 // indirect
116139
google.golang.org/genproto v0.0.0-20250409194420-de1ac958c67a // indirect
@@ -119,4 +142,11 @@ require (
119142
google.golang.org/grpc v1.71.1 // indirect
120143
google.golang.org/protobuf v1.36.6 // indirect
121144
gopkg.in/yaml.v3 v3.0.1 // indirect
145+
gotest.tools/gotestsum v1.12.1 // indirect
146+
)
147+
148+
tool (
149+
github.com/oligot/go-mod-upgrade
150+
golang.org/x/tools/cmd/godoc
151+
gotest.tools/gotestsum
122152
)

0 commit comments

Comments
 (0)