-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
89 changed files
with
3,311 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# .ansible-lint | ||
exclude_paths: | ||
- .cache/ # implicit unless exclude_paths is defined in config | ||
- .github/ | ||
- packages/**/cookiecutter/{{* | ||
# - src/molecule_gce/cookiecutter/{{cookiecutter.molecule_directory}} | ||
|
||
skip_list: | ||
# Temporary skips made during migration | ||
- fqcn-builtins | ||
- yaml[line-length] | ||
- var-spacing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[flake8] | ||
# do not add excludes for files in repo | ||
exclude = .venv/,.tox/,dist/,build/,.eggs/ | ||
format = pylint | ||
# E203: https://github.com/python/black/issues/315 | ||
ignore = E741,W503,W504,H,E501,E203 | ||
# 88 is official black default: | ||
max-line-length = 88 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/enabling-and-disabling-dependabot-version-updates | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 3 | ||
labels: | ||
- "dependencies" | ||
- "skip-changelog" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# see https://github.com/ansible-community/devtools | ||
_extends: ansible-community/devtools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/ack.yml | ||
name: ack | ||
on: | ||
pull_request_target: | ||
types: [opened, labeled, unlabeled, synchronize] | ||
|
||
jobs: | ||
ack: | ||
uses: ansible-community/devtools/.github/workflows/ack.yml@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/push.yml | ||
name: push | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'releases/**' | ||
- 'stable/**' | ||
|
||
jobs: | ||
ack: | ||
uses: ansible-community/devtools/.github/workflows/push.yml@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
pypi: | ||
name: Publish to PyPI registry | ||
environment: release | ||
runs-on: ubuntu-20.04 | ||
|
||
env: | ||
FORCE_COLOR: 1 | ||
PY_COLORS: 1 | ||
TOXENV: packaging | ||
TOX_PARALLEL_NO_SPINNER: 1 | ||
|
||
steps: | ||
- name: Switch to using Python 3.8 by default | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install tox | ||
run: >- | ||
python3 -m | ||
pip install | ||
--user | ||
tox | ||
- name: Check out src from Git | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # needed by setuptools-scm | ||
- name: Build dists | ||
run: python -m tox | ||
- name: Publish to test.pypi.org | ||
if: >- # "create" workflows run separately from "push" & "pull_request" | ||
github.event_name == 'release' | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{ secrets.testpypi_password }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
- name: Publish to pypi.org | ||
if: >- # "create" workflows run separately from "push" & "pull_request" | ||
github.event_name == 'release' | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{ secrets.pypi_password }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: tox | ||
|
||
on: | ||
push: # only publishes pushes to the main branch to TestPyPI | ||
branches: # any integration branch but not tag | ||
- "main" | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.tox_env }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- tox_env: lint | ||
# - tox_env: docs | ||
- tox_env: py38 | ||
PREFIX: PYTEST_REQPASS=3 | ||
- tox_env: py39 | ||
PREFIX: PYTEST_REQPASS=3 | ||
- tox_env: py310 | ||
PREFIX: PYTEST_REQPASS=3 | ||
- tox_env: py310-devel | ||
PREFIX: PYTEST_REQPASS=3 | ||
- tox_env: packaging | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Install system dependencies | ||
run: | | ||
sudo apt-get update \ | ||
&& sudo apt-get install -y ansible \ | ||
&& ansible-doc -l | grep gce | ||
- name: Find python version | ||
id: py_ver | ||
shell: python | ||
if: ${{ contains(matrix.tox_env, 'py') }} | ||
run: | | ||
v = '${{ matrix.tox_env }}'.split('-')[0].lstrip('py') | ||
print('::set-output name=version::{0}.{1}'.format(v[0],v[1:])) | ||
# Even our lint and other envs need access to tox | ||
- name: Install a default Python | ||
uses: actions/setup-python@v2 | ||
if: ${{ ! contains(matrix.tox_env, 'py') }} | ||
# Be sure to install the version of python needed by a specific test, if necessary | ||
- name: Set up Python version | ||
uses: actions/setup-python@v2 | ||
if: ${{ contains(matrix.tox_env, 'py') }} | ||
with: | ||
python-version: ${{ steps.py_ver.outputs.version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip | ||
pip install tox | ||
- name: Run tox -e ${{ matrix.tox_env }} | ||
run: | | ||
echo "${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }}" | ||
${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
ci: | ||
skip: | ||
# https://github.com/pre-commit-ci/issues/issues/55 | ||
- ansible-lint | ||
default_language_version: | ||
python: python3 | ||
minimum_pre_commit_version: "1.14.0" | ||
repos: | ||
- repo: https://github.com/PyCQA/doc8.git | ||
rev: 0.11.2 | ||
hooks: | ||
- id: doc8 | ||
- repo: https://github.com/psf/black | ||
rev: 22.6.0 | ||
hooks: | ||
- id: black | ||
language_version: python3 | ||
- repo: https://github.com/pre-commit/pre-commit-hooks.git | ||
rev: v4.3.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: mixed-line-ending | ||
- id: check-byte-order-marker | ||
- id: check-executables-have-shebangs | ||
- id: check-merge-conflict | ||
- id: debug-statements | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 4.0.1 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: | ||
- flake8-black | ||
- repo: https://github.com/ansible/ansible-lint.git | ||
rev: v6.3.0 | ||
hooks: | ||
- id: ansible-lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
# molecule-cloud | ||
Collection on molecule plugins using clouds for provisioning | ||
# molecule-plugins | ||
|
||
This monorepo contains the following molecule plugins: | ||
|
||
- azure | ||
- gce | ||
|
||
Each plugin is an python package that is uploaded to pypi on release and you | ||
can install it directly. | ||
|
||
Usually, there is no need to install `molecule-plugins` as this can be seen | ||
as a meta-package, one with no content. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
set -exuo pipefail | ||
|
||
# for DIR in packages/*; do | ||
# echo $DIR | ||
python3 -m build packages/* | ||
#$DIR | ||
# done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -exuo pipefail | ||
|
||
mkdir -p dist | ||
for DIR in packages/*; do | ||
python3 -m build --outdir dist/ $DIR | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import contextlib | ||
import os | ||
import random | ||
import string | ||
|
||
import pytest | ||
from molecule import config, logger, util | ||
from molecule.scenario import ephemeral_directory | ||
|
||
LOG = logger.get_logger(__name__) | ||
|
||
|
||
@pytest.helpers.register | ||
def run_command(cmd, env=os.environ, log=True): | ||
if cmd.__class__.__name__ == "Command": | ||
if log: | ||
cmd = _rebake_command(cmd, env) | ||
cmd = cmd.bake(_truncate_exc=False) | ||
return util.run_command(cmd, env=env) | ||
|
||
|
||
def _rebake_command(cmd, env, out=LOG.info, err=LOG.error): | ||
return cmd.bake(_env=env, _out=out, _err=err) | ||
|
||
|
||
@pytest.fixture | ||
def random_string(length=5): | ||
return "".join((random.choice(string.ascii_uppercase) for _ in range(length))) | ||
|
||
|
||
@contextlib.contextmanager | ||
def change_dir_to(dir_name): | ||
cwd = os.getcwd() | ||
os.chdir(dir_name) | ||
yield | ||
os.chdir(cwd) | ||
|
||
|
||
@pytest.fixture | ||
def temp_dir(tmpdir, random_string, request): | ||
directory = tmpdir.mkdir(random_string) | ||
|
||
with change_dir_to(directory.strpath): | ||
yield directory | ||
|
||
|
||
@pytest.fixture | ||
def resources_folder_path(): | ||
resources_folder_path = os.path.join(os.path.dirname(__file__), "resources") | ||
return resources_folder_path | ||
|
||
|
||
@pytest.helpers.register | ||
def molecule_project_directory(): | ||
return os.getcwd() | ||
|
||
|
||
@pytest.helpers.register | ||
def molecule_directory(): | ||
return config.molecule_directory(molecule_project_directory()) | ||
|
||
|
||
@pytest.helpers.register | ||
def molecule_scenario_directory(): | ||
return os.path.join(molecule_directory(), "default") | ||
|
||
|
||
@pytest.helpers.register | ||
def molecule_file(): | ||
return get_molecule_file(molecule_scenario_directory()) | ||
|
||
|
||
@pytest.helpers.register | ||
def get_molecule_file(path): | ||
return config.molecule_file(path) | ||
|
||
|
||
@pytest.helpers.register | ||
def molecule_ephemeral_directory(_fixture_uuid): | ||
project_directory = "test-project-{}".format(_fixture_uuid) | ||
scenario_name = "test-instance" | ||
|
||
return ephemeral_directory( | ||
os.path.join("molecule_test", project_directory, scenario_name) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[mypy] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019 Sorin Sbarnea | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include LICENSE | ||
include README.rst | ||
|
||
recursive-exclude * __pycache__ | ||
recursive-exclude * *.py[co] |
Oops, something went wrong.