Skip to content
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
36 changes: 36 additions & 0 deletions .github/workflows/trigger_scheduled_devel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: "Scheduled CI - ansible-core devel"
on: # yamllint disable
schedule:
# Run every Wednesday at 03:20 UTC (offset from Monday stable run)
- cron: "20 3 * * 3"
workflow_dispatch:
inputs:
branch:
description: "The ansible-core branch to test against"
required: false
default: "devel"
type: string

env:
ANSIBLE_CORE_BRANCH: "${{ inputs.branch || 'devel' }}"

jobs:
unit:
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
python-version:
- "3.12"
env:
INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER: "${{ matrix.python-version }}"
# Allow failures — devel breakage is expected and should not block anything
continue-on-error: true
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Install invoke"
run: "pip install -U pip && pip install invoke packaging"
- name: "Run tests against ansible-core ${{ env.ANSIBLE_CORE_BRANCH }}"
run: "invoke unit --ansible-core-branch ${{ env.ANSIBLE_CORE_BRANCH }} --skip lint"
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ ENV SKIP_LINT_TESTS=${SKIP_LINT_TESTS}
# Install dev dependencies
RUN poetry install

# Optionally install ansible-core from a specific branch (e.g. "devel" or "milestone")
# This must come AFTER poetry install so the lock file version doesn't overwrite it.
ARG ANSIBLE_CORE_BRANCH
RUN if [ -n "${ANSIBLE_CORE_BRANCH}" ]; then \
pip install --upgrade pip setuptools && \
pip install --force-reinstall --no-deps \
"https://github.com/ansible/ansible/archive/${ANSIBLE_CORE_BRANCH}.tar.gz"; \
fi

# Copy in the application source and everything not explicitly banned by .dockerignore
COPY . .

Expand Down
1 change: 1 addition & 0 deletions changes/718.housekeeping
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added CI testing against ansible-core devel branch and `--ansible-core-branch` flag on `invoke unit` for local testing.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
x-args:
&args
PYTHON_VER: ${PYTHON_VER}
ANSIBLE_CORE_BRANCH: ${ANSIBLE_CORE_BRANCH:-}
ANSIBLE_SANITY_ARGS: ${ANSIBLE_SANITY_ARGS:-}
ANSIBLE_UNIT_ARGS: ${ANSIBLE_UNIT_ARGS:-}
SKIP_LINT_TESTS: ${SKIP_LINT_TESTS:-}
Expand Down
5 changes: 4 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,16 @@ def lint(context):
help={
"verbose": "Run the tests with verbose output; can be provided multiple times for more verbosity (e.g. -v, -vv, -vvv)",
"skip": "Skip specific tests (choices: lint, sanity, unit); can be provided multiple times (e.g. --skip lint --skip sanity)",
"ansible_core_branch": "Test against a specific ansible-core git branch (e.g. 'devel', 'milestone')",
},
iterable=["skip"],
incrementable=["verbose"],
)
def unit(context, verbose=0, skip=None):
def unit(context, verbose=0, skip=None, ansible_core_branch=None):
"""Run unit tests."""
env = {"PYTHON_VER": context.nautobot_ansible.python_ver}
if ansible_core_branch is not None:
env["ANSIBLE_CORE_BRANCH"] = ansible_core_branch
if verbose:
env["ANSIBLE_SANITY_ARGS"] = f"-{'v' * verbose}"
env["ANSIBLE_UNIT_ARGS"] = f"-{'v' * verbose}"
Expand Down
Loading