From a40b85534183c78c0d0e16c6d852cd94f6ea244e Mon Sep 17 00:00:00 2001 From: Keith Gaughan Date: Sat, 21 Sep 2024 16:52:15 +0100 Subject: [PATCH] Prep for docs pipeline --- .github/workflows/dependabot.yml | 2 +- .gitignore | 1 + Makefile | 63 ++++++++++++++++++++---- docs/commands.md | 26 ++++++++++ docs/index.md | 1 + mkdocs.yml | 13 +++++ requirements.in | 3 ++ requirements.txt | 84 ++++++++++++++++++++++++++++++++ 8 files changed, 182 insertions(+), 11 deletions(-) create mode 100644 docs/commands.md create mode 100644 docs/index.md create mode 100644 mkdocs.yml create mode 100644 requirements.in create mode 100644 requirements.txt diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index da8aa86..c39ef27 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -25,7 +25,7 @@ jobs: cache: true - run: | - make mock + make mocks - uses: stefanzweifel/git-auto-commit-action@v5 with: diff --git a/.gitignore b/.gitignore index 93cbe4b..26175f5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ *.zip .DS_Store *.bak +/site diff --git a/Makefile b/Makefile index 890d4e1..732ee2b 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,62 @@ -VERSION:=unknown +NAME:=gcredstash -all: gcredstash +SOURCE:=$(wildcard internal/*.go internal/*/*.go cmd/*/*.go) +DOCS:=$(wildcard docs/*.md mkdocs.yml) -gcredstash: - CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w -X github.com/kgaughan/gcredstash/internal.Version=$(VERSION)" -tags netgo -o $@ ./cmd/$@ +.PHONY: build +build: go.mod $(NAME) -test: - go test -cover -v ./... +.PHONY: tidy +tidy: go.mod fmt +.PHONY: clean clean: - rm -rf gcredstash *.gz *.zip dist/ + rm -rf $(NAME) dist site + +$(NAME): $(SOURCE) go.sum + CGO_ENABLED=0 go build -v -tags netgo -trimpath -ldflags '-s -w' -o $@ ./cmd/$@ + +.PHONY: update +update: + go get -u ./... + go mod tidy + +go.sum: go.mod + go mod verify + @touch go.sum + +go.mod: $(SOURCE) + go mod tidy + +.PHONY: fmt +fmt: + go fmt ./... + +.PHONY: lint +lint: + go vet ./... -mock: +.PHONY: serve-docs +serve-docs: .venv + .venv/bin/mkdocs serve + +.PHONY: docs +docs: .venv $(DOCS) + .venv/bin/mkdocs build + +.venv: requirements.txt + uv venv + uv pip install -r requirements.txt + +%.txt: %.in + uv pip compile $< > $@ + +.PHONY: tests +tests: + go test -cover -v ./... + +.PHONY: mocks +mocks: go install go.uber.org/mock/mockgen@v0.4.0 mockgen -package mockaws -destination internal/mockaws/dynamodbmock.go github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface DynamoDBAPI mockgen -package mockaws -destination internal/mockaws/kmsmock.go github.com/aws/aws-sdk-go/service/kms/kmsiface KMSAPI - -.PHONY: all test clean mock diff --git a/docs/commands.md b/docs/commands.md new file mode 100644 index 0000000..54d09aa --- /dev/null +++ b/docs/commands.md @@ -0,0 +1,26 @@ +# Commands + +``` +gcredstash manages credentials using AWS Key Management Service (KMS) and DynamoDB + +Usage: + gcredstash [command] + +Available Commands: + completion Generate the autocompletion script for the specified shell + delete Delete a credential from the store + get Get a credential from the store + getall Get all credentials from the store + help Help about any command + list List credentials and their version + put Put a credential into the store + setup Setup the credential store + template Parse a template file with credentials + +Flags: + -h, --help help for gcredstash + -t, --table string DynamoDB table to use for credential storage (default "credential-store") + -v, --version version for gcredstash + +Use "gcredstash [command] --help" for more information about a command. +``` diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..9c886fd --- /dev/null +++ b/docs/index.md @@ -0,0 +1 @@ +# Hello. world! diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..dc2b231 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,13 @@ +--- +site_name: gcredstash +repo_url: https://github.com/kgaughan/gcredstash/ +theme: + name: material + +markdown_extensions: + admonition: {} + attr_list: {} + +nav: + - commands.md + - configuration.md diff --git a/requirements.in b/requirements.in new file mode 100644 index 0000000..7d34ff9 --- /dev/null +++ b/requirements.in @@ -0,0 +1,3 @@ +mkdocs +mkdocs-material +mkdocs-awesome-pages-plugin diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..fa4f8ae --- /dev/null +++ b/requirements.txt @@ -0,0 +1,84 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile requirements.in +babel==2.16.0 + # via mkdocs-material +bracex==2.5 + # via wcmatch +certifi==2024.8.30 + # via requests +charset-normalizer==3.3.2 + # via requests +click==8.1.7 + # via mkdocs +colorama==0.4.6 + # via mkdocs-material +ghp-import==2.1.0 + # via mkdocs +idna==3.10 + # via requests +jinja2==3.1.4 + # via + # mkdocs + # mkdocs-material +markdown==3.7 + # via + # mkdocs + # mkdocs-material + # pymdown-extensions +markupsafe==2.1.5 + # via + # jinja2 + # mkdocs +mergedeep==1.3.4 + # via + # mkdocs + # mkdocs-get-deps +mkdocs==1.6.1 + # via + # -r requirements.in + # mkdocs-awesome-pages-plugin + # mkdocs-material +mkdocs-awesome-pages-plugin==2.9.3 + # via -r requirements.in +mkdocs-get-deps==0.2.0 + # via mkdocs +mkdocs-material==9.5.36 + # via -r requirements.in +mkdocs-material-extensions==1.3.1 + # via mkdocs-material +natsort==8.4.0 + # via mkdocs-awesome-pages-plugin +packaging==24.1 + # via mkdocs +paginate==0.5.7 + # via mkdocs-material +pathspec==0.12.1 + # via mkdocs +platformdirs==4.3.6 + # via mkdocs-get-deps +pygments==2.18.0 + # via mkdocs-material +pymdown-extensions==10.9 + # via mkdocs-material +python-dateutil==2.9.0.post0 + # via ghp-import +pyyaml==6.0.2 + # via + # mkdocs + # mkdocs-get-deps + # pymdown-extensions + # pyyaml-env-tag +pyyaml-env-tag==0.1 + # via mkdocs +regex==2024.9.11 + # via mkdocs-material +requests==2.32.3 + # via mkdocs-material +six==1.16.0 + # via python-dateutil +urllib3==2.2.3 + # via requests +watchdog==5.0.2 + # via mkdocs +wcmatch==9.0 + # via mkdocs-awesome-pages-plugin