Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@ jobs:
steps:
- uses: actions/checkout@v6

- uses: actions/cache@v5
- uses: cachix/install-nix-action@v31
with:
path: bin
key: bin-${{ runner.os }}-${{ hashFiles('.versions/*') }}
restore-keys: |
bin-${{ runner.os }}
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-go@v6
- uses: cachix/cachix-action@v17
with:
go-version-file: go.mod
cache-dependency-path: go.sum
name: unstoppablemango
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- run: make test
- run: nix develop -c make test

nix:
runs-on: ubuntu-latest
Expand All @@ -50,12 +47,16 @@ jobs:
steps:
- uses: actions/checkout@v6

- uses: actions/setup-go@v6
- uses: cachix/install-nix-action@v31
with:
go-version-file: go.mod
cache-dependency-path: go.sum
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- run: go tool gomod2nix
- uses: cachix/cachix-action@v17
with:
name: unstoppablemango
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- run: nix develop -c go tool gomod2nix
- run: git diff --exit-code gomod2nix.toml

clean:
Expand All @@ -64,10 +65,14 @@ jobs:
steps:
- uses: actions/checkout@v6

- uses: actions/setup-go@v6
- uses: cachix/install-nix-action@v31
with:
go-version-file: go.mod
cache-dependency-path: go.sum
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- uses: cachix/cachix-action@v17
with:
name: unstoppablemango
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- run: make pkg/renovate/zz_generated.schema.go
- run: nix develop -c make pkg/renovate/zz_generated.schema.go
- run: git diff --exit-code
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ bin/
go.work*
.direnv/
result
.claude/*
1 change: 0 additions & 1 deletion .versions/go-jsonschema

This file was deleted.

1 change: 0 additions & 1 deletion .versions/jq

This file was deleted.

15 changes: 4 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export GOBIN := ${LOCALBIN}
GO ?= go
GINKGO ?= $(GO) tool ginkgo
GOMOD2NIX ?= $(GO) tool gomod2nix
JSON2GO := ${LOCALBIN}/go-jsonschema
JQ := ${LOCALBIN}/jq
JSON2GO ?= go-jsonschema
JQ ?= jq
NIX ?= nix

ifeq ($(shell test -f ${LOCALBIN}/devctl && echo yes),yes)
Expand Down Expand Up @@ -37,21 +37,14 @@ test_all:
bin/devctl: $(shell $(DEVCTL) list --go --exclude-tests)
go build -o $@ ./

bin/go-jsonschema: .versions/go-jsonschema
go install github.com/atombender/go-jsonschema@$(shell $(DEVCTL) $<)

bin/jq: .versions/jq
curl -L -o $@ https://github.com/jqlang/jq/releases/download/jq-$(shell $(DEVCTL) v jq)/jq-$(shell go env GOOS | sed s/darwin/macos/)-$(shell go env GOARCH)
chmod +x $@

gomod2nix.toml: go.mod
$(GOMOD2NIX)

go.sum: go.mod $(shell $(DEVCTL) list --go)
go mod tidy

# I can't seem to get --schema-root-type to do what I want it to
pkg/renovate/zz_generated.schema.go: .make/renovate-schema.json bin/go-jsonschema
pkg/renovate/zz_generated.schema.go: .make/renovate-schema.json
mkdir -p $(dir $@)
$(JSON2GO) --package renovate $< --only-models | sed s/RenovateSchemaJson/Config/g > $@
Comment on lines +47 to 49

Expand All @@ -71,7 +64,7 @@ pkg/renovate/zz_generated.schema.go: .make/renovate-schema.json bin/go-jsonschem
.make/renovate-schema.orig.json:
curl https://docs.renovatebot.com/renovate-schema.json -o $@

.make/renovate-schema.json: .make/renovate-schema.orig.json hack/renovate/*.jq | bin/jq
.make/renovate-schema.json: .make/renovate-schema.orig.json hack/renovate/*.jq
cat $< | $(JQ) -f hack/renovate/delete-refs.jq > $@

.make/dprint-format: .dprint.json README.md .github/renovate.json .vscode/extensions.json
Expand Down
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
git
gnumake
go
go-jsonschema
gomod2nix
jq
nil
nixfmt
];
Expand Down
19 changes: 11 additions & 8 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ schema = 3
[mod."github.com/google/go-github/v81"]
version = "v81.0.0"
hash = "sha256-+ufveUz5MphSn3KVU0v+5mlV0sPyeZC5g7jyR37kg0Q="
[mod."github.com/google/go-github/v84"]
version = "v84.0.0"
hash = "sha256-PCi2rQfQ4L2pmgGwOFSIW1u+exocIaq94K0OzuA++5I="
[mod."github.com/google/go-querystring"]
version = "v1.2.0"
hash = "sha256-F/Ve4oDaEqho8RryvdGSRR22/DbYHWZQa6M60n6oSYM="
Expand Down Expand Up @@ -92,11 +95,11 @@ schema = 3
version = "v1.7.0"
hash = "sha256-KSsBTMpggbVO4AmI0JaXbALrXeygr2sT+IuoVAfkNqw="
[mod."github.com/onsi/ginkgo/v2"]
version = "v2.27.5"
hash = "sha256-4YtMCQDR+odfRReIah0jHLXFdG8UyX+EOaDT00XpMr0="
version = "v2.28.1"
hash = "sha256-ndaovLQb6s4cztI8MXXJajJDY1kMsuz5zEbVjlfKgAE="
[mod."github.com/onsi/gomega"]
version = "v1.39.0"
hash = "sha256-in2eEUjcDC3JGDSAQxBI/mWdT0E2X1yCBKoGXemlWaE="
version = "v1.39.1"
hash = "sha256-ZlbQhUVwQBzmhBWCQ9iPWoJOVr+OqqIHB4iCNDFMEds="
[mod."github.com/pelletier/go-toml/v2"]
version = "v2.2.4"
hash = "sha256-8qQIPldbsS5RO8v/FW/se3ZsAyvLzexiivzJCbGRg2Q="
Expand Down Expand Up @@ -128,11 +131,11 @@ schema = 3
version = "v1.6.0"
hash = "sha256-LspbjTniiq2xAICSXmgqP7carwlNaLqnCTQfw2pa80A="
[mod."github.com/unmango/aferox"]
version = "v0.3.3"
hash = "sha256-pdIvZefa8Yl5zK1PFQYab+ExPHALTKgfKDZ5WLEcT3A="
version = "v0.5.0"
hash = "sha256-ugi7ILxoL3R6xjgl/8ruxzx+BAaux7IEJNnfae3FqeM="
[mod."github.com/unmango/aferox/github"]
version = "v0.0.4"
hash = "sha256-tz0jH4jLGR2S4rQPpHngzy9Ho/OAuQTBgqWmt9xR51s="
version = "v0.0.6"
hash = "sha256-8OinTfBi4FYya+TU6zUtwwhPBsw6Xwf7ueah0pSrCHM="
[mod."github.com/unmango/go"]
version = "v0.15.1"
hash = "sha256-iaw6AuhEYu7LdLQnOL6Zmu9kp41nRwaz+lpeZ5ihRww="
Expand Down
8 changes: 7 additions & 1 deletion hack/renovate/delete-refs.jq
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
del(.properties.[]|select(.["$ref"] == "#"))
walk(
if type == "object" and has("properties") then
.properties |= with_entries(select(.value["$ref"] != "#"))
else
.
end
)
Comment on lines +1 to +7
5 changes: 3 additions & 2 deletions pkg/renovate/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import (
var _ = Describe("Schema", func() {
Describe("CustomManager", func() {
It("should marshal", func() {
c := renovate.Config{CustomManagers: []interface{}{
renovate.CustomManager{CustomType: "regex"},
customType := renovate.ConfigCustomManagersElemCustomTypeRegex
c := renovate.Config{CustomManagers: []renovate.ConfigCustomManagersElem{
{CustomType: &customType},
}}

data, err := json.Marshal(c)
Expand Down
Loading
Loading