Joey Armstrong | 6540541 | 2022-11-22 10:43:06 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 3 | # Makefile for testing JJB jobs in a virtualenv |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 4 | .PHONY: test clean |
| 5 | |
Matteo Scandolo | 08900f7 | 2021-09-07 15:01:10 -0700 | [diff] [blame] | 6 | SHELL = bash -e -o pipefail |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 7 | VENV_DIR ?= venv-jjb |
Zack Williams | 5f25716 | 2022-07-25 14:22:29 -0700 | [diff] [blame] | 8 | JJB_VERSION ?= 4.1.0 |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 9 | JOBCONFIG_DIR ?= job-configs |
| 10 | |
| 11 | $(VENV_DIR): |
| 12 | @echo "Setting up virtualenv for JJB testing" |
Zack Williams | be54231 | 2022-06-23 21:51:32 -0700 | [diff] [blame] | 13 | python3 -m venv $@ |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 14 | $@/bin/pip install jenkins-job-builder==$(JJB_VERSION) pipdeptree |
| 15 | |
| 16 | $(JOBCONFIG_DIR): |
| 17 | mkdir $@ |
| 18 | |
Zack Williams | 9ac51db | 2018-04-16 16:44:24 -0700 | [diff] [blame] | 19 | lint: |
| 20 | yamllint -c yamllint.conf jjb/ |
| 21 | |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 22 | test: $(VENV_DIR) $(JOBCONFIG_DIR) |
| 23 | source $(VENV_DIR)/bin/activate ; \ |
| 24 | pipdeptree ; \ |
Zack Williams | 1c5c525 | 2018-04-20 13:50:44 -0700 | [diff] [blame] | 25 | jenkins-jobs -l DEBUG test --recursive --config-xml -o $(JOBCONFIG_DIR) jjb/ ; |
Zack Williams | c2140b9 | 2018-04-05 09:19:22 -0700 | [diff] [blame] | 26 | |
| 27 | clean: |
Joey Armstrong | 6540541 | 2022-11-22 10:43:06 -0500 | [diff] [blame] | 28 | $(RM) -r $(VENV_DIR) $(JOBCONFIG_DIR) |
| 29 | |
| 30 | # [EOF] |