Skip to content

Fix CI issues and update workflows for jobs : lint, sanity , unit runs #210

Fix CI issues and update workflows for jobs : lint, sanity , unit runs

Fix CI issues and update workflows for jobs : lint, sanity , unit runs #210

Workflow file for this run

---
name: "Collection Tests 🧪"
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on: # yamllint disable-line rule:truthy
pull_request:
branches: [master]
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
changelog:
uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main
if: github.event_name == 'pull_request'
build-import:
name: build-import-collection
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Ensure ansible-core and galaxy-importer is installed
shell: bash
run: |
python -m pip install ansible-core galaxy-importer
- name: Update galaxy-importer cfg
shell: bash
run: |
echo "[galaxy-importer]\nCHECK_REQUIRED_TAGS=True" > /tmp/galaxy-importer.cfg
export GALAXY_IMPORTER_CONFIG=/tmp/galaxy-importer.cfg
- name: Build the collection tarball and run galaxy importer on it
shell: bash
working-directory: ansible_collections/juniper/device
run: |
python -m galaxy_importer.main --git-clone-path . --output-path /tmp
ansible-lint:
uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main
with:
working_directory: ansible_collections/juniper/device
sanity:
name: Sanity Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.11", "3.12", "3.13", "3.14"]
ansible: ["2.17", "2.18", "2.19", "2.20"]
steps:
- uses: actions/checkout@v5
with:
ref: "${{ github.event.pull_request.head.sha }}"
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "${{ matrix.python }}"
- name: "Install tox-ansible, includes tox"
run: python -m pip install tox-ansible
- name: "Check for tox-ansible.ini file, else add default"
uses: ansible/ansible-content-actions/.github/actions/add_tox_ansible@main
- name: Copy tox-ansible.ini to collection directory
run: |
if [ -f tox-ansible.ini ]; then
cp tox-ansible.ini ansible_collections/juniper/device/
fi
- name: Run tox sanity tests
working-directory: ansible_collections/juniper/device
run: >-
python -m tox --ansible -e sanity-py${{ matrix.python }}-${{ matrix.ansible }}
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
unit-galaxy:
name: Unit Tests (Galaxy)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
ansible: ["2.17", "2.18", "2.19"]
steps:
- uses: actions/checkout@v5
with:
ref: "${{ github.event.pull_request.head.ref }}"
repository: "${{ github.event.pull_request.head.repo.full_name }}"
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "${{ matrix.python }}"
- name: "Install tox-ansible, includes tox"
run: python -m pip install tox-ansible
- name: "Check for tox-ansible.ini file, else add default"
uses: ansible/ansible-content-actions/.github/actions/add_tox_ansible@main
- name: Copy tox-ansible.ini to collection directory
run: |
if [ -f tox-ansible.ini ]; then
cp tox-ansible.ini ansible_collections/juniper/device/
fi
- name: Run tox unit tests
working-directory: ansible_collections/juniper/device
run: >-
python -m tox --ansible -e unit-py${{ matrix.python }}-${{ matrix.ansible }}
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
unit-source:
uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main
with:
collection_pre_install: >-
git+https://github.com/ansible-collections/ansible.utils.git
git+https://github.com/ansible-collections/ansible.netcommon.git
all_green:
if: ${{ always() && (github.event_name != 'schedule') }}
needs:
- changelog
- build-import
- sanity
- unit-galaxy
- ansible-lint
- unit-source
runs-on: ubuntu-latest
steps:
- run: >-
python -c "assert 'failure' not in
set([
'${{ needs.changelog.result }}',
'${{ needs.build-import.result }}',
'${{ needs.sanity.result }}',
'${{ needs.unit-galaxy.result }}',
'${{ needs.ansible-lint.result }}',
'${{ needs.unit-source.result }}'
])"