Skip to content

feat: comprehensive project modernization and remove docker swarm support #8

feat: comprehensive project modernization and remove docker swarm support

feat: comprehensive project modernization and remove docker swarm support #8

Workflow file for this run

---
name: CI
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
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.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ansible ansible-lint yamllint
- name: Run yamllint
run: |
yamllint -c .yamllint .
continue-on-error: true
- name: Run ansible-lint
run: |
ansible-lint
continue-on-error: true
- name: Ansible syntax check
run: |
printf '[defaults]\nroles_path=../' > ansible.cfg
ansible-playbook tests/test.yml -i tests/inventory --syntax-check
test-syntax:
name: Test Syntax (Ansible ${{ matrix.ansible-version }})
runs-on: ubuntu-latest
strategy:
matrix:
ansible-version:
- '5' # ansible 5.x (includes ansible-core 2.12)
- '6' # ansible 6.x (includes ansible-core 2.13)
- '7' # ansible 7.x (includes ansible-core 2.14)
- '8' # ansible 8.x (includes ansible-core 2.15)
- '9' # ansible 9.x (includes ansible-core 2.16)
- 'latest'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version || '3.11' }}
- name: Install Ansible ${{ matrix.ansible-version }}
run: |
python -m pip install --upgrade pip
if [ "${{ matrix.ansible-version }}" = "latest" ]; then
pip install ansible
else
pip install "ansible~=${{ matrix.ansible-version }}.0"
fi
- name: Display Ansible version
run: ansible --version
- name: Syntax check
run: |
printf '[defaults]\nroles_path=../' > ansible.cfg
ansible-playbook tests/test.yml -i tests/inventory --syntax-check
test-integration:
name: Integration Tests (Ansible ${{ matrix.ansible-version }})
runs-on: ubuntu-latest
needs: [lint, test-syntax]
strategy:
matrix:
ansible-version:
- '5' # Oldest supported version
- '7' # Mid-range version
- '9' # Recent stable version
- 'latest' # Latest release
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version || '3.11' }}
- name: Install Ansible ${{ matrix.ansible-version }}
run: |
python -m pip install --upgrade pip
if [ "${{ matrix.ansible-version }}" = "latest" ]; then
pip install ansible docker
else
pip install "ansible~=${{ matrix.ansible-version }}.0" docker
fi
- name: Install Ansible collections
run: |
if [ "${{ matrix.ansible-version }}" = "5" ]; then
echo "Installing community.docker collection (workaround for Galaxy API issues with Ansible ${{ matrix.ansible-version }})"
ansible-galaxy collection install community.docker || echo "Collection install failed, but will continue with docker Python library"
else
ansible-galaxy collection install -r requirements.yml
fi
- name: Display Ansible version
run: ansible --version
- name: Setup test environment
run: |
printf '[defaults]\nroles_path=../' > ansible.cfg
- name: Run tests
run: make test-all
test-molecule:
name: Molecule Tests
runs-on: ubuntu-latest
needs: [lint]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install molecule molecule-plugins[docker] ansible docker
- name: Run Molecule tests
run: |
molecule test
continue-on-error: true
working-directory: ${{ github.workspace }}
notify:
name: Notify Ansible Galaxy
runs-on: ubuntu-latest
needs: [test-integration]
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
steps:
- name: Trigger galaxy import
run: |
echo "Would notify Ansible Galaxy here"
# curl -X POST https://galaxy.ansible.com/api/v1/notifications/