-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #242 from joewesch/update_tests
Updating tests
- Loading branch information
Showing
40 changed files
with
2,009 additions
and
2,992 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
name: "Integration Tests" | ||
on: # yamllint disable | ||
workflow_call: | ||
inputs: | ||
runs-on: | ||
description: "The OS to run the job on" | ||
required: false | ||
default: "ubuntu-22.04" | ||
type: string | ||
python-version: | ||
description: "The Python version to use" | ||
required: true | ||
type: string | ||
nautobot-version: | ||
description: "The Nautobot version to use" | ||
required: true | ||
type: string | ||
ansible-version: | ||
description: "The Ansible version to use" | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
integration: | ||
runs-on: "${{ inputs.runs-on }}" | ||
env: | ||
INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER: "${{ inputs.python-version }}" | ||
INVOKE_NAUTOBOT_ANSIBLE_NAUTOBOT_VER: "${{ inputs.nautobot-version }}" | ||
steps: | ||
- name: "Check out repository code" | ||
uses: "actions/checkout@v3" | ||
- name: "Set up Python" | ||
uses: "actions/setup-python@v3" | ||
with: | ||
python-version: "${{ inputs.python-version }}" | ||
- name: "Install invoke" | ||
run: "pip install -U pip && pip install invoke" | ||
- name: "Install poetry" | ||
run: "curl -sSL https://install.python-poetry.org | python3 -" | ||
- name: "Install ansible-core" | ||
# This ensures that even if the poetry.lock file updates we still test the right version | ||
run: "poetry add ansible-core@~${{ inputs.ansible-version }}" | ||
- name: "Start containers" | ||
run: "invoke start" | ||
- name: "Tests" | ||
run: "invoke integration" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
name: "Tests" | ||
on: # yamllint disable | ||
workflow_call: | ||
inputs: | ||
runs-on: | ||
description: "The OS to run the job on" | ||
required: false | ||
default: "ubuntu-22.04" | ||
type: string | ||
full-integration: | ||
description: "Run full integration tests" | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
lint: | ||
runs-on: "${{ inputs.runs-on }}" | ||
steps: | ||
- name: "Check out repository code" | ||
uses: "actions/checkout@v3" | ||
- name: "Install invoke" | ||
run: "pip install -U pip && pip install invoke" | ||
- name: "Linting" | ||
run: "invoke lint" | ||
unit: | ||
runs-on: "${{ inputs.runs-on }}" | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
env: | ||
INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER: "${{ matrix.python-version }}" | ||
steps: | ||
- name: "Check out repository code" | ||
uses: "actions/checkout@v3" | ||
- name: "Install invoke" | ||
run: "pip install -U pip && pip install invoke" | ||
- name: "Tests" | ||
run: "invoke unit" | ||
needs: | ||
- "lint" | ||
integration_partial: | ||
# Only run a subset of integration tests on normal PRs | ||
if: ${{ inputs.full-integration == false }} | ||
uses: ./.github/workflows/integration_tests.yml | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: | ||
- "3.9" | ||
nautobot-version: | ||
- "1.6" | ||
ansible-version: | ||
- "2.14" | ||
- "2.15" | ||
with: | ||
python-version: "${{ matrix.python-version }}" | ||
nautobot-version: "${{ matrix.nautobot-version }}" | ||
ansible-version: "${{ matrix.ansible-version }}" | ||
needs: | ||
- "unit" | ||
integration_full: | ||
if: ${{ inputs.full-integration == true }} | ||
uses: ./.github/workflows/integration_tests.yml | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
nautobot-version: | ||
- "1.4" | ||
- "1.5" | ||
- "1.6" | ||
ansible-version: | ||
- "2.14" | ||
- "2.15" | ||
exclude: | ||
- python-version: "3.11" | ||
nautobot-version: "1.4" | ||
- python-version: "3.11" | ||
nautobot-version: "1.5" | ||
with: | ||
python-version: "${{ matrix.python-version }}" | ||
nautobot-version: "${{ matrix.nautobot-version }}" | ||
ansible-version: "${{ matrix.ansible-version }}" | ||
needs: | ||
- "unit" |
14 changes: 6 additions & 8 deletions
14
.github/workflows/ci.yml → .github/workflows/trigger_pr_main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
--- | ||
name: "CI" | ||
name: "Pull Requests (main)" | ||
concurrency: # Cancel any existing runs of this workflow for this same PR | ||
group: "${{ '{{ github.workflow }}' }}-${{ '{{ github.ref }}' }}" | ||
cancel-in-progress: true | ||
on: # yamllint disable | ||
push: | ||
pull_request: | ||
branches: | ||
- "develop" | ||
- "main" | ||
pull_request: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
ci: | ||
uses: ./.github/workflows/jobs.yml | ||
tests: | ||
uses: ./.github/workflows/tests.yml | ||
with: | ||
full-integration: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
name: "Pull Requests (normal)" | ||
concurrency: # Cancel any existing runs of this workflow for this same PR | ||
group: "${{ '{{ github.workflow }}' }}-${{ '{{ github.ref }}' }}" | ||
cancel-in-progress: true | ||
on: # yamllint disable | ||
pull_request: | ||
branches-ignore: | ||
- "main" | ||
|
||
jobs: | ||
tests: | ||
uses: ./.github/workflows/tests.yml | ||
with: | ||
full-integration: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
name: "Release" | ||
on: # yamllint disable | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
tests: | ||
uses: ./.github/workflows/tests.yml | ||
with: | ||
full-integration: true | ||
publish_github: | ||
name: "Publish to GitHub" | ||
runs-on: "${{ inputs.runs-on }}" | ||
if: "startsWith(github.ref, 'refs/tags/v')" | ||
steps: | ||
- name: "Check out repository code" | ||
uses: "actions/checkout@v3" | ||
- name: "Set up Python" | ||
uses: "actions/setup-python@v3" | ||
with: | ||
python-version: "3.9" | ||
- name: "Install Python Packages" | ||
run: "pip install ansible-core" | ||
- name: "Build the collection" | ||
run: "ansible-galaxy collection build --output-path build" | ||
- name: "Upload binaries to release" | ||
uses: "svenstaro/upload-release-action@v2" | ||
with: | ||
repo_token: "${{ secrets.GH_NAUTOBOT_BOT_TOKEN }}" | ||
file: "build/*" | ||
tag: "${{ github.ref }}" | ||
overwrite: true | ||
file_glob: true | ||
needs: | ||
- "tests" | ||
publish_galaxy: | ||
name: "Publish to Ansible Galaxy" | ||
runs-on: "${{ inputs.runs-on }}" | ||
if: "startsWith(github.ref, 'refs/tags/v')" | ||
steps: | ||
- name: "Check out repository code" | ||
uses: "actions/checkout@v3" | ||
- name: "Set up Python" | ||
uses: "actions/setup-python@v3" | ||
with: | ||
python-version: "3.9" | ||
- name: "Install Python Packages" | ||
run: "pip install ansible-core" | ||
- name: "Build the collection" | ||
run: "ansible-galaxy collection build --output-path build" | ||
- name: "Publish the collection" | ||
run: "ansible-galaxy collection publish build/* --api-key=${{ secrets.GALAXY_API_TOKEN }}" | ||
needs: | ||
- "tests" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.