From 2c522f29b9952d72a15c4c1be559c9cf238a74e4 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 2 Mar 2020 22:50:38 +0000 Subject: [PATCH 1/2] fix(ci): Update test setup to work with molecule v3 --- .github/workflows/ci.yml | 4 ++-- .yamllint | 1 + molecule/change-to-non-root-user/molecule.yml | 7 +++++-- molecule/default/molecule.yml | 7 +++++-- molecule/with-config/molecule.yml | 7 +++++-- requirements.txt | 7 +++---- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 574a5b8..dede669 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,8 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y docker - python -m pip install --upgrade pip - pip install -r requirements.txt + python3 -m pip install --upgrade pip + python3 -m pip install -r requirements.txt - name: Test with molecule run: | molecule test -s ${{ matrix.scenario }} diff --git a/.yamllint b/.yamllint index ad0be76..c5ae64b 100644 --- a/.yamllint +++ b/.yamllint @@ -1,3 +1,4 @@ +--- extends: default rules: diff --git a/molecule/change-to-non-root-user/molecule.yml b/molecule/change-to-non-root-user/molecule.yml index 0a4bc66..f3e4058 100644 --- a/molecule/change-to-non-root-user/molecule.yml +++ b/molecule/change-to-non-root-user/molecule.yml @@ -3,8 +3,11 @@ dependency: name: galaxy driver: name: docker -lint: - name: yamllint +lint: | + set -e + yamllint . + ansible-lint + flake8 platforms: - name: centos-7 image: centos:7 diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 0a4bc66..f3e4058 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -3,8 +3,11 @@ dependency: name: galaxy driver: name: docker -lint: - name: yamllint +lint: | + set -e + yamllint . + ansible-lint + flake8 platforms: - name: centos-7 image: centos:7 diff --git a/molecule/with-config/molecule.yml b/molecule/with-config/molecule.yml index 0a4bc66..f3e4058 100644 --- a/molecule/with-config/molecule.yml +++ b/molecule/with-config/molecule.yml @@ -3,8 +3,11 @@ dependency: name: galaxy driver: name: docker -lint: - name: yamllint +lint: | + set -e + yamllint . + ansible-lint + flake8 platforms: - name: centos-7 image: centos:7 diff --git a/requirements.txt b/requirements.txt index 5bd5db3..a486a84 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ ansible -ansible-lint -flake8 -molecule[docker] -yamllint +molecule[docker,lint] +pytest +testinfra From 0c46a7b0ed5ddbe01f3ed9dd2563a7a3467bdd33 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 2 Mar 2020 22:31:35 +0000 Subject: [PATCH 2/2] chore: Add Makefile for common project tasks --- Makefile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2e13262 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +test: bootstrap + molecule test --all + +test-%: bootstrap + molecule test -s "$*" + +lint: bootstrap + molecule lint + +bootstrap: + $(eval PIP := $(shell which pip)) + $(if $(PIP),,$(eval PIP := $(shell which pip3))) + $(if $(PIP),,$(error No pip or pip3 found in PATH)) + + $(PIP) install -r requirements.txt + +new-version: + $(if $(shell which npx),,\ + $(error No npx not found in PATH, please install NodeJS)) + $(if $(shell which standardx-version),,\ + $(error No standard-version not found in PATH, install with: \ + npm install -g standard-version)) + + npx standard-version --tag-prefix=''