Skip to content

Commit c0b06ea

Browse files
committed
Remove makefile redundancy
1 parent 7eb93f9 commit c0b06ea

4 files changed

Lines changed: 27 additions & 52 deletions

File tree

‎.github/workflows/cd.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
name: splunk-sdk-${{ steps.get-version.outputs.version }}
5959
path: dist/
6060
- name: Generate API reference
61-
run: make -C ./docs zip
61+
run: make docs-zip
6262
- name: Upload docs artifact
6363
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
6464
with:

‎.github/workflows/lint.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
- name: Verify uv.lock is up-to-date
2727
run: uv lock --check
2828
- name: Verify files are linted and formatted
29-
run: make ci-lint
29+
run: make lint

‎Makefile‎

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ upgrade:
2020

2121
# Workaround for make being unable to pass arguments to underlying cmd
2222
# $ SDK_DEPS_GROUP="build" make ci-install
23+
SDK_DEPS_GROUP ?= dev
24+
2325
.PHONY: ci-install
2426
ci-install:
2527
$(UV_SYNC_CMD) --frozen --group $(SDK_DEPS_GROUP)
@@ -33,44 +35,36 @@ lint-gh-actions:
3335

3436
.PHONY: lint-python
3537
lint-python:
36-
$(UV_RUN_CMD) ruff check --fix-only
37-
$(UV_RUN_CMD) ruff format
38+
$(UV_RUN_CMD) ruff check --fix-only $(if $(CI),--exit-non-zero-on-fix)
39+
$(UV_RUN_CMD) ruff format $(if $(CI),--check)
3840
$(UV_RUN_CMD) basedpyright
3941

4042
.PHONY: lint-makefile
4143
lint-makefile:
42-
$(UV_RUN_CMD) mbake format --config ./.bake.toml Makefile docs/Makefile
43-
44-
.PHONY: ci-lint
45-
ci-lint: ci-lint-python ci-lint-gh-actions ci-lint-makefile
46-
47-
.PHONY: ci-lint-gh-actions
48-
ci-lint-gh-actions:
49-
$(ZIZMOR_CMD) ./.github
50-
51-
.PHONY: ci-lint-python
52-
ci-lint-python:
53-
$(UV_RUN_CMD) ruff check --fix-only --exit-non-zero-on-fix
54-
$(UV_RUN_CMD) ruff format --check
55-
$(UV_RUN_CMD) basedpyright
56-
57-
.PHONY: ci-lint-makefile
58-
ci-lint-makefile:
59-
$(UV_RUN_CMD) mbake format --config ./.bake.toml --check Makefile docs/Makefile
60-
$(UV_RUN_CMD) mbake validate --config ./.bake.toml Makefile docs/Makefile
61-
62-
.PHONY: ci-lint-makefile
63-
ci-lint-makefile:
64-
$(UV_RUN_CMD) mbake format --config ./.bake.toml --check Makefile docs/Makefile
65-
$(UV_RUN_CMD) mbake validate --config ./.bake.toml Makefile docs/Makefile
44+
$(UV_RUN_CMD) mbake format --config ./.bake.toml $(if $(CI),--check) Makefile
45+
$(if $(CI),$(UV_RUN_CMD) mbake validate --config ./.bake.toml Makefile)
6646

6747
.PHONY: clean
6848
clean:
69-
rm -rf ./build ./dist ./.venv ./.ruff_cache ./.pytest_cache ./splunk_sdk.egg-info ./__pycache__ ./**/__pycache__
49+
rm -rf ./build ./dist ./.venv ./.ruff_cache ./.pytest_cache ./splunk_sdk.egg-info ./__pycache__
50+
find . -name __pycache__ -type d -exec rm -rf {} +
51+
52+
DOCS_BUILDDIR := docs/_build
53+
DOCS_HTMLDIR := $(DOCS_BUILDDIR)/html
54+
DOCS_ZIPFILE := $(DOCS_BUILDDIR)/splunk-sdk-python-docs.zip
7055

7156
.PHONY: docs
7257
docs:
73-
make -C ./docs html
58+
rm -rf $(DOCS_BUILDDIR)
59+
sphinx-build -b html -d $(DOCS_BUILDDIR)/doctrees ./docs $(DOCS_HTMLDIR)
60+
sh docs/munge_links.sh $(DOCS_HTMLDIR)
61+
@echo "[splunk-sdk] ---"
62+
@echo "[splunk-sdk] Build finished. HTML pages available at $(DOCS_HTMLDIR)."
63+
64+
.PHONY: docs-zip
65+
docs-zip: docs
66+
cd $(DOCS_HTMLDIR) && zip -r $(abspath $(DOCS_ZIPFILE)) .
67+
@echo "[splunk-sdk] Zip available at $(DOCS_ZIPFILE)."
7468

7569
## TESTING
7670

@@ -90,7 +84,7 @@ test-unit:
9084

9185
.PHONY: test-integration
9286
test-integration:
93-
$(PYTEST_CMD) --ff ./tests/integration ./tests/system
87+
$(PYTEST_CMD) ./tests/integration ./tests/system
9488

9589
.PHONY: test-ai
9690
test-ai:
@@ -136,8 +130,8 @@ docker-refresh: docker-remove docker-start
136130

137131
.PHONY: docker-splunk-restart
138132
docker-splunk-restart:
139-
docker exec -it $(CONTAINER_NAME) sudo sh -c '$(SPLUNK_HOME)/bin/splunk restart --run-as-root'
133+
docker exec -u splunk $(CONTAINER_NAME) $(SPLUNK_HOME)/bin/splunk restart
140134

141135
.PHONY: docker-tail-python-log
142136
docker-tail-python-log:
143-
docker exec -it $(CONTAINER_NAME) sudo tail $(SPLUNK_HOME)/var/log/splunk/python.log
137+
docker exec -u root $(CONTAINER_NAME) sudo tail -n 20 $(SPLUNK_HOME)/var/log/splunk/python.log

‎docs/Makefile‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)