Skip to content
This repository has been archived by the owner on Jan 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #6 from ansible-community/devel
Browse files Browse the repository at this point in the history
Made driver compatible with molecule 3.2
  • Loading branch information
ssbarnea authored Oct 29, 2020
2 parents cb7c859 + 35829a5 commit e27e24a
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 74 deletions.
23 changes: 16 additions & 7 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
# Format and labels used aim to match those used by Ansible project
categories:
- title: 'Features'
- title: 'Major Changes'
labels:
- 'feature'
- 'enhancement'
- title: 'Bug Fixes'
- 'major' # c6476b
- title: 'Minor Changes'
labels:
- 'feature' # 006b75
- 'enhancement' # ededed
- 'performance' # 555555
- title: 'Bugfixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: 'Maintenance'
label: 'chore'
- 'bug' # fbca04
- 'docs' # 4071a5
- 'packaging' # 4071a5
- 'test' # #0e8a16
- title: 'Deprecations'
labels:
- 'deprecated' # fef2c0
exclude-labels:
- 'skip-changelog'
template: |
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
- 'releases/**'
- 'stable/**'

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146 changes: 146 additions & 0 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: tox

on:
create: # is used for publishing to TestPyPI
tags: # any tag regardless of its name, no branches
- "**"
push: # only publishes pushes to the main branch to TestPyPI
branches: # any integration branch but not tag
- "master"
pull_request:
release:
types:
- published # It seems that you can publish directly without creating
schedule:
- cron: 1 0 * * * # Run daily at 0:01 UTC

jobs:
build:
name: ${{ matrix.tox_env }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- tox_env: lint
# - tox_env: docs
- tox_env: py36
PREFIX: PYTEST_REQPASS=1
- tox_env: py36-devel
PREFIX: PYTEST_REQPASS=1
- tox_env: py37
PREFIX: PYTEST_REQPASS=1
- tox_env: py38
PREFIX: PYTEST_REQPASS=1
- tox_env: py39
PREFIX: PYTEST_REQPASS=1
- tox_env: py39-devel
PREFIX: PYTEST_REQPASS=1
- 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 docker_container
- 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: |
docker version
docker info
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 }}
publish:
name: Publish to PyPI registry
needs:
- build
runs-on: ubuntu-latest

env:
PY_COLORS: 1
TOXENV: packaging

steps:
- name: Switch to using Python 3.6 by default
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install tox
run: python -m pip install --user tox
- name: Check out src from Git
uses: actions/checkout@v2
with:
# Get shallow Git history (default) for release events
# but have a complete clone for any other workflows.
# Both options fetch tags but since we're going to remove
# one from HEAD in non-create-tag workflows, we need full
# history for them.
fetch-depth: >-
${{
(
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
) ||
github.event_name == 'release'
) &&
1 || 0
}}
- name: Drop Git tags from HEAD for non-tag-create and non-release events
if: >-
(
github.event_name != 'create' ||
github.event.ref_type != 'tag'
) &&
github.event_name != 'release'
run: >-
git tag --points-at HEAD
|
xargs git tag --delete
- name: Build dists
run: python -m tox
- name: Publish to test.pypi.org
if: >-
(
github.event_name == 'push' &&
github.ref == format(
'refs/heads/{0}', github.event.repository.default_branch
)
) ||
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
)
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 }}
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default_language_version:
minimum_pre_commit_version: "1.14.0"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
rev: v3.3.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -19,22 +19,22 @@ repos:
# https://github.com/pre-commit/pre-commit-hooks/issues/273
args: ["--unsafe"]
- repo: https://github.com/PyCQA/doc8.git
rev: 0.8.1rc3
rev: 0.9.0a1
hooks:
- id: doc8
- repo: https://github.com/python/black.git
rev: 19.10b0
rev: 20.8b1
hooks:
- id: black
language_version: python3
- repo: https://gitlab.com/pycqa/flake8.git
rev: 3.7.9
rev: 3.8.4
hooks:
- id: flake8
additional_dependencies:
- flake8-black
- repo: https://github.com/codespell-project/codespell.git
rev: v1.16.0
rev: v1.17.1
hooks:
- id: codespell
name: codespell
Expand All @@ -46,7 +46,7 @@ repos:
require_serial: false
additional_dependencies: []
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.21.0
rev: v1.25.0
hooks:
- id: yamllint
files: \.(yaml|yml)$
Expand All @@ -65,7 +65,7 @@ repos:
# use jinja templating, this will often fail and the syntax
# error will be discovered in execution anyway)
- repo: https://github.com/ansible/ansible-lint.git
rev: v4.2.0
rev: v4.3.5
hooks:
- id: ansible-lint
always_run: true
Expand Down
2 changes: 1 addition & 1 deletion molecule_lxd/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def sanity_checks(self):
pass

def template_dir(self):
""" Return path to its own cookiecutterm templates. It is used by init
"""Return path to its own cookiecutterm templates. It is used by init
command in order to figure out where to load the templates from.
"""
return os.path.join(os.path.dirname(__file__), "cookiecutter")
Expand Down
7 changes: 5 additions & 2 deletions playbooks/ensure-lxd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
tasks:

- name: Install LXD as a snap
shell: snap install lxd
command: snap install lxd
register: _snap_install_result
changed_when: not(_snap_install_result.stderr is search('already installed'))

Expand Down Expand Up @@ -43,8 +43,11 @@
copy:
content: "{{ _lxd_preseed_config | to_nice_yaml }}"
dest: /tmp/lxd-preseed.yml
mode: 0600
register: _lxd_preseed_file_result

- name: Configure LXD with preseed file
shell: cat /tmp/lxd-preseed.yml | lxd init --preseed
shell: |
set -euo pipefail
cat /tmp/lxd-preseed.yml | lxd init --preseed
when: _lxd_preseed_file_result is changed
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pytest]
addopts = -v -rxXs --doctest-modules --durations 10 --cov=molecule_* --cov-report term-missing:skip-covered --cov-report xml
addopts = -v -rxXs --doctest-modules --durations 10
doctest_optionflags = ALLOW_UNICODE ELLIPSIS
junit_suite_name = molecule_test_suite
norecursedirs = dist doc build .tox .eggs test/scenarios test/resources
23 changes: 4 additions & 19 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[aliases]
dists = clean --all sdist bdist_wheel

[bdist_wheel]
universal = 1

[metadata]
name = molecule-lxd
url = https://github.com/ansible-community/molecule-lxd
Expand Down Expand Up @@ -33,9 +30,10 @@ classifiers =
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9

Topic :: System :: Systems Administration
Topic :: Utilities
Expand All @@ -62,25 +60,12 @@ setup_requires =

# These are required in actual runtime:
install_requires =
ansible
molecule >= 3.0.2
molecule >= 3.2.0a0
pyyaml >= 5.1, < 6

[options.extras_require]
test =
ansi2html # soft-dependency of pytest-html
flake8>=3.6.0, < 4

mock>=3.0.5, < 4
pytest-cov>=2.7.1, < 3
pytest-dependency
pytest-helpers-namespace>=2019.1.8, < 2020
pytest-html
pytest-mock>=1.10.4, < 2
pytest-plus
pytest-verbose-parametrize>=1.7.0, < 2
pytest-xdist>=1.29.0, < 2
pytest>=4.6.3
molecule[test]

[options.entry_points]
molecule.driver =
Expand Down
Loading

0 comments on commit e27e24a

Please sign in to comment.