-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (43 loc) · 1.48 KB
/
Makefile
File metadata and controls
57 lines (43 loc) · 1.48 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
# Makefile for plugin-lib-powershell
# Copyright (C) 2003-2026 ITRS Group Ltd. All rights reserved
# Use bash as shell
SHELL=/bin/bash
# Project name
PROJECT=plugin-lib-powershell
# Project version
VERSION=$(shell cat VERSION)
# Project release number (packaging build number)
RELEASE=$(shell cat RELEASE)
# Current directory and paths
CURRENTDIR=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
SCRIPTS_DIR = $(CURRENTDIR)PlugNpshell/
TEST_DIR=$(CURRENTDIR)Test
POWERSHELL_BIN=sudo /opt/opsview/powershell/pwsh
POWERSHELL_SCRIPT_ANALYZER_VERSION=1.18.3
POWERSHELL_PESTER_VERSION=4.9.0
# --- MAKE TARGETS ---
# Display general help about this command
help:
@echo ""
@echo "$(PROJECT) Makefile."
@echo "The following commands are available:"
@echo ""
@echo " make qa : Execute all tests and code linters"
@echo ""
all: help
.PHONY: test-plugins
test-plugins:
-${POWERSHELL_BIN} -Command Import-Module Pester -RequiredVersion ${POWERSHELL_PESTER_VERSION} -Force
@for f in ${SCRIPTS_DIR}/*.ps1; do \
${POWERSHELL_BIN} -Command Invoke-Pester $(TEST_DIR)/*.Tests.ps1 -CodeCoverage "$${f}"; done
.PHONY: test
test: test-plugins
.PHONY: script-analyzer-plugins
script-analyzer-plugins:
-${POWERSHELL_BIN} -Command Import-Module PSScriptAnalyzer -RequiredVersion ${POWERSHELL_SCRIPT_ANALYZER_VERSION} -Force
@for f in ${SCRIPTS_DIR}/*.ps1; do \
${POWERSHELL_BIN} -Command Invoke-ScriptAnalyzer "$${f}"; done
.PHONY: lint
lint: script-analyzer-plugins
.PHONY: qa
qa: test lint