Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Make CI better again #714

Merged
merged 5 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 57 additions & 23 deletions .github/workflows/pull-request-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
docs: ${{ steps.filter.outputs.docs }}
python: ${{ steps.filter.outputs.python }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
Expand Down Expand Up @@ -63,6 +63,7 @@ jobs:
- 'mkdocs.yml'
- 'ansible_collections/arista/cvp/docs/**'
- 'ansible_collections/arista/cvp/roles/**/README.md'
- 'ansible_collections/arista/cvp/index.md'
- '.github/workflows/*'
python:
- 'ansible_collections/arista/cvp/plugins/**/*.py'
Expand All @@ -82,11 +83,11 @@ jobs:
steps:
# Removed as gh action is marked as deprecated
# - uses: pre-commit/action@v2.0.2
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install requirements
Expand All @@ -111,9 +112,9 @@ jobs:
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Test code compatibility
Expand All @@ -136,9 +137,9 @@ jobs:
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install requirements
Expand All @@ -150,7 +151,7 @@ jobs:
run: |
cd tests/
make unit-tests
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: pytest-report
path: |
Expand All @@ -165,7 +166,7 @@ jobs:
matrix:
ansible_version:
- 'ansible-core>=2.15.0,<2.18.0 --upgrade'
avd_scenario:
cvp_scenario:
- cv_configlet_loose
- cv_configlet_strict
- cv_device
Expand All @@ -176,33 +177,31 @@ jobs:
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.8.1
with:
molecule_parentdir: 'ansible_collections/arista/cvp'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
molecule_args: '--scenario-name ${{ matrix.cvp_scenario }}'
pip_file: ansible_collections/arista/cvp/requirements.txt
galaxy_file: "ansible_collections/arista/cvp/collections.yml"
ansible: "${{ matrix.ansible_version }}"
check_git: true
check_git_enforced: false
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: molecule-${{ matrix.avd_scenario }}-artifacts
path: ansible_collections/arista/cvp/molecule/${{ matrix.avd_scenario }}
name: molecule-${{ matrix.cvp_scenario }}-artifacts
path: ansible_collections/arista/cvp/molecule/${{ matrix.cvp_scenario }}

molecule_dhcp:
name: Validate Roles for DHCP management
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
# ansible_version: ['ansible-core==2.11.3', 'ansible-core>=2.11.3']
# XXX:
ansible_version: ['ansible-core==2.15.0', 'ansible-core>=2.17.0']
avd_scenario:
ansible_version: ['ansible-core==2.15.0', 'ansible-core<2.18.0']
cvp_scenario:
- dhcp_management_mac
- dhcp_management_offline
- dhcp_system_mac
Expand All @@ -213,13 +212,13 @@ jobs:
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.8.1
with:
molecule_parentdir: 'ansible_collections/arista/cvp'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
molecule_args: '--scenario-name ${{ matrix.cvp_scenario }}'
pip_file: ansible_collections/arista/cvp/requirements.txt
galaxy_file: "ansible_collections/arista/cvp/collections.yml"
ansible: "${{ matrix.ansible_version }}"
Expand Down Expand Up @@ -279,9 +278,9 @@ jobs:
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: 'Install Python requirements'
Expand Down Expand Up @@ -312,3 +311,38 @@ jobs:
run: |
cd ansible_collections/arista/cvp/
ansible-lint --force-color --strict -v

# ----------------------------------- #
# Galaxy Importer
# ----------------------------------- #
galaxy_importer:
name: Test galaxy-importer
runs-on: ubuntu-20.04 # Older version to be compatible with old python
env:
PY_COLORS: 1 # allows molecule colors to be passed to GitHub Actions
ANSIBLE_FORCE_COLOR: 1 # allows ansible colors to be passed to GitHub Actions
GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg
steps:
- uses: actions/setup-python@v5
with:
python-version: |
3.10
- uses: actions/checkout@v4
- name: 'Install Python & Ansible requirements'
run: |
pip install -r ansible_collections/arista/cvp/requirements.txt -r ansible_collections/arista/cvp/requirements-dev.txt --upgrade
ansible-galaxy collection install -r ansible_collections/arista/cvp/collections.yml
- name: Install galaxy-importer
# Install the specific version of galaxy-importer used on galaxy.ansible.com
# The version conflicts with our requirements,
# so we let the galaxy-importer version resolve remaining requirements.
run: |
pip install "galaxy-importer==0.4.20"
- name: 'Build ansible package'
run: make collection-build
- name: 'Run galaxy-importer checks'
run: python -m galaxy_importer.main *.tar.gz
- uses: actions/upload-artifact@v3
with:
name: importer-logs
path: ./importer_result.json
50 changes: 25 additions & 25 deletions .github/workflows/pull-request-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,28 @@ jobs:
cd ansible_collections/arista/avd/
ansible-test sanity -v --requirements --docker --skip-test yamllint --exclude docs/

galaxy_importer:
name: Test galaxy-importer
runs-on: ubuntu-latest
container: avdteam/base:3.8-v2.0
needs: [ molecule_eos_designs ]
if: needs.cloudvision.status != 'failed' && needs.molecule_eos_designs.status != 'failed' && needs.file-changes.outputs.plugins == 'true'
env:
PY_COLORS: 1 # allows molecule colors to be passed to GitHub Actions
ANSIBLE_FORCE_COLOR: 1 # allows ansible colors to be passed to GitHub Actions
steps:
- name: 'set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v2
- name: install requirements
run: make install-requirements
- name: 'build ansible package'
run: make collection-build
- name: 'run ansible-importer checks'
run: python -m galaxy_importer.main *.tar.gz
- uses: actions/upload-artifact@v2
with:
name: importer-logs
path: ./importer_result.json
# galaxy_importer:
# name: Test galaxy-importer
# runs-on: ubuntu-latest
# container: avdteam/base:3.8-v2.0
# needs: [ molecule_eos_designs ]
# if: needs.cloudvision.status != 'failed' && needs.molecule_eos_designs.status != 'failed' && needs.file-changes.outputs.plugins == 'true'
# env:
# PY_COLORS: 1 # allows molecule colors to be passed to GitHub Actions
# ANSIBLE_FORCE_COLOR: 1 # allows ansible colors to be passed to GitHub Actions
# steps:
# - name: 'set environment variables'
# run: |
# echo "PY_COLORS=1" >> $GITHUB_ENV
# echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
# - uses: actions/checkout@v2
# - name: install requirements
# run: make install-requirements
# - name: 'build ansible package'
# run: make collection-build
# - name: 'run ansible-importer checks'
# run: python -m galaxy_importer.main *.tar.gz
# - uses: actions/upload-artifact@v2
# with:
# name: importer-logs
# path: ./importer_result.json
Loading