mirror of
https://github.com/pgsty/minio.git
synced 2026-08-08 23:33:30 +03:00
ci: make the lint, getdeps, and release gates fail honestly
Three gate-correctness fixes: - lint: `command typos && typos ./ || echo skipping` ran typos twice (POSIX `command` executes it) and, via `&& ... || echo`, turned a real typo finding (nonzero exit) into the "not installed" message with exit 0 - so spelling issues could never fail the gate. Use `command -v` to test presence and run typos once, letting its findings surface. - getdeps: `curl -sSfL ... | sh` took the pipeline's exit from sh, and make's /bin/sh has no pipefail, so a failed or partial download of the golangci-lint installer was reported as success and a truncated script could run. Download to a temp file under `set -e` (with a trap to clean it up) and execute that, so a curl failure aborts the target. Verified: a 404 now exits nonzero instead of silently continuing. - release: workflow_dispatch checked out github.ref (the branch it ran from) while naming artifacts after the input tag, so a release could be built from one ref and published under another. Pin checkout to the requested tag. Not addressed here: the server's release container image is still only built by the publish-time docker-release workflow, never in CI (MC covers this in its test-release). Flagged for a separate decision. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,11 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
# Build the code at the tag being released, not whatever branch the
|
||||
# dispatch ran from. On a tag push this is the tag ref already; on
|
||||
# workflow_dispatch it pins the checkout to the requested tag so the
|
||||
# artifacts cannot be built from one ref and published under another.
|
||||
ref: ${{ github.event.inputs.tag || github.ref }}
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
|
||||
@@ -25,8 +25,12 @@ help: ## print this help
|
||||
getdeps: ## fetch necessary dependencies
|
||||
@mkdir -p ${GOPATH}/bin
|
||||
@if [ ! -x "$(GOLANGCI)" ]; then \
|
||||
set -e; \
|
||||
echo "Installing golangci-lint $(GOLANGCI_VERSION)"; \
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_VERSION)/install.sh | sh -s -- -b $(GOLANGCI_DIR) $(GOLANGCI_VERSION); \
|
||||
script=$$(mktemp); \
|
||||
trap 'rm -f "$$script"' EXIT; \
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_VERSION)/install.sh -o "$$script"; \
|
||||
sh "$$script" -b $(GOLANGCI_DIR) $(GOLANGCI_VERSION); \
|
||||
fi
|
||||
|
||||
crosscompile: ## cross compile minio
|
||||
@@ -53,7 +57,7 @@ check-gen: ## check for updated autogenerated files
|
||||
lint: getdeps ## runs golangci-lint suite of linters
|
||||
@echo "Running $@ check"
|
||||
@$(GOLANGCI) run --build-tags kqueue --timeout=10m --config ./.golangci.yml
|
||||
@command typos && typos ./ || echo "typos binary is not found.. skipping.."
|
||||
@if command -v typos >/dev/null 2>&1; then typos ./; else echo "typos binary is not found.. skipping.."; fi
|
||||
|
||||
lint-fix: getdeps ## runs golangci-lint suite of linters with automatic fixes
|
||||
@echo "Running $@ check"
|
||||
|
||||
Reference in New Issue
Block a user