Skip to content

Set up your GitHub Actions workflow with the Ansible testing framework Molecule.

License

Notifications You must be signed in to change notification settings

bec-galaxy/setup-molecule

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

molecule logo

setup-molecule

Test

This action provides the following functionality for GitHub Actions users:

  • Installing Python.
  • Installing the latest version of Molecule with Docker.

This action is a rolling release, it will install the latest dependencies on each run. Use the official Ansible action for more stability. See Ansible Creator Execution Environment for additional information.

Basic usage

See action.yml

Molecule

steps:
  - name: Checkout the codebase
    uses: actions/checkout@v3

  - name: Setup Molecule
    uses: bec-galaxy/setup-molecule@{Version}

  - name: Run Molecule tests
    run: molecule test

Lint and Molecule

---
name: Molecule

"on":
  pull_request:

env:
  PY_COLORS: "1"
  ANSIBLE_FORCE_COLOR: "1"
jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - name: Checkout the codebase
        uses: actions/checkout@v3

      - name: Setup Lint
        uses: bec-galaxy/setup-lint@{Version}

      - name: Run Lint tests
        run: ansible-lint

  molecule:
    name: Molecule
    runs-on: ubuntu-latest
    needs: lint
    steps:
      - name: Checkout the codebase
        uses: actions/checkout@v3

      - name: Setup Molecule
        uses: bec-galaxy/setup-molecule@{Version}

      - name: Run Molecule tests
        run: molecule test

Built-in Lint support has been removed from Molecule.

Environment variables PY_COLORS and ANSIBLE_FORCE_COLOR are optional and only activate the color output in the pipline.

Packages

The following python packages are installed in this action:

Package molecule-plugins is a breaking change and is required since molecule version 5.0.0.

Molecule file

A Molecule sample file for this action.

---
dependency:
  name: galaxy
driver:
  name: docker
platforms:
  - name: ubuntu-20.04
    image: ubuntu:20.04
  - name: ubuntu-22.04
    image: ubuntu:22.04
provisioner:
  name: ansible
  inventory:
    group_vars:
      all:
        ansible_user: root
scenario:
  name: default

Licence

This project is licensed under MIT - See the LICENSE file for more information.


Back to top