Skip to content

Commit

Permalink
Add migration check to upstream testing workflow (#6058)
Browse files Browse the repository at this point in the history
Co-authored-by: Hanlin Miao <[email protected]>
Co-authored-by: Glenn Matthews <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2024
1 parent 8dbbdaa commit 847782f
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 3 deletions.
70 changes: 67 additions & 3 deletions .github/workflows/plugin_upstream_testing_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ env:
PYTHON_VERSION: "3.8"

jobs:
unittest:
build:
continue-on-error: true
strategy:
fail-fast: false
matrix:
nautobot-version: ["develop", "ltm-1.6"]
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-24.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
Expand All @@ -41,14 +42,77 @@ jobs:
builder: "${{ steps.buildx.outputs.name }}"
context: "./"
push: false
load: true
tags: "${{ inputs.plugin_name }}/nautobot:${{ matrix.nautobot-version }}-py${{ env.PYTHON_VERSION }}"
file: "./development/Dockerfile"
cache-from: "type=gha,scope=nautobot-${{ matrix.nautobot-version }}"
build-args: |
NAUTOBOT_VER=${{ matrix.nautobot-version }}
PYTHON_VER=${{ env.PYTHON_VERSION }}
outputs: "type=docker,dest=/tmp/nautobot_${{ matrix.nautobot-version }}.tar"
- name: Upload docker image artifact
uses: actions/upload-artifact@v4
with:
name: "docker_nautobot_${{ matrix.nautobot-version }}"
path: "/tmp/nautobot_${{ matrix.nautobot-version }}.tar"
unittest:
name: "Run Unit Tests"
needs: "build"
strategy:
fail-fast: false
matrix:
nautobot-version: ["develop", "ltm-1.6"]
runs-on: "ubuntu-24.04"
steps:
# Try to download the artifact first so the job can be skipped if the artifact is not found
- name: Download docker image artifact
uses: actions/download-artifact@v4
with:
name: "docker_nautobot_${{ matrix.nautobot-version }}"
path: /tmp
- name: Load docker image
run: "docker load --input /tmp/nautobot_${{ matrix.nautobot-version }}.tar"
- name: "Check out repository code"
uses: "actions/checkout@v4"
with:
ref: "${{ matrix.nautobot-version == 'develop' && 'develop' || matrix.nautobot-version == 'ltm-1.6' && 'ltm-1.6' || env.GITHUB_REF_NAME || 'develop' }}"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-install-options: "" # override default "--only dev"
poetry-version: "1.8.2"
python-version: "${{ env.PYTHON_VERSION }}"
- name: "Copy credentials"
run: "cp development/creds.example.env development/creds.env"
- name: "Run Tests"
run: "INVOKE_${{ inputs.invoke_context_name }}_NAUTOBOT_VER=${{ matrix.nautobot-version }} INVOKE_${{ inputs.invoke_context_name }}_PYTHON_VER=${{ env.PYTHON_VERSION }} poetry run invoke unittest --failfast --keepdb"
check-migrations:
name: "Run 'nautobot-server makemigrations --dry-run --check'"
needs: "build"
strategy:
fail-fast: false
matrix:
nautobot-version: ["develop", "ltm-1.6"]
runs-on: "ubuntu-24.04"
steps:
# Try to download the artifact first so the job can be skipped if the artifact is not found
- name: Download docker image artifact
uses: actions/download-artifact@v4
with:
name: "docker_nautobot_${{ matrix.nautobot-version }}"
path: /tmp
- name: Load docker image
run: "docker load --input /tmp/nautobot_${{ matrix.nautobot-version }}.tar"
- name: "Check out repository code"
uses: "actions/checkout@v4"
with:
ref: "${{ matrix.nautobot-version == 'develop' && 'develop' || matrix.nautobot-version == 'ltm-1.6' && 'ltm-1.6' || env.GITHUB_REF_NAME || 'develop' }}"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
with:
poetry-install-options: "" # override default "--only dev"
poetry-version: "1.8.2"
python-version: "${{ env.PYTHON_VERSION }}"
- name: "Copy credentials"
run: "cp development/creds.example.env development/creds.env"
- name: "Run check migrations"
run: "INVOKE_${{ inputs.invoke_context_name }}_NAUTOBOT_VER=${{ matrix.nautobot-version }} INVOKE_${{ inputs.invoke_context_name }}_PYTHON_VER=${{ env.PYTHON_VERSION }} poetry run invoke check-migrations"
1 change: 1 addition & 0 deletions changes/6055.housekeeping
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added migrations check to upstream testing workflow.

0 comments on commit 847782f

Please sign in to comment.