Molecule Tests #472
This file contains hidden or 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
| name: Molecule Tests | |
| ## ref: https://github.com/marketplace/actions/ansible-molecule | |
| on: | |
| ## ref: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow_dispatch | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| # Schedule updates (once daily) | |
| schedule: | |
| ## Daily Docker Image Rebuild (3:29pm daily) | |
| - cron: '29 15 * * *' | |
| jobs: | |
| run-molecule-tests: | |
| name: Molecule | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| ## ref: https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs | |
| max-parallel: 4 | |
| # max-parallel: 2 | |
| matrix: | |
| architecture: | |
| - amd64 | |
| # - arm64 | |
| image: | |
| ## NOTE: removing all RHEL based dists that do not support Python3.7+ | |
| ## ref: https://github.com/ansible/ansible/issues/82068 | |
| # - centos7-systemd-python | |
| # - centos8-systemd-python | |
| - centos9-systemd-python | |
| # - redhat7-systemd-python | |
| # - redhat8-systemd-python | |
| # - redhat9-systemd-python | |
| # - debian10-systemd-python | |
| - debian11-systemd-python | |
| - debian12-systemd-python | |
| # - ubuntu2004-systemd-python | |
| - ubuntu2204-systemd-python | |
| - ubuntu2404-systemd-python | |
| # - fedora-systemd-python | |
| scenario: | |
| - bootstrap_linux | |
| # - default | |
| # include: | |
| # - distro: centos7 | |
| # image: centos7-systemd-python | |
| # - distro: centos8 | |
| # image: centos8-systemd-python | |
| # - distro: redhat7 | |
| # image: redhat7-systemd-python | |
| # - distro: redhat8 | |
| # image: redhat8-systemd-python | |
| # - distro: debian9 | |
| # image: debian9-systemd-python | |
| # - distro: debian10 | |
| # image: debian10-systemd-python | |
| # - distro: ubuntu1804 | |
| # image: ubuntu1804-systemd-python | |
| # - distro: ubuntu2004 | |
| # image: ubuntu2004-systemd-python | |
| # - distro: ubuntu2204 | |
| # image: ubuntu2204-systemd-python | |
| steps: | |
| - name: Check out the codebase. | |
| uses: actions/checkout@v5 | |
| with: | |
| path: "${{ github.repository }}" | |
| - name: Set up Python 3. | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| #python-version: '3.x' | |
| ## ref: https://molecule.readthedocs.io/installation/#pip | |
| ## ref: https://github.com/ansible-community/molecule-plugins | |
| - name: Install control node dependencies | |
| run: | | |
| python3 -m pip install --upgrade setuptools | |
| python3 -m pip install --upgrade pip | |
| python3 -m pip install -r requirements.molecule.txt | |
| working-directory: "${{ github.repository }}" | |
| ## ref: https://github.com/robertdebock/ansible-role-python_pip/blob/master/.github/workflows/molecule.yml | |
| - name: Run Molecule tests for ${{ matrix.image }} for scenario bootstrap_linux | |
| # run: >- | |
| # molecule test | |
| # --platform-name ${{ matrix.platform }}-${{ matrix.architecture }} | |
| # --scenario-name ${{ matrix.scenario }} | |
| # run: molecule --debug test -s bootstrap-linux | |
| run: molecule test --scenario-name ${{ matrix.scenario }} | |
| env: | |
| PY_COLORS: '1' | |
| ANSIBLE_FORCE_COLOR: '1' | |
| MOLECULE_IMAGE_LABEL: ${{ matrix.image }} | |
| MOLECULE_PLATFORM: ${{ matrix.architecture }} | |
| MOLECULE_DOCKER_COMMAND: ${{ matrix.command || '/lib/systemd/systemd' }} | |
| # ## ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value | |
| # MOLECULE_DOCKER_GROUP: ${{ matrix.inventory_group || 'molecule_docker_linux_github' }} | |
| working-directory: "${{ github.repository }}" |