name: CI/CD Pipeline # Updated: Removed systemd, using SSH-based testing for better stability on: push: branches: [ main, develop ] pull_request: branches: [ main ] jobs: lint: name: Lint Ansible Playbooks runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.11' - name: Install dependencies run: | python -m pip install --upgrade pip pip install ansible ansible-lint yamllint - name: Lint YAML files run: | yamllint . continue-on-error: true - name: Lint Ansible playbooks run: | ansible-lint playbooks/*.yml || echo "Linting completed with warnings" continue-on-error: true - name: Validate Ansible syntax run: | for playbook in playbooks/*.yml; do ansible-playbook --syntax-check "$playbook" done test-ubuntu: name: Test on Ubuntu runs-on: ubuntu-latest needs: lint strategy: matrix: ubuntu_version: ['20.04', '22.04', '24.04'] steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.11' - name: Install Ansible run: | python -m pip install --upgrade pip pip install ansible - name: Create simple test inventory run: | mkdir -p test-inventory cat > test-inventory/hosts </dev/null || echo "v0.0.0") echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT - name: Generate changelog run: | echo "# Changelog" > CHANGELOG_RELEASE.md echo "" >> CHANGELOG_RELEASE.md git log ${{ steps.get_tag.outputs.latest_tag }}..HEAD --pretty=format:"- %s (%h)" >> CHANGELOG_RELEASE.md - name: Create Release uses: softprops/action-gh-release@v2 with: tag_name: v${{ github.run_number }} name: Release v${{ github.run_number }} body_path: CHANGELOG_RELEASE.md draft: false prerelease: false