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

Commit

Permalink
switch to molecule v3 and circleci
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfantom committed Dec 10, 2020
1 parent 3cd6f9d commit f9b0432
Show file tree
Hide file tree
Showing 13 changed files with 154 additions and 230 deletions.
130 changes: 130 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
version: 2.1

executors:
python:
docker:
- image: cimg/python:3.9

jobs:
lint:
executor: python
steps:
- checkout
- run: pip install ansible-lint yamllint flake8
- run: ansible-lint
- run: yamllint .
- run: flake8

test:
executor: python
parameters:
ansible:
type: string
environment:
ANSIBLE: "<< parameters.ansible >>"
steps:
- checkout
- setup_remote_docker
- run: ln -s ~/project ~/${CIRCLE_PROJECT_REPONAME}
- run: pip install -r test-requirements.txt
- run: molecule test -s default --destroy always
- run: |
if [[ -d 'molecule/alternative' ]]; then
molecule test -s alternative --destroy never
else
echo 'No alternative test'
fi
- run: |
if [[ -z "${CIRCLE_PULL_REQUEST}" ]]; then
molecule test -s latest --destroy never
else
echo 'Not running latest on PR'
fi
release:
executor: python
environment:
GIT_MAIL: [email protected]
GIT_USER: cloudalchemybot
GIT_COMMIT_DESC: git log --format=%B -n 1 ${CIRCLE_SHA1}
steps:
- checkout
- setup_remote_docker
- run: pip install git-semver
- run: git config --global user.email "${GIT_MAIL}"
- run: git config --global user.name "${GIT_USER}"
- run: |
GIT_TAG=none
echo "Last commit message: ${GIT_COMMIT_DESC}"
case "${GIT_COMMIT_DESC}" in
*"[patch]"*|*"[fix]"*|*"[bugfix]"* ) GIT_TAG=$(git semver --next-patch) ;;
*"[minor]"*|*"[feat]"*|*"[feature]"* ) GIT_TAG=$(git semver --next-minor) ;;
*"[major]"*|*"[breaking change]"* ) GIT_TAG=$(git semver --next-major) ;;
*) echo "Keyword not detected. Doing nothing" && circleci-agent step halt ;;
esac
echo "GIT_TAG=${GIT_TAG}" >> $BASH_ENV
- run: |
docker run -it --rm \
-v "${CIRCLE_WORKING_DIRECTORY}:/role" \
-w "/role" \
ferrarimarco/github-changelog-generator:1.15.2 \
--user "${CIRCLE_PROJECT_USERNAME}" \
--project "${CIRCLE_PROJECT_REPONAME}" \
--token "${GH_TOKEN}" \
--release-url "https://galaxy.ansible.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME#ansible-}" \
--unreleased-label "**Next release**" --no-compare-link \
--future-release "${GIT_TAG}"
- run: git add CHANGELOG.md
- run: git commit -m "[ci skip] Automatic changelog update"
- run: git push "https://${GH_TOKEN}:@${GIT_URL}" || circleci-agent step halt
- run: |
ghr \
-t ${GH_TOKEN} \
-u ${CIRCLE_PROJECT_USERNAME} \
-r ${CIRCLE_PROJECT_REPONAME} \
-n ${GIT_TAG} \
-b "$(sed -n -e '/## \[0.22.0\]/,/## \[/ p' CHANGELOG.md | sed -e '$ d')" \
${GIT_TAG}
galaxy:
executor: python
steps:
- checkout
- run: pip install ansible
- run: ansible-galaxy role import --token "${GALAXY_TOKEN}" "${CIRCLE_PROJECT_USERNAME}" "${CIRCLE_PROJECT_REPONAME}"

workflows:
version: 2
molecule:
jobs:
- lint:
filters:
tags:
only: /.*/
- test:
matrix:
parameters:
ansible:
- "2.9"
- "2.10"
filters:
tags:
only: /.*/
- release:
context: release
requires:
- lint
- test
filters:
branches:
only: master
tags:
ignore: /.*/
- galaxy:
context: galaxy
requires:
- lint
- test
- release
filters:
branches:
only: master
2 changes: 2 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
_extends: auto-maintenance
4 changes: 0 additions & 4 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@ pull_request_rules:
merge:
method: squash
strict: true
- name: delete head branch after merge
conditions: []
actions:
delete_head_branch: {}
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

71 changes: 0 additions & 71 deletions .travis/releaser.sh

This file was deleted.

12 changes: 0 additions & 12 deletions .travis/test.sh

This file was deleted.

3 changes: 1 addition & 2 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
extends: default
ignore: |
.travis/
.travis.yml
.github/
meta/

Expand Down
18 changes: 7 additions & 11 deletions molecule/alternative/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,44 @@ dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: bionic
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: xenial
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: stretch
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:debian-9
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: buster
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:debian-10
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: centos7
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:centos-7
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: centos8
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:centos-8
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
Expand All @@ -45,6 +49,7 @@ platforms:
groups:
- python3
- name: fedora
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:fedora-30
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
Expand All @@ -54,21 +59,12 @@ platforms:
- python3
provisioner:
name: ansible
lint:
name: ansible-lint
playbooks:
create: ../default/create.yml
prepare: prepare.yml
converge: playbook.yml
destroy: ../default/destroy.yml
inventory:
group_vars:
python3:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: alternative
verifier:
name: testinfra
lint:
name: flake8
enabled: true
37 changes: 0 additions & 37 deletions molecule/default/create.yml

This file was deleted.

Loading

0 comments on commit f9b0432

Please sign in to comment.