Skip to content
This repository was archived by the owner on Nov 12, 2023. It is now read-only.

Commit af491b5

Browse files
committed
migrate to circleci and molecule v3
1 parent 1e79224 commit af491b5

File tree

16 files changed

+156
-300
lines changed

16 files changed

+156
-300
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/labels.yml

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

.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

.github/workflows/labels.yml

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

.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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
extends: default
23
ignore: |
34
.travis/

0 commit comments

Comments
 (0)