-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (70 loc) · 2.51 KB
/
Copy pathMakefile
File metadata and controls
80 lines (70 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
###############################################################################
# Makefile for gh-gonest GitHub CLI extension
###############################################################################
.PHONY: clean coverage help install lint setup test
# Default target
help:
@echo "Available targets:"
@echo " clean - Clean temporary files"
@echo " coverage - Run tests with coverage analysis"
@echo " help - Show this help message and exit"
@echo " install - Install as gh extension locally"
@echo " lint - Run shellcheck linting"
@echo " setup - Install development dependencies"
@echo " test - Run BATS tests"
# Clean temporary files
clean:
@echo "Cleaning temporary files..."
rm -rf tests/coverage
# Run tests with coverage analysis
coverage:
@echo "Starting coverage analysis..."
@./tests/coverage.sh
# Install locally for testing
install:
@echo "Installing gh-gonest locally..."
gh extension install .
# Install BATS testing framework
install_bats:
@echo "Installing BATS..."
@cd /tmp && git clone https://github.com/bats-core/bats-core.git && \
cd bats-core && sudo ./install.sh /usr/local && cd /tmp && rm -rf bats-core
# Install kcov coverage tool
install_kcov:
@echo "Installing kcov..."
@sudo apt-get install -y cmake g++ libdw-dev libelf-dev libcurl4-openssl-dev
@cd /tmp && git clone https://github.com/SimonKagstrom/kcov.git && \
cd kcov && mkdir build && cd build && cmake .. && make && sudo make install && cd /tmp && rm -rf kcov
# Lint bash scripts
lint:
@echo "Linting bash scripts..."
@if command -v shellcheck >/dev/null 2>&1; then \
shellcheck gh-gonest; \
shellcheck tests/coverage.sh; \
shellcheck tests/bin/gh; \
echo "Linting passed"; \
else \
echo "shellcheck is not installed. Run 'make setup' to install dependencies"; \
fi
# Setup development dependencies
setup:
@echo "Installing test dependencies..."
@if command -v apt-get >/dev/null 2>&1; then \
sudo apt-get update && sudo apt-get install -y shellcheck; \
$(MAKE) install_bats; \
$(MAKE) install_kcov; \
else \
echo "Please install bats, shellcheck, and kcov manually:"; \
echo " - BATS: https://bats-core.readthedocs.io/"; \
echo " - kcov: https://github.com/SimonKagstrom/kcov"; \
echo " - shellcheck: https://github.com/koalaman/shellcheck"; \
fi
# Run all tests
test:
@echo "Running BATS tests..."
@if command -v bats >/dev/null 2>&1; then \
bats tests/gh-gonest.bats; \
else \
echo "BATS not installed. Run 'make setup' to install dependencies"; \
exit 1; \
fi