-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from outsideopen/dl/add-molecule
Update molecule testing
- Loading branch information
Showing
5 changed files
with
81 additions
and
65 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,59 @@ | ||
--- | ||
# | ||
# Ansible managed | ||
# | ||
|
||
name: Ansible Molecule | ||
|
||
on: | ||
push: | ||
tags_ignore: | ||
- '*' | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: molecule | ||
uses: ansible/ansible-lint@main | ||
test: | ||
needs: | ||
- lint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- image: ubuntu | ||
tag: noble | ||
- image: amazonlinux | ||
tag: "2023" | ||
- image: rockylinux | ||
tag: "8" | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: "${{ github.repository }}" | ||
|
||
- name: Set up Python 3 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
# we specify 2.16.11 for compatibility with amazonlinux:2 | ||
- name: Install test dependencies | ||
run: pip install molecule-docker docker requests==2.31.0 ansible-core==2.16.11 | ||
|
||
- name: molecule | ||
run: molecule test | ||
env: | ||
PY_COLORS: '1' | ||
ANSIBLE_FORCE_COLOR: '1' | ||
image: "${{ matrix.image }}" | ||
tag: "${{ matrix.tag }}" | ||
working-directory: "${{ github.repository }}" | ||
|
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
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,4 +1,4 @@ | ||
molecule-docker | ||
molecule[docker] | ||
ansible-lint | ||
yamllint | ||
pydocker |
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,18 @@ | ||
RED=$(tput setaf 1) | ||
GREEN=$(tput setaf 2) | ||
BLUE=$(tput setaf 4) | ||
RESET=$(tput sgr0) | ||
|
||
# amazonlinux:2 requires !python3 so we aren't really testing it | ||
IMAGES=${1} | ||
for image in ${IMAGES:=ubuntu:jammy ubuntu:noble amazonlinux:2023 rockylinux:8 rockylinux:9}; do | ||
echo ">> ${BLUE}INFO${RESET} Testing ${image}" | tee -a molecule/test.log | ||
tag="${image#*:}" | ||
image="${image%%:*}" tag=${tag} pipenv run molecule test >> molecule/test.log 2>&1 | ||
if [ "$?" -ne 0 ]; then | ||
echo "== ${RED}FAILURE${RESET} did not complete successfully" | tee -a molecule/test.log | ||
exit 1 | ||
else | ||
echo "== ${GREEN}SUCCESS${RESET}" | ||
fi | ||
done |