Skip to content

Commit 88f215a

Browse files
authored
Merge pull request #221 from hugoh/chores
chores
2 parents 0d46986 + 9626cb4 commit 88f215a

6 files changed

Lines changed: 39 additions & 41 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,63 +33,41 @@ jobs:
3333
outputs:
3434
tools: ${{ steps.mise.outputs.tools }}
3535
steps:
36-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
36+
- &checkout
37+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
3738
with:
3839
persist-credentials: false
3940
- uses: yshrsmz/action-mise-values@92f49c5a07ebc7ffa957be5efa6a2c673578bbb0
4041
id: mise
4142

42-
lint:
43+
goci:
4344
needs: versions
4445
runs-on: ubuntu-latest
4546
permissions:
4647
contents: read
4748
steps:
48-
- &checkout
49-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
50-
with:
51-
persist-credentials: false
49+
- *checkout
5250
- &setup-go
5351
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff
5452
with:
5553
go-version: ${{ fromJson(needs.versions.outputs.tools).go }}
56-
- uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20
57-
with:
58-
version: v${{ fromJson(needs.versions.outputs.tools).golangci-lint }}
59-
60-
test:
61-
needs: versions
62-
environment: test
63-
runs-on: ubuntu-latest
64-
permissions:
65-
contents: read
66-
steps:
67-
- *checkout
68-
- *setup-go
6954
- uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151
55+
- name: Lint
56+
run: mise lint
7057
- name: Test
7158
run: mise test
7259
- name: Coverage
73-
run: mise run covercheck
60+
run: mise covercheck
7461
- name: Upload coverage reports to Codecov
7562
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2
7663
with:
7764
token: ${{ secrets.CODECOV_TOKEN }}
78-
79-
build:
80-
needs: [versions, lint, test]
81-
runs-on: ubuntu-latest
82-
permissions:
83-
contents: read
84-
steps:
85-
- *checkout
86-
- *setup-go
8765
- name: Build
8866
run: go build .
8967

9068
release:
9169
runs-on: ubuntu-latest
92-
needs: [hk, versions, build]
70+
needs: [hk, versions, goci]
9371
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
9472
permissions:
9573
contents: write

dprint.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"json": {
3+
},
4+
"markdown": {
5+
},
6+
"toml": {
7+
},
8+
"yaml": {
9+
},
10+
"excludes": [
11+
"**/*-lock.json"
12+
],
13+
"plugins": [
14+
"https://plugins.dprint.dev/json-0.21.3.wasm",
15+
"https://plugins.dprint.dev/markdown-0.21.1.wasm",
16+
"https://plugins.dprint.dev/toml-0.7.0.wasm",
17+
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.6.0.wasm"
18+
]
19+
}

hk.pkl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ local linters = new Mapping<String, Step> {
55
["golangci-lint"] = (Builtins.golangci_lint) {
66
profiles = List("!ci")
77
}
8-
["markdown-lint"] = Builtins.markdown_lint
9-
["prettier"] = Builtins.prettier
8+
["markdown"] = Builtins.rumdl
9+
["dprint"] = Builtins.dprint
1010
["zizmor"] = Builtins.zizmor
1111
}
1212

internal/gateway.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66

77
tmhi "github.com/hugoh/tmhi-gateway"
8-
"github.com/pterm/pterm"
98
)
109

1110
var errUnknownGateway = errors.New("unknown gateway")
@@ -28,8 +27,6 @@ func getGateway(cfg *Config) (tmhi.Gateway, error) {
2827
case NOK5G21:
2928
return tmhi.NewNokiaGateway(gwConfig), nil
3029
default:
31-
pterm.Error.Printf("unsupported gateway: \"%s\"\n", cfg.Model)
32-
33-
return nil, fmt.Errorf("%w: %s", errUnknownGateway, cfg.Model)
30+
return nil, fmt.Errorf("%w: \"%s\"", errUnknownGateway, cfg.Model)
3431
}
3532
}

mise.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ golangci-lint = "2.11.4"
66
goreleaser = "2.15.3"
77
gotestsum = "1.13.0"
88
hk = "1.43.0"
9-
"npm:markdownlint-cli" = "0.48.0"
10-
prettier = "3.8.3"
9+
rumdl = "0.1.80"
1110
zizmor = "1.24.1"
11+
dprint = "0.54.0"
1212

1313
[env]
1414
COVEROUT = "cover.out"
@@ -19,7 +19,6 @@ description = "Lint code"
1919
run = [
2020
"go mod tidy -diff",
2121
"golangci-lint run ./...",
22-
"prettier --check .",
2322
"goreleaser check",
2423
]
2524

@@ -40,6 +39,11 @@ run = "go-test-coverage -config .testcoverage.yml"
4039
description = "Run CI checks (lint, test, coverage)"
4140
depends = ["lint", "test", "covercheck"]
4241

42+
[tasks.full-ci]
43+
description = "Run CI checks + HK linting"
44+
depends = "ci"
45+
run = "hk check --profile ci --quiet"
46+
4347
[tasks.clean]
4448
description = "Clean the project"
4549
run = ["go clean", "rm -f ${COVEROUT}"]
@@ -50,7 +54,7 @@ run = "golangci-lint run --fix ./..."
5054

5155
[tasks.format]
5256
description = "Format the code"
53-
run = ["golangci-lint fmt ./...", "prettier --write ."]
57+
run = "golangci-lint fmt ./..."
5458

5559
[tasks.tidy]
5660
description = "Tidy the module"

tmhi-cli.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ password = "s3cret"
44

55
[gateway]
66
model = "NOK5G21"
7-
ip = "192.168.12.1"
7+
ip = "192.168.12.1"

0 commit comments

Comments
 (0)