Skip to content

Commit

Permalink
Testing latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
joewesch committed Aug 30, 2023
1 parent 32ecd24 commit 4a0cbea
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 263 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ on: # yamllint disable

jobs:
ci:
uses: ./.github/workflows/jobs.yml
uses: ./.github/workflows/jobs.yml
43 changes: 43 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: "Integration Tests"
on: # yamllint disable
workflow_call:
inputs:
# Default options for all jobs
runs_on:
description: "The OS to run the job on"
required: false
default: "ubuntu-20.04"
type: string

jobs:
integration_ansible_2_14:
runs-on: "${{ inputs.runs_on }}"
env:
INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_ANSIBLE_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v3"
- name: "Install invoke"
run: "pip install -U pip && pip install invoke"
- name: "Start containers"
run: "invoke start"
- name: "Tests"
run: "invoke integration"
integration_ansible_2_15:
runs-on: "${{ inputs.runs_on }}"
env:
INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_ANSIBLE_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v3"
- name: "Install invoke"
run: "pip install -U pip && pip install invoke"
- name: "Install ansible-core 2.15"
run: "poetry add ansible-core@~2.15"
- name: "Start containers"
run: "invoke start"
- name: "Tests"
run: "invoke integration"
85 changes: 16 additions & 69 deletions .github/workflows/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
name: "Jobs"
on: # yamllint disable
workflow_call:
inputs:
# Default options for all jobs
runs_on:
description: "The OS to run the job on"
required: false
default: "ubuntu-20.04"
type: string

jobs:
lint:
runs-on: "ubuntu-20.04"
runs-on: "${{ inputs.runs_on }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v3"
Expand All @@ -14,11 +21,11 @@ jobs:
- name: "Linting"
run: "invoke lint"
unit:
runs-on: "ubuntu-20.04"
runs-on: "${{ inputs.runs_on }}"
strategy:
fail-fast: true
fail-fast: false
matrix:
python-version: ["3.8", "3.9"]
python-version: ["3.9", "3.10"]
env:
INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER: "${{ matrix.python-version }}"
steps:
Expand All @@ -31,77 +38,17 @@ jobs:
needs:
- "lint"
integration:
runs-on: "ubuntu-20.04"
uses: ./.github/workflows/integration_tests.yml
strategy:
fail-fast: false
matrix:
# Need to check what is needed for the integration step
# python-version: ["3.6", "3.7", "3.8", "3.9"]
# nautobot-version: ["1.0.3", "1.1.1"]
# ansible-release: ["base", "core"]
include:
- python-version: "3.8"
nautobot-version: "1.3"
ansible-release: "base" # Ansible 2.10
- python-version: "3.8"
nautobot-version: "1.3"
ansible-release: "2.11"
- python-version: "3.8"
nautobot-version: "1.3"
ansible-release: "2.9"
- python-version: "3.8"
nautobot-version: "1.4"
ansible-release: "2.10"
- python-version: "3.8"
nautobot-version: "1.4"
ansible-release: "2.12"
- python-version: "3.8"
nautobot-version: "1.5"
ansible-release: "2.12"
env:
INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_ANSIBLE_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v3"
- name: "Install invoke"
run: "pip install -U pip && pip install invoke"
- name: "Install poetry"
if: "${{ matrix.ansible-release == '2.11' }}"
run: "curl -sSL https://install.python-poetry.org | python3 -"
- name: "Remove ansible-base"
if: "${{ matrix.ansible-release == '2.11' }}"
run: "poetry remove ansible-base"
- name: "Add ansible-core"
if: "${{ matrix.ansible-release == '2.11' }}"
run: "poetry add ansible-core@~2.11"
- name: "Install poetry"
if: "${{ matrix.ansible-release == '2.9' }}"
run: "curl -sSL https://install.python-poetry.org | python3 -"
- name: "Remove ansible-base"
if: "${{ matrix.ansible-release == '2.9' }}"
run: "poetry remove ansible-base"
- name: "Add Ansible 2.9"
if: "${{ matrix.ansible-release == '2.9' }}"
run: "poetry add ansible@~2.9"
- name: "Install poetry"
if: "${{ matrix.ansible-release == '2.12' }}"
run: "curl -sSL https://install.python-poetry.org | python3 -"
- name: "Remove ansible-base"
if: "${{ matrix.ansible-release == '2.12' }}"
run: "poetry remove ansible-base"
- name: "Add Ansible 2.12"
if: "${{ matrix.ansible-release == '2.12' }}"
run: "poetry add ansible-core@~2.12 --python ^${{ matrix.python-version }}"
- name: "Start containers"
run: "invoke start"
- name: "Tests"
run: "invoke integration"
python-version: ["3.9", "3.10"]
nautobot-version: ["1.4", "1.5", "1.6"]
needs:
- "unit"
publish_github:
name: "Publish to GitHub"
runs-on: "ubuntu-20.04"
runs-on: "${{ inputs.runs_on }}"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
Expand All @@ -126,7 +73,7 @@ jobs:
- "integration"
publish_galaxy:
name: "Publish to Ansible Galaxy"
runs-on: "ubuntu-20.04"
runs-on: "${{ inputs.runs_on }}"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#
# This base stage just installs the dependencies required for production
# without any development deps.
ARG PYTHON_VER=3.8
ARG PYTHON_VER=3.9
FROM python:${PYTHON_VER} AS base

# Allow for flexible Python versions, for broader testing
ARG PYTHON_VER=3.8
ARG PYTHON_VER=3.9
ENV PYTHON_VERSION=${PYTHON_VER}
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -yqq && apt-get install -yqq shellcheck && apt-get clean
Expand Down Expand Up @@ -63,7 +63,7 @@ RUN poetry remove black --group dev
ARG ANSIBLE_COLLECTIONS_PATH=/usr/share/ansible/collections
ENV ANSIBLE_COLLECTIONS_PATH=${ANSIBLE_COLLECTIONS_PATH}

ARG PYTHON_VER=3.8
ARG PYTHON_VER=3.9
ENV PYTHON_VERSION=${PYTHON_VER}

# Allows for custom command line arguments to be passed to ansible-test (like -vvv)
Expand Down
2 changes: 1 addition & 1 deletion hacking/local-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
ansible-galaxy collection install networktocode-nautobot-*.tar.gz -p .

# You can now cd into the installed version and run tests
(cd ansible_collections/networktocode/nautobot/ && ansible-test units -v --python 3.8 && ansible-test sanity --requirements -v --python 3.8 --skip-test pep8 plugins/)
(cd ansible_collections/networktocode/nautobot/ && ansible-test units -v --python 3.9 && ansible-test sanity --requirements -v --python 3.9 --skip-test pep8 plugins/)
rm -rf ansible_collections
Loading

0 comments on commit 4a0cbea

Please sign in to comment.