Skip to content

chore: remove Ubuntu support, migrate to Debian-only #71

chore: remove Ubuntu support, migrate to Debian-only

chore: remove Ubuntu support, migrate to Debian-only #71

Workflow file for this run

---
name: Molecule CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
workflow_dispatch:
jobs:
lint:
name: Lint Ansible code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache Ansible collections
uses: actions/cache@v4
with:
path: ~/.ansible/collections
key: ansible-collections-${{ hashFiles('collections/requirements.yml') }}
restore-keys: |
ansible-collections-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ansible ansible-lint yamllint
- name: Install Ansible collections
run: |
ansible-galaxy install -r collections/requirements.yml
- name: Run yamllint
run: |
echo "## 🔍 YAML Lint Results" >> $GITHUB_STEP_SUMMARY
if yamllint . 2>&1 | tee yamllint.log; then
echo "✅ No YAML linting issues found" >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ YAML linting warnings found (non-blocking)" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
head -20 yamllint.log >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
fi
continue-on-error: true
- name: Run ansible-lint
run: |
echo "## 🔍 Ansible Lint Results" >> $GITHUB_STEP_SUMMARY
if ansible-lint local.yml 2>&1 | tee ansible-lint.log; then
echo "✅ No Ansible linting issues found" >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ Ansible linting warnings found (non-blocking)" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
head -20 ansible-lint.log >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
fi
continue-on-error: true
- name: Syntax check
run: |
echo "## ✅ Syntax Check" >> $GITHUB_STEP_SUMMARY
if ansible-playbook local.yml --syntax-check; then
echo "✅ Playbook syntax is valid" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Playbook syntax check failed" >> $GITHUB_STEP_SUMMARY
exit 1
fi
test-funcional:
name: Test funcional role
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout 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 -r requirements-dev.txt
- name: Install Ansible collections
run: |
ansible-galaxy install -r collections/requirements.yml
- name: Run Molecule tests
run: |
set -o pipefail
echo "## 🧪 Testing funcional role on debian13" >> $GITHUB_STEP_SUMMARY
cd roles/funcional
log_file="../../molecule-funcional-debian13.log"
if molecule test 2>&1 | tee "$log_file"; then
echo "✅ Tests passed for funcional on debian13" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Tests failed for funcional on debian13" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Failure excerpt" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
grep -B 5 -A 30 -E "FAILED!|fatal:|ERROR" "$log_file" | head -120 >> $GITHUB_STEP_SUMMARY || true
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
exit 1
fi
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
- name: Upload test logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: molecule-logs-funcional-debian13
path: |
molecule-funcional-debian13.log
roles/funcional/molecule/default/*.log
~/.cache/molecule/
test-developer:
name: Test developer role
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout 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 -r requirements-dev.txt
- name: Install Ansible collections
run: |
ansible-galaxy install -r collections/requirements.yml
- name: Run Molecule tests
run: |
set -o pipefail
echo "## 🧪 Testing developer role on debian13" >> $GITHUB_STEP_SUMMARY
cd roles/developer
log_file="../../molecule-developer-debian13.log"
if molecule test 2>&1 | tee "$log_file"; then
echo "✅ Tests passed for developer on debian13" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Tests failed for developer on debian13" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Failure excerpt" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
grep -B 5 -A 30 -E "FAILED!|fatal:|ERROR" "$log_file" | head -120 >> $GITHUB_STEP_SUMMARY || true
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
exit 1
fi
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
- name: Upload test logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: molecule-logs-developer-debian13
path: |
molecule-developer-debian13.log
roles/developer/molecule/default/*.log
~/.cache/molecule/
test-sysadmin:
name: Test sysadmin role
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout 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 -r requirements-dev.txt
- name: Install Ansible collections
run: |
ansible-galaxy install -r collections/requirements.yml
- name: Run Molecule tests
run: |
set -o pipefail
echo "## 🧪 Testing sysadmin role on debian13" >> $GITHUB_STEP_SUMMARY
cd roles/sysadmin
log_file="../../molecule-sysadmin-debian13.log"
if molecule test 2>&1 | tee "$log_file"; then
echo "✅ Tests passed for sysadmin on debian13" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Tests failed for sysadmin on debian13" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Failure excerpt" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
grep -B 5 -A 30 -E "FAILED!|fatal:|ERROR" "$log_file" | head -120 >> $GITHUB_STEP_SUMMARY || true
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
exit 1
fi
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
- name: Upload test logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: molecule-logs-sysadmin-debian13
path: |
molecule-sysadmin-debian13.log
roles/sysadmin/molecule/default/*.log
~/.cache/molecule/
summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [test-funcional, test-developer, test-sysadmin]
if: always()
steps:
- name: Generate test summary
run: |
echo "# 🧪 Ansible Notebooks - Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Role Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Role | Status |" >> $GITHUB_STEP_SUMMARY
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
# Funcional
if [ "${{ needs.test-funcional.result }}" == "success" ]; then
echo "| funcional | ✅ Passed |" >> $GITHUB_STEP_SUMMARY
else
echo "| funcional | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
fi
# Developer
if [ "${{ needs.test-developer.result }}" == "success" ]; then
echo "| developer | ✅ Passed |" >> $GITHUB_STEP_SUMMARY
else
echo "| developer | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
fi
# Sysadmin
if [ "${{ needs.test-sysadmin.result }}" == "success" ]; then
echo "| sysadmin | ✅ Passed |" >> $GITHUB_STEP_SUMMARY
else
echo "| sysadmin | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Platforms Tested" >> $GITHUB_STEP_SUMMARY
echo "- 🐧 Debian 13 (Trixie)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Overall status
if [ "${{ needs.test-funcional.result }}" == "success" ] && \
[ "${{ needs.test-developer.result }}" == "success" ] && \
[ "${{ needs.test-sysadmin.result }}" == "success" ]; then
echo "## ✅ Overall Status: SUCCESS" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "All tests passed successfully! 🎉" >> $GITHUB_STEP_SUMMARY
else
echo "## ❌ Overall Status: FAILED" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Some tests failed. Check individual job results for details." >> $GITHUB_STEP_SUMMARY
exit 1
fi