Skip to content

Commit

Permalink
ci: Run molecule with GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
btravouillon committed Aug 27, 2023
1 parent cf7f95b commit 822d8c1
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 10 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Molecule unit testing
on:
push:
branches:
- b2-next
paths-ignore:
- '**.md'
- '**.rst'
pull_request:
paths-ignore:
- '**.md'
- '**.rst'

jobs:
molecule_test:
name: ${{ matrix.distro }} - molecule test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
distro:
- debian-systemd:bullseye

env:
MOLECULE_DISTRO: ${{ matrix.distro }}
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: mila.bareos

- name: Setup python environment
uses: actions/setup-python@v3

- name: Install packages
run: pip install tox

- name: Run molecule test
run: |
cd mila.bareos && tox
22 changes: 12 additions & 10 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
dependency:
name: galaxy
driver:
name: hetznercloud
name: docker
platforms:
- name: ${REPO_NAME}-${OS_VERSION}-${REF}-server
server_type: cx11
image: ${MOLECULE_IMAGE}
custom_ssh_key_name: molecule.admin
- name: server
image: "quay.io/actatux/${MOLECULE_DISTRO:-debian-systemd:bullseye}"
override_command: false
privileged: true
pre_build_image: true
groups:
- server
- name: ${REPO_NAME}-${OS_VERSION}-${REF}-client
server_type: cx11
image: ${MOLECULE_IMAGE}
custom_ssh_key_name: molecule.admin
- name: client
image: "quay.io/actatux/${MOLECULE_DISTRO:-debian-systemd:bullseye}"
override_command: false
privileged: true
pre_build_image: true
groups:
- client
provisioner:
name: ansible
verifier:
name: testinfra
name: ansible
19 changes: 19 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[tox]
envlist = ansible{7,8}
skipsdist = true

[testenv]
changedir = {env:PWD}
passenv =
MOLECULE_DISTRO
INSTANCE_DISTRO
TERM
PY_COLORS
ANSIBLE_FORCE_COLOR
deps =
ansible7: ansible>=7.0,<8.0
ansible8: ansible>=8.0,<9.0
molecule
molecule-plugins[docker]
commands =
molecule test

0 comments on commit 822d8c1

Please sign in to comment.