Skip to content

Commit 7bf6b70

Browse files
committed
switch to molecule v3 and circleci
1 parent 4c37c2d commit 7bf6b70

File tree

13 files changed

+154
-230
lines changed

13 files changed

+154
-230
lines changed

.circleci/config.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
version: 2.1
3+
4+
executors:
5+
python:
6+
docker:
7+
- image: cimg/python:3.9
8+
9+
jobs:
10+
lint:
11+
executor: python
12+
steps:
13+
- checkout
14+
- run: pip install ansible-lint yamllint flake8
15+
- run: ansible-lint
16+
- run: yamllint .
17+
- run: flake8
18+
19+
test:
20+
executor: python
21+
parameters:
22+
ansible:
23+
type: string
24+
environment:
25+
ANSIBLE: "<< parameters.ansible >>"
26+
steps:
27+
- checkout
28+
- setup_remote_docker
29+
- run: ln -s ~/project ~/${CIRCLE_PROJECT_REPONAME}
30+
- run: pip install -r test-requirements.txt
31+
- run: molecule test -s default --destroy always
32+
- run: |
33+
if [[ -d 'molecule/alternative' ]]; then
34+
molecule test -s alternative --destroy never
35+
else
36+
echo 'No alternative test'
37+
fi
38+
- run: |
39+
if [[ -z "${CIRCLE_PULL_REQUEST}" ]]; then
40+
molecule test -s latest --destroy never
41+
else
42+
echo 'Not running latest on PR'
43+
fi
44+
release:
45+
executor: python
46+
environment:
47+
48+
GIT_USER: cloudalchemybot
49+
GIT_COMMIT_DESC: git log --format=%B -n 1 ${CIRCLE_SHA1}
50+
steps:
51+
- checkout
52+
- setup_remote_docker
53+
- run: pip install git-semver
54+
- run: git config --global user.email "${GIT_MAIL}"
55+
- run: git config --global user.name "${GIT_USER}"
56+
- run: |
57+
GIT_TAG=none
58+
echo "Last commit message: ${GIT_COMMIT_DESC}"
59+
case "${GIT_COMMIT_DESC}" in
60+
*"[patch]"*|*"[fix]"*|*"[bugfix]"* ) GIT_TAG=$(git semver --next-patch) ;;
61+
*"[minor]"*|*"[feat]"*|*"[feature]"* ) GIT_TAG=$(git semver --next-minor) ;;
62+
*"[major]"*|*"[breaking change]"* ) GIT_TAG=$(git semver --next-major) ;;
63+
*) echo "Keyword not detected. Doing nothing" && circleci-agent step halt ;;
64+
esac
65+
echo "GIT_TAG=${GIT_TAG}" >> $BASH_ENV
66+
- run: |
67+
docker run -it --rm \
68+
-v "${CIRCLE_WORKING_DIRECTORY}:/role" \
69+
-w "/role" \
70+
ferrarimarco/github-changelog-generator:1.15.2 \
71+
--user "${CIRCLE_PROJECT_USERNAME}" \
72+
--project "${CIRCLE_PROJECT_REPONAME}" \
73+
--token "${GH_TOKEN}" \
74+
--release-url "https://galaxy.ansible.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME#ansible-}" \
75+
--unreleased-label "**Next release**" --no-compare-link \
76+
--future-release "${GIT_TAG}"
77+
- run: git add CHANGELOG.md
78+
- run: git commit -m "[ci skip] Automatic changelog update"
79+
- run: git push "https://${GH_TOKEN}:@${GIT_URL}" || circleci-agent step halt
80+
- run: |
81+
ghr \
82+
-t ${GH_TOKEN} \
83+
-u ${CIRCLE_PROJECT_USERNAME} \
84+
-r ${CIRCLE_PROJECT_REPONAME} \
85+
-n ${GIT_TAG} \
86+
-b "$(sed -n -e '/## \[0.22.0\]/,/## \[/ p' CHANGELOG.md | sed -e '$ d')" \
87+
${GIT_TAG}
88+
galaxy:
89+
executor: python
90+
steps:
91+
- checkout
92+
- run: pip install ansible
93+
- run: ansible-galaxy role import --token "${GALAXY_TOKEN}" "${CIRCLE_PROJECT_USERNAME}" "${CIRCLE_PROJECT_REPONAME}"
94+
95+
workflows:
96+
version: 2
97+
molecule:
98+
jobs:
99+
- lint:
100+
filters:
101+
tags:
102+
only: /.*/
103+
- test:
104+
matrix:
105+
parameters:
106+
ansible:
107+
- "2.9"
108+
- "2.10"
109+
filters:
110+
tags:
111+
only: /.*/
112+
- release:
113+
context: release
114+
requires:
115+
- lint
116+
- test
117+
filters:
118+
branches:
119+
only: master
120+
tags:
121+
ignore: /.*/
122+
- galaxy:
123+
context: galaxy
124+
requires:
125+
- lint
126+
- test
127+
- release
128+
filters:
129+
branches:
130+
only: master

.github/settings.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
_extends: auto-maintenance

.mergify.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,3 @@ pull_request_rules:
1010
merge:
1111
method: squash
1212
strict: true
13-
- name: delete head branch after merge
14-
conditions: []
15-
actions:
16-
delete_head_branch: {}

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.travis/releaser.sh

Lines changed: 0 additions & 71 deletions
This file was deleted.

.travis/test.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

.yamllint

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
---
12
extends: default
23
ignore: |
3-
.travis/
4-
.travis.yml
54
.github/
65
meta/
76

molecule/alternative/molecule.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,44 @@ dependency:
33
name: galaxy
44
driver:
55
name: docker
6-
lint:
7-
name: yamllint
86
platforms:
97
- name: bionic
8+
pre_build_image: true
109
image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04
1110
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
1211
privileged: true
1312
volumes:
1413
- /sys/fs/cgroup:/sys/fs/cgroup:ro
1514
- name: xenial
15+
pre_build_image: true
1616
image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04
1717
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
1818
privileged: true
1919
volumes:
2020
- /sys/fs/cgroup:/sys/fs/cgroup:ro
2121
- name: stretch
22+
pre_build_image: true
2223
image: quay.io/paulfantom/molecule-systemd:debian-9
2324
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
2425
privileged: true
2526
volumes:
2627
- /sys/fs/cgroup:/sys/fs/cgroup:ro
2728
- name: buster
29+
pre_build_image: true
2830
image: quay.io/paulfantom/molecule-systemd:debian-10
2931
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
3032
privileged: true
3133
volumes:
3234
- /sys/fs/cgroup:/sys/fs/cgroup:ro
3335
- name: centos7
36+
pre_build_image: true
3437
image: quay.io/paulfantom/molecule-systemd:centos-7
3538
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
3639
privileged: true
3740
volumes:
3841
- /sys/fs/cgroup:/sys/fs/cgroup:ro
3942
- name: centos8
43+
pre_build_image: true
4044
image: quay.io/paulfantom/molecule-systemd:centos-8
4145
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
4246
privileged: true
@@ -45,6 +49,7 @@ platforms:
4549
groups:
4650
- python3
4751
- name: fedora
52+
pre_build_image: true
4853
image: quay.io/paulfantom/molecule-systemd:fedora-30
4954
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
5055
privileged: true
@@ -54,21 +59,12 @@ platforms:
5459
- python3
5560
provisioner:
5661
name: ansible
57-
lint:
58-
name: ansible-lint
5962
playbooks:
60-
create: ../default/create.yml
6163
prepare: prepare.yml
6264
converge: playbook.yml
63-
destroy: ../default/destroy.yml
6465
inventory:
6566
group_vars:
6667
python3:
6768
ansible_python_interpreter: /usr/bin/python3
68-
scenario:
69-
name: alternative
7069
verifier:
7170
name: testinfra
72-
lint:
73-
name: flake8
74-
enabled: true

molecule/default/create.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)