Skip to content
CI/CD Inventory

galaxyproject/ansible-role-extensions (opens in new tab)

1 workflow

Triggers

push pull_request workflow_dispatch

Jobs

Jobs for Test
Job Runs on Steps Actions used
Lint ubuntu-latest 6
actions/checkout@v4 actions/setup-python@v5
Unit Tests ubuntu-latest 5
actions/checkout@v4 actions/setup-python@v5 codecov/codecov-action@v4
All Tests Passed ubuntu-latest 1
Raw YAML
---
name: Test

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
  workflow_dispatch:

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements-test.txt

      - name: Install Ansible collections
        run: |
          ansible-galaxy collection install -r requirements.yml

      - name: Run yamllint
        run: |
          yamllint .

      - name: Run ansible-lint
        run: |
          ansible-lint .

  unit-tests:
    name: Unit Tests
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ['3.10', '3.11', '3.12', '3.13']
    steps:
      - name: Check out code
        uses: actions/checkout@v4

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install pytest pytest-cov ansible

      - name: Run unit tests
        run: |
          python -m pytest tests/unit/ -v --cov=library --cov-report=xml --cov-report=term

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v4
        if: matrix.python-version == '3.12'
        with:
          files: ./coverage.xml
          flags: unittests
          name: codecov-umbrella
          fail_ci_if_error: false

  # NOTE: Molecule integration tests are not run in CI due to Python interpreter
  # discovery issues when delegating tasks from Docker containers to GitHub Actions
  # runners. The custom Ansible module requires access to role template files on
  # the controller, which necessitates delegation to localhost. However, Ansible's
  # interpreter auto-discovery doesn't work correctly in this delegated context in CI.
  #
  # Molecule tests work perfectly when run locally. To run them:
  #   molecule test -s default
  #   molecule test -s templating
  #   molecule test -s versions
  #
  # See TESTING.md for more details on running tests locally.

  tests-summary:
    name: All Tests Passed
    runs-on: ubuntu-latest
    needs:
      - lint
      - unit-tests
    steps:
      - name: All tests passed
        run: echo "All tests completed successfully!"

Last fetched: