Skip to content
Closed
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
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
pull-requests: write
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/[email protected]
- uses: ./tools/github-actions/setup-deps
- name: API Test
env:
Expand All @@ -65,7 +65,7 @@ jobs:
Build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/[email protected]
- uses: ./tools/github-actions/setup-deps
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
Expand All @@ -80,7 +80,7 @@ jobs:
E2E:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/[email protected]
- uses: ./tools/github-actions/setup-deps
- name: Set output
id: vars
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: File Lint Check

on:
push:
branches:
- "master"
pull_request:
branches:
- "master"

permissions:
contents: read

jobs:
files-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- uses: ./tools/github-actions/setup-deps
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "21"

- name: Markdown Lint check
run: |
make lint.markdown

- name: Yaml Lint check
run: |
make lint.yaml

- name: Check License
run: |
make lint.checklicense

- name: Check Code Spell
run: |
make lint.codespell
37 changes: 8 additions & 29 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,62 +14,41 @@ permissions:
contents: read

jobs:
docs-lint:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: ${{ github.event.pull_request.head.sha }}

- uses: ./tools/github-actions/setup-deps

- name: Run markdown linter
uses: nosborn/github-action-markdown-cli@9b5e871c11cc0649c5ac2526af22e23525fa344d # v3.3.0
with:
files: docs/site/content/*
config_file: ".github/markdown_lint_config.json"

- name: Install linkinator
run: npm install -g [email protected]

- name: Check links
run: make docs # docs-check-links

docs-build:
runs-on: ubuntu-latest
needs: docs-lint
permissions:
contents: write
steps:
- name: Git checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
uses: actions/[email protected]
with:
submodules: true
ref: ${{ github.event.pull_request.head.sha }}

- uses: ./tools/github-actions/setup-deps

- name: Setup Hugo
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
uses: peaceiris/[email protected]
with:
hugo-version: "latest"
extended: true

- name: Setup Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.1.0
uses: actions/[email protected]
with:
node-version: "18"

- name: Install Site Dependencies and Build Site
run: |
cp docs/api-testing-schema.json docs/site/static/api-testing-schema.json
cp docs/api-testing-mock-schema.json docs/site/static/api-testing-mock-schema.json
make docs # docs-check-links
make lint.checklinks
make lint.markdown
make docs

# Upload docs for GitHub Pages
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
uses: actions/[email protected]
with:
# Path of the directory containing the static assets.
path: docs/site/public
Expand All @@ -96,4 +75,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
uses: actions/[email protected]
11 changes: 0 additions & 11 deletions .github/workflows/license-check.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions .licenserc.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion checklink_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"aliveStatusCodes": [
200
]
}
}
5 changes: 5 additions & 0 deletions tools/linter/codespell/.codespell.ignorewords
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
keypair
keypairs
als
requestor
immediatedly
14 changes: 14 additions & 0 deletions tools/linter/codespell/.codespell.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.git
.idea
*.png
*.woff
*.woff2
*.eot
*.ttf
*.jpg
*.ico
*.svg
./charts
*.js
./site/public/*
./site/node_modules/*
26 changes: 26 additions & 0 deletions tools/linter/license/.licenserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
header:
license:
spdx-id: Apache License
copyright-owner: API Testing Authors

paths:
- "**"

paths-ignore:
- "dist"
- "licenses"
- "**/*.md"
- "LICENSE"
- "NOTICE"

comment: on-failure

language:
Go:
extensions:
- ".go"
comment_style_id: SlashAsterisk

dependency:
files:
- ../../../go.mod
15 changes: 2 additions & 13 deletions tools/make/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

DOCS_OUTPUT_DIR := site/public

LINKINATOR_IGNORE := "github.com githubusercontent.com github.com _print v0.0.1"

##@ Docs

.PHONY: docs
Expand All @@ -12,19 +14,6 @@ docs: docs.clean
cd $(ROOT_DIR)/docs/site && npm install
cd $(ROOT_DIR)/docs/site && npm run build:production

.PHONY: check-links
check-links: ## Check for broken links in the docs.
check-links: docs-check-links


.PHONY: docs-check-links
docs-check-links:
@$(LOG_TARGET)
# Check for broken links
npm install -g [email protected]
# https://github.com/JustinBeckwith/linkinator?tab=readme-ov-file#command-usage
linkinator docs/site/public -r --concurrency 25 -s "github.com _print v0.0.1"

# Docs site, make by hexo.

.PHONY: docs-serve
Expand Down
12 changes: 11 additions & 1 deletion tools/make/golang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,22 @@ go.clean: ## Clean the building output files
@$(LOG_TARGET)
rm -rf $(OUTPUT_DIR)

>PHONY: go.mod.vet
go.mod.vet:
@$(LOG_TARGET)
@go vet ./...

>PHONY: go.mod.fmt
go.mod.fmt:
@$(LOG_TARGET)
@go fmt ./...

.PHONY: go.mod.lint
lint: go.mod.lint
go.mod.lint:
@$(LOG_TARGET)
@go mod tidy -compat=$(GO_VERSION)
@go fmt ./...
@make go.mod.fmt
@if test -n "$$(git status -s -- go.mod go.sum)"; then \
git diff --exit-code go.mod; \
git diff --exit-code go.sum; \
Expand Down
40 changes: 36 additions & 4 deletions tools/make/lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

##@ Lint

GITHUB_ACTION ?=

.PHONY: lint
lint: ## Run all linter of code sources, including golint, yamllint.

Expand All @@ -14,8 +12,6 @@ lint: ## Run all linter of code sources, including golint, yamllint.
.PHONY: lint-deps
lint-deps: ## Everything necessary to lint

GOLANGCI_LINT_FLAGS ?= $(if $(GITHUB_ACTION),--out-format=github-actions)

.PHONY: lint.golint
lint: lint.golint
lint-deps: $(tools/golangci-lint)
Expand All @@ -29,3 +25,39 @@ lint-deps: $(tools/yamllint)
lint.yamllint: $(tools/yamllint)
@$(LOG_TARGET)
$(tools/yamllint) --config-file=tools/linter/yamllint/.yamllint $$(git ls-files :*.yml :*.yaml | xargs -L1 dirname | sort -u)

.PHONY: lint.markdown
lint: lint.markdown
lint-deps: $(tools/markdownlint)
lint.markdown: $(tools/markdownlint)
@$(LOG_TARGET)
$(tools/markdownlint) -c tools/linter/markdownlint/markdown_lint_config.json docs/site/content/**

.PHONY: lint.markdown.fix
lint: lint.markdown.fix
lint-deps: $(tools/markdownlint)
lint.markdown.fix: $(tools/markdownlint)
@$(LOG_TARGET)
$(tools/markdownlint) -c tools/linter/markdownlint/markdown_lint_config.json --fix docs/site/content/**

.PHONY: lint.codespell
lint: lint.codespell
lint-deps: $(tools/codespell)
lint.codespell: CODESPELL_SKIP := $(shell cat tools/linter/codespell/.codespell.skip | tr \\n ',')
lint.codespell: $(tools/codespell)
@$(LOG_TARGET)
$(tools/codespell) --skip $(CODESPELL_SKIP) --ignore-words tools/linter/codespell/.codespell.ignorewords --check-filenames

.PHONY: lint.checklinks
lint: lint.checklinks
lint-deps: $(tools/linkinator)
lint.checklinks: $(tools/linkinator) # Check for broken links in the docs
@$(LOG_TARGET)
$(tools/linkinator) docs/site/public/ -r --concurrency 25 --skip $(LINKINATOR_IGNORE)

.PHONY: lint.checklicense
lint: lint.checklicense
lint-deps: $(tools/skywalking-eyes)
lint.checklicense: $(tools/skywalking-eyes) # Check for broken links in the docs
@$(LOG_TARGET)
$(tools/skywalking-eyes) -c tools/linter/license/.licenserc.yaml header check
14 changes: 14 additions & 0 deletions tools/make/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ tools/protoc-gen-go = $(tools.bindir)/protoc-gen-go
tools/protoc-gen-go-grpc = $(tools.bindir)/protoc-gen-go-grpc
tools/goreleaser = $(tools.bindir)/goreleaser
tools/buf = $(tools.bindir)/buf
tools/skywalking-eyes = $(tools.bindir)/skywalking-eyes

$(tools.bindir)/%: $(tools.srcdir)/%/pin.go $(tools.srcdir)/%/go.mod
mkdir -p $(@D)
cd $(<D) && GOOS= GOARCH= go build -o $(abspath $@) $$(sed -En 's,^import _ "(.*)".*,\1,p' pin.go)

# `pip install`-able things
# =========================
tools/yamllint = $(tools.bindir)/yamllint
tools/codespell = $(tools.bindir)/codespell

$(tools.bindir)/%.d/venv: $(tools.srcdir)/%/requirements.txt
mkdir -p $(@D)
python3 -m venv $@
Expand All @@ -27,6 +31,16 @@ $(tools.bindir)/%: $(tools.bindir)/%.d/venv
ln -sf $*.d/venv/bin/$* $@; \
fi

# `npm install`-able things
tools/markdownlint = $(tools.bindir)/markdownlint
tools/linkinator = $(tools.bindir)/linkinator

$(tools.bindir)/%: $(tools.srcdir)/%/package.json
mkdir -p $(@D)
cd $(<D) && npm install
ln -sf $(<D)/node_modules/.bin/$* $@
ls -ahl tools/bin

tools.clean: # Remove all tools
@$(LOG_TARGET)
rm -rf $(tools.bindir)
Expand Down
1 change: 1 addition & 0 deletions tools/src/codespell/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
codespell==2.3.0
5 changes: 5 additions & 0 deletions tools/src/linkinator/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"linkinator": "^6.1.2"
}
}
5 changes: 5 additions & 0 deletions tools/src/markdownlint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"markdownlint-cli": "^0.44.0"
}
}
Loading
Loading