diff --git a/.yamllint b/.config/.yamllint
similarity index 100%
rename from .yamllint
rename to .config/.yamllint
diff --git a/.ansible-lint b/.config/ansible-lint.yml
similarity index 90%
rename from .ansible-lint
rename to .config/ansible-lint.yml
index 5f3c578f3..5c37fc65c 100644
--- a/.ansible-lint
+++ b/.config/ansible-lint.yml
@@ -1,3 +1,4 @@
+---
skip_list:
- yaml
- role-name
@@ -25,7 +26,7 @@ skip_list:
- var-naming[no-role-prefix]
exclude_paths:
- - roles/consul/ # TODO - https://github.com/ansible-community/ansible-consul/pull/520
- - .venv
+ - ../roles/consul/ # TODO - https://github.com/ansible-community/ansible-consul/pull/520
+ - ../.venv
# https://ansible-lint.readthedocs.io/configuring/
# https://ansible-lint.readthedocs.io/rules/
diff --git a/.config/make/docker.mak b/.config/make/docker.mak
index 6cb581ccf..bf01f1950 100644
--- a/.config/make/docker.mak
+++ b/.config/make/docker.mak
@@ -5,4 +5,9 @@ docker-build: ## Run docker build image in local
.PHONY: docker-lint
docker-lint: ## Run hadolint command to lint Dokerfile
- docker run --rm -i hadolint/hadolint < .config/gitpod/Dockerfile
\ No newline at end of file
+ docker run --rm -i hadolint/hadolint < .config/gitpod/Dockerfile
+
+.PHONY: docker-tests
+docker-tests: ## Run tests for docker
+ $(MAKE) docker-build
+ $(MAKE) docker-lint
diff --git a/.config/make/linters.mak b/.config/make/linters.mak
index 514a7393c..94775c165 100644
--- a/.config/make/linters.mak
+++ b/.config/make/linters.mak
@@ -4,7 +4,7 @@
ACTIVATE_VENV = source .venv/bin/activate
# Configuration files
-YAMLLINT_CONFIG = .yamllint
+YAMLLINT_CONFIG = .config/.yamllint
FLAKE8_CONFIG = .config/.flake8
.PHONY: linter-yamllint
@@ -17,7 +17,7 @@ linter-yamllint: ## Lint YAML files using yamllint
linter-ansible-lint: ## Lint Ansible files using ansible-lint
echo "ansible-lint #########################################################"
$(ACTIVATE_VENV) && \
- ansible-lint --force-color --offline --parseable
+ ansible-lint --force-color --parseable
.PHONY: linter-flake8
linter-flake8: ## Lint Python files using flake8
diff --git a/.config/make/python.mak b/.config/make/python.mak
index 1e21b2770..2c638a9ad 100644
--- a/.config/make/python.mak
+++ b/.config/make/python.mak
@@ -1,7 +1,7 @@
# Python default launcher
python_launcher ?= python3.10
python_requirements_file ?= requirements.txt
-python_requirements_dev_file ?= .config/requirements.dev.txt
+python_requirements_dev_file ?= .config/python/dev/requirements.txt
## —— Python —————————————————————————————————————————————————————————————————————————————————————
.PHONY: python-bootstrap
diff --git a/.config/requirements.dev.txt b/.config/python/dev/requirements.txt
similarity index 100%
rename from .config/requirements.dev.txt
rename to .config/python/dev/requirements.txt
diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml
index 00bfacb04..abf3d1ef7 100644
--- a/.github/workflows/ansible-lint.yml
+++ b/.github/workflows/ansible-lint.yml
@@ -1,5 +1,5 @@
---
-name: Ansible-lint
+name: "Ansible-lint"
on:
push:
@@ -17,10 +17,16 @@ jobs:
- name: Set TERM environment variable
run: echo "TERM=xterm" >> $GITHUB_ENV
- - name: Git clone repo postgresql_cluster
- uses: actions/checkout@v2
+ - name: Checkout
+ uses: actions/checkout@v3
- - name: Lint Ansible Playbook
- uses: ansible/ansible-lint-action@v6
+ - name: Set up Python 3.10
+ uses: actions/setup-python@v4
with:
- path: "roles/"
+ python-version: "3.10"
+
+ - name: Install dependencies
+ run: make bootstrap-dev
+
+ - name: Run Ansible-lint
+ run: make linter-ansible-lint
diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml
new file mode 100644
index 000000000..643b94664
--- /dev/null
+++ b/.github/workflows/flake8.yml
@@ -0,0 +1,32 @@
+---
+name: "Flake8"
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - master
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Set TERM environment variable
+ run: echo "TERM=xterm" >> $GITHUB_ENV
+
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Set up Python 3.10
+ uses: actions/setup-python@v4
+ with:
+ python-version: "3.10"
+
+ - name: Install dependencies
+ run: make bootstrap-dev
+
+ - name: Run Flake8
+ run: make linter-flake8
diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml
index 490cc8cc8..9ceec1ded 100644
--- a/.github/workflows/molecule.yml
+++ b/.github/workflows/molecule.yml
@@ -72,7 +72,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/molecule_pgpro.yml b/.github/workflows/molecule_pgpro.yml
index b34f7276b..bcc07ec13 100644
--- a/.github/workflows/molecule_pgpro.yml
+++ b/.github/workflows/molecule_pgpro.yml
@@ -32,7 +32,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests for PostgresPro
run: make molecule-test-scenario
diff --git a/.github/workflows/schedule_pg_almalinux8.yml b/.github/workflows/schedule_pg_almalinux8.yml
index 31f8938ee..4dfe73bc1 100644
--- a/.github/workflows/schedule_pg_almalinux8.yml
+++ b/.github/workflows/schedule_pg_almalinux8.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_almalinux9.yml b/.github/workflows/schedule_pg_almalinux9.yml
index 297771d62..f84358747 100644
--- a/.github/workflows/schedule_pg_almalinux9.yml
+++ b/.github/workflows/schedule_pg_almalinux9.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_centos8.yml b/.github/workflows/schedule_pg_centos8.yml
index 8d0c05440..b94b9991a 100644
--- a/.github/workflows/schedule_pg_centos8.yml
+++ b/.github/workflows/schedule_pg_centos8.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_centosstream8.yml b/.github/workflows/schedule_pg_centosstream8.yml
index 018d97a35..14253a858 100644
--- a/.github/workflows/schedule_pg_centosstream8.yml
+++ b/.github/workflows/schedule_pg_centosstream8.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_centosstream9.yml b/.github/workflows/schedule_pg_centosstream9.yml
index 5682de69c..b075021a4 100644
--- a/.github/workflows/schedule_pg_centosstream9.yml
+++ b/.github/workflows/schedule_pg_centosstream9.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_debian10.yml b/.github/workflows/schedule_pg_debian10.yml
index 33c07e6c5..486d3b3ac 100644
--- a/.github/workflows/schedule_pg_debian10.yml
+++ b/.github/workflows/schedule_pg_debian10.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_debian11.yml b/.github/workflows/schedule_pg_debian11.yml
index 5fbb39e70..73f6bd9e4 100644
--- a/.github/workflows/schedule_pg_debian11.yml
+++ b/.github/workflows/schedule_pg_debian11.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_oracle_linux8.yml b/.github/workflows/schedule_pg_oracle_linux8.yml
index 75abac004..2ab481fa2 100644
--- a/.github/workflows/schedule_pg_oracle_linux8.yml
+++ b/.github/workflows/schedule_pg_oracle_linux8.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_oracle_linux9.yml b/.github/workflows/schedule_pg_oracle_linux9.yml
index 807df9562..c046d76f5 100644
--- a/.github/workflows/schedule_pg_oracle_linux9.yml
+++ b/.github/workflows/schedule_pg_oracle_linux9.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_rockylinux8.yml b/.github/workflows/schedule_pg_rockylinux8.yml
index 0e1453b6f..44b571661 100644
--- a/.github/workflows/schedule_pg_rockylinux8.yml
+++ b/.github/workflows/schedule_pg_rockylinux8.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_rockylinux9.yml b/.github/workflows/schedule_pg_rockylinux9.yml
index 81e576515..927e590a4 100644
--- a/.github/workflows/schedule_pg_rockylinux9.yml
+++ b/.github/workflows/schedule_pg_rockylinux9.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_ubuntu1804.yml b/.github/workflows/schedule_pg_ubuntu1804.yml
index 40e2af378..46d745ee7 100644
--- a/.github/workflows/schedule_pg_ubuntu1804.yml
+++ b/.github/workflows/schedule_pg_ubuntu1804.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_ubuntu2004.yml b/.github/workflows/schedule_pg_ubuntu2004.yml
index ecc43c411..40fa125bf 100644
--- a/.github/workflows/schedule_pg_ubuntu2004.yml
+++ b/.github/workflows/schedule_pg_ubuntu2004.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/schedule_pg_ubuntu2204.yml b/.github/workflows/schedule_pg_ubuntu2204.yml
index 27cbc4ef9..f0924433f 100644
--- a/.github/workflows/schedule_pg_ubuntu2204.yml
+++ b/.github/workflows/schedule_pg_ubuntu2204.yml
@@ -22,7 +22,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- run: make bootstrap
+ run: make bootstrap-dev
- name: Run Molecule tests
run: make molecule-test
diff --git a/.github/workflows/yamllint.yml b/.github/workflows/yamllint.yml
index e90db31a7..c367afcda 100644
--- a/.github/workflows/yamllint.yml
+++ b/.github/workflows/yamllint.yml
@@ -1,6 +1,5 @@
---
-
-name: 'Yamllint'
+name: "Yamllint"
on:
push:
@@ -17,17 +16,17 @@ jobs:
steps:
- name: Set TERM environment variable
run: echo "TERM=xterm" >> $GITHUB_ENV
-
- - name: 'Checkout'
- uses: actions/checkout@v2
- - name: 'Run yamllint'
- uses: karancode/yamllint-github-action@master
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Set up Python 3.10
+ uses: actions/setup-python@v4
with:
- yamllint_file_or_dir: '.'
- yamllint_strict: true
- yamllint_comment: true
- env:
- GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ python-version: "3.10"
+
+ - name: Install dependencies
+ run: make bootstrap-dev
-...
+ - name: Run Yamllint
+ run: make linter-yamllint
diff --git a/.gitpod.yml b/.gitpod.yml
index a9d502204..6a932579a 100644
--- a/.gitpod.yml
+++ b/.gitpod.yml
@@ -3,4 +3,4 @@ image:
file: .config/gitpod/Dockerfile
tasks:
- - init: make bootstrap
+ - init: make bootstrap-dev
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 291c69091..6628dc2e2 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -36,8 +36,8 @@ Use Gitpod for a cloud-based development environment:
3. Open your fork in Gitpod: `https://gitpod.io/#https://github.com/username/postgresql_cluster`
4. Create a new branch: `git checkout -b my-feature-branch`
5. Make your changes and commit: `git add .` and `git commit -m "Description of changes"`
-6. Test with Molecule: `make molecule-test` or `make molecule-converge`
-7. Test with linters(otpional): `make lint`
+6. Test with Molecule: `make tests` or `make tests-fast`
+7. Test with linters: `make lint`
8. Push your changes: `git push origin my-feature-branch`
9. Create a pull request on GitHub
10. Wait for a review
@@ -48,7 +48,7 @@ Keep your Gitpod workspace synced with the main repository.
Install [make](https://www.gnu.org/software/make/), [Python3.10](https://www.python.org/), [venv](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/), and [docker](https://docs.docker.com/engine/install/ubuntu/).
-Run `make` for Makefile help. Initialize virtualenv and install dependencies with `make reinitialization` or `make bootstrap`. Test your changes with `make molecule-test` or `make molecule-converge`.
+Run `make` for Makefile help. Initialize virtualenv and install dependencies with `make reinitialization-dev` or `make bootstrap-dev`. Test your changes with `make tests` or `make molecule-converge`.
To test a specific distribution, set `distro`, `tag`, and `namespace`:
diff --git a/Makefile b/Makefile
index 380237b84..0dc39acf9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: all test SHELL
+.PHONY: all SHELL
# Makefile global config
.DEFAULT_GOAL:=help
@@ -38,23 +38,44 @@ python_launcher := python$(shell cat .config/python_version.config | cut -d '='
-include $(addsuffix /*.mak, $(shell find .config/make -type d))
+## —— Tests collection ———————————————————————————————————————————————————————————————————————
+.PHONY: tests
+tests: ## tests Ansible collection
+ $(MAKE) docker-tests
+ $(MAKE) lint
+ $(MAKE) molecule-test-all
+
+.PHONY: tests-fast
+tests-fast: ## tests Ansible collection quickly
+ $(MAKE) lint
+ $(MAKE) molecule-converge
+
## —— Bootstrap collection ———————————————————————————————————————————————————————————————————————
.PHONY: bootstrap
bootstrap: ## Bootstrap Ansible collection
$(MAKE) python-bootstrap
+
+.PHONY: bootstrap-dev
+bootstrap-dev: ## Bootstrap Ansible collection for development
+ $(MAKE) bootstrap
$(MAKE) python-bootstrap-dev
## —— Virtualenv ————————————————————————————————————————————————————————————————————————————————
.PHONY: reinitialization
reinitialization: ## Return to an initial state of Bootstrap Ansible collection
- rm -rf .venv/
- rm -rf vendor/
- rm -f *.mak
+ $(MAKE) clean
$(MAKE) bootstrap
+.PHONY: reinitialization-dev
+reinitialization-dev: ## Return to an initial state of Bootstrap Ansible collection for development
+ $(MAKE) reinitialization
+ $(MAKE) bootstrap-dev
+
.PHONY: clean
clean: ## Clean collection
rm -rf .venv/
+ rm -rf vendor/
+ rm -f *.mak
rm -rf .pytest_cache/
rm -rf scripts/.pytest_cache/
rm -rf scripts/tests/__pycache__/
diff --git a/README.md b/README.md
index 51e822ee4..9be8f1002 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,7 @@
[![Ansible Galaxy](https://img.shields.io/badge/galaxy-vitabaks.postgresql_cluster-success.svg)](https://galaxy.ansible.com/vitabaks/postgresql_cluster)
[
](https://github.com/vitabaks/postgresql_cluster/actions?query=workflow%3AAnsible-lint)
[
](https://github.com/vitabaks/postgresql_cluster/actions?query=workflow%3AYamllint)
+[
](https://github.com/vitabaks/postgresql_cluster/actions?query=workflow%3AFlake8)
[
](https://github.com/vitabaks/postgresql_cluster/actions?query=workflow%3AMolecule)
[![GitHub license](https://img.shields.io/github/license/vitabaks/postgresql_cluster)](https://github.com/vitabaks/postgresql_cluster/blob/master/LICENSE)
![GitHub stars](https://img.shields.io/github/stars/vitabaks/postgresql_cluster)
@@ -594,4 +595,4 @@ USDT (TRC20): `TSTSXZzqDCUDHDjZwCpuBkdukjuDZspwjj`
---
## Feedback, bug-reports, requests, ...
-Are [welcome](https://github.com/vitabaks/postgresql_cluster/issues)!
+Are [welcome](https://github.com/vitabaks/postgresql_cluster/issues)!
\ No newline at end of file