Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Halt execution when invalid options are provided #76

Merged
merged 5 commits into from Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Expand Up @@ -10,3 +10,9 @@ jobs:
- run: npm ci
- run: npm audit --production
- run: npm test -- --testPathIgnorePatterns action.test.js

functional:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: make check
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,3 +1,6 @@
# tests
tests/functional/output

# Logs
logs
*.log
Expand Down
52 changes: 52 additions & 0 deletions Makefile
@@ -0,0 +1,52 @@
SHELL := /usr/bin/env bash
IMAGEDIRS = $(shell ls -d containers/* | cut -d '/' -f 2)
BOLD := $(shell tput -T linux bold)
PURPLE := $(shell tput -T linux setaf 5)
GREEN := $(shell tput -T linux setaf 2)
CYAN := $(shell tput -T linux setaf 6)
RED := $(shell tput -T linux setaf 1)
RESET := $(shell tput -T linux sgr0)
TITLE := $(BOLD)$(PURPLE)
SUCCESS := $(BOLD)$(GREEN)

define title
@printf '$(TITLE)$(1)$(RESET)\n'
endef


.PHONY: all
all: build
@printf '$(SUCCESS)All checks pass!$(RESET)\n'

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(BOLD)$(CYAN)%-35s$(RESET)%s\n", $$1, $$2}'
@for job in $(shell egrep "\w+:$$" workflows/tests.yml | grep -v 'with:\|jobs:\|steps:' | cut -d ' ' -f 3 | cut -d ':' -f 1); do \
printf "$(BOLD)$(CYAN)%-35s$(RESET)Run %s action with act\n" $$job $$job; \
done

.PHONY: run
run: ## Run all Github Action steps as defined in the workflows directory
@for job in $(shell egrep "\w+:$$" workflows/tests.yml | grep -v 'with:\|jobs:\|steps:' | cut -d ' ' -f 3 | cut -d ':' -f 1); do \
printf "$(BOLD)$(CYAN)Running Step: %-35s$(RESET)\n" $$job; \
./act -v -W workflows -j $$job > tests/functional/output/$$job.output 2>&1; \
echo $$? >> tests/functional/output/$$job.output; \
done

.PHONY: check
check: bootstrap run ## Run all Github Action steps and then verify them with tests
python3 -m venv venv
venv/bin/pip install pytest
venv/bin/pytest tests/functional

.PHONY: boostrap
bootstrap: ## Download and install all go dependencies (+ prep tooling in the ./tmp dir)
$(call title,Boostrapping dependencies)
@pwd
# Install `act` to run the actions
curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sh -s -- -b . v0.2.17
# prep temp dirs
mkdir -p tests/functional/output


%: ## do a local build
scripts/local.sh "$*"