-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (55 loc) · 2.11 KB
/
Makefile
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
LINUX_SHELLS=dash bash zsh
STRICT_SHELLS=yash ksh
MACOS_SHELLS=bash zsh
SHELLSCRIPTS=gp
TEST_SHELLSCRIPTS=tests/bash-3.1 $(shell ls tests/*.sh)
ALL_SHELLSCRIPTS=${SHELLSCRIPTS} ${TEST_SHELLSCRIPTS}
GITHUB_ACTIONS_FILES=.github/workflows/on-pr-to-main.yml
setup-cicd-unit-tests:
apt-get update -y
apt-get install -y $(LINUX_SHELLS) $(STRICT_SHELLS)
make download-shellspec
download-shellspec:
git clone --depth 1 https://github.com/shellspec/shellspec.git external/shellspec
build-readme:
./utils/generate_readme.py ./README.template.md > ./README.md
release:
# Check version is valid
[ "$(TITLE)" != "" ] || (echo Please set the title with \`make TITLE=...\`; false)
echo "$(VERSION)" | grep '^[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?$$' || (echo Must pass version string as \`make VERSION=XX.YY[.ZZ]\`; false)
./tests/check-repo-is-clean.sh Please commit your changes before bumping version
./utils/bump-version.sh "$(VERSION)"
make build-readme
git commit -am "Bump version to $(VERSION)" -m "$(TITLE)"
gh release create --target main "v$(VERSION)" --title "$(VERSION) $(TITLE)" $(SHELLSCRIPTS)
install-to-user:
cp ${SHELLSCRIPTS} ~/bin/
./tests/test-install.sh ~/bin/
install:
cp ${SHELLSCRIPTS} /usr/bin/
./tests/test-install.sh /usr/bin/
uninstall:
echo Remove the files: ${SHELLSCRIPTS} from your PATH
check:
shellcheck ${ALL_SHELLSCRIPTS}
check-github-actions:
yamllint $(GITHUB_ACTIONS_FILES)
test-on-linux:
./tests/test-integration-all-shells.sh $(LINUX_SHELLS) ./tests/bash-3.1
test-on-strict-posix-shells:
./tests/test-integration-all-shells.sh $(STRICT_SHELLS)
test-all-on-linux:
# If this fails, check the tests/test-results.*.txt files
./tests/test-integration-all-shells.sh $(LINUX_SHELLS) $(STRICT_SHELLS) ./tests/bash-3.1
test-on-macos:
# TODO add other shells?
./tests/test-integration-all-shells.sh $(MACOS_SHELLS)
unit-test-on-linux:
./tests/test-unit-all-shells.sh $(LINUX_SHELLS)
unit-test-all-on-linux:
./tests/test-unit-all-shells.sh $(LINUX_SHELLS) $(STRICT_SHELLS)
unit-test-on-macos:
./tests/test-unit-all-shells.sh $(MACOS_SHELLS)
line-count:
cloc ${SHELLSCRIPTS}
cloc ${TEST_SHELLSCRIPTS}