Skip to content

amine7777/molecule-action

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

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

molecule-action

This action helps you to use molecule tool for testing Ansible roles.

Usage

Since github clone the project in /github/workspace:

  • You need to add path: ${{ github.repository }} in the checkout action.

OR

  • You need to include your role by calling MOLECULE_PROJECT_DIRECTORY in converge.yml file.
- name: Include role
  include_role:
    name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"

Inputs

  command:
    description: Command to pass to molecule
    required: true
    default: molecule converge -s default
 
  working_dir:
    description: |
        Path to another directory in the repository, where molecule command will be issued from.
        Useful in those cases where Ansible roles are not in git repository root.
    required: false
    default: ${{ github.repository }}

Example

on: [push]

jobs:
  molecule:
    runs-on: ubuntu-latest
    name: molecule 
    steps:
      - name: Check out the codebase.
        uses: actions/checkout@v2
        with:
          path: ${{ github.repository }}

      - name: Create a scenario
        uses: amine7777/molecule-action@v1
        with:
          command: molecule init scenario
        env:
          PY_COLORS: '1'
          ANSIBLE_FORCE_COLOR: '1'

      - name: molecule test
        uses: amine7777/molecule-action@v1
        with:
          command: molecule test  
        env:
          PY_COLORS: '1'
          ANSIBLE_FORCE_COLOR: '1'

About

This is a simple action for using molecule

Resources

License

Stars

Watchers

Forks

Packages

No packages published