Skip to content

Improve CI

Improve CI #9

---
name: "Full Tests Parallel"
on: # yamllint disable-line rule:truthy
pull_request: {}
# workflow_dispatch: {}
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
build:
runs-on: "ubuntu-22.04"
strategy:
fail-fast: true
matrix:
nautobot-version: ["stable"]
# python-version: ["3.11"]
python-version: ["3.11", "3.8"]
# include:
# - nautobot-version: "2.0.0"
# python-version: "3.11"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Build and Push"
id: "build"
uses: "./.github/actions/build-push"
with:
image-prefix: "ghcr.io/${{ github.repository }}/nautobot-dev"
image-tag: "pr-${{ github.event.pull_request.number }}-py${{ matrix.python-version }}-${{ matrix.nautobot-version }}"
nautobot-version: "${{ matrix.nautobot-version }}"
password: ${{ secrets.GH_NAUTOBOT_BOT_TOKEN }}
python-version: "${{ matrix.python-version }}"
username: ${{ github.actor }}
linters:
needs: build
runs-on: "ubuntu-22.04"
strategy:
fail-fast: true
matrix:
nautobot-version: ["stable"]
python-version: ["3.11"]
env:
IMAGE: "ghcr.io/${{ github.repository }}/nautobot-dev:pr-${{ github.event.pull_request.number }}-py${{ matrix.python-version }}-${{ matrix.nautobot-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ inputs.username }}
password: ${{ inputs.password }}
- name: "Run Linters"
run: |
docker pull $IMAGE
docker run \
--rm \
--entrypoint='' \
--volume="$PWD:/source" \
--env-file=development/creds.example.env \
--env-file=development/development.env \
"$IMAGE" \
invoke tests --lint-only --no-test-docs
test-postgres:
needs: build
runs-on: "ubuntu-22.04"
strategy:
fail-fast: true
matrix:
nautobot-version: ["stable"]
python-version: ["3.11"]
# python-version: ["3.11", "3.8"]
# include:
# - nautobot-version: "2.0.0"
# python-version: "3.11"
env:
COMPOSE_FILE: "docker-compose.base.yml:docker-compose.postgres.yml:docker-compose.redis.yml:docker-compose.dev.yml"
IMAGE_PREFIX: "ghcr.io/${{ github.repository }}/nautobot-dev"
IMAGE_TAG: "pr-${{ github.event.pull_request.number }}-py${{ matrix.python-version }}-${{ matrix.nautobot-version }}"
NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
PYTHON_VER: "${{ matrix.python-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Build"
id: "build"
uses: "./.github/actions/build-push"
with:
image-prefix: "${{ env.IMAGE_PREFIX }}"
image-tag: "${{ env.IMAGE_TAG }}"
nautobot-version: "${{ matrix.nautobot-version }}"
password: ${{ secrets.GH_NAUTOBOT_BOT_TOKEN }}
python-version: "${{ matrix.python-version }}"
username: ${{ github.actor }}
- name: "Configure"
id: "config"
run: |
- name: "Test with Postgres"
run: |
cd development
cp creds.example.env creds.env
COMPOSE_IMAGE="$(docker compose convert --format json | jq -r .services.nautobot.image)"
docker pull "$IMAGE_PREFIX:$IMAGE_TAG"
docker tag "$IMAGE_PREFIX:$IMAGE_TAG" "$COMPOSE_IMAGE"
docker compose run \
--rm \
--entrypoint='' \
-- \
nautobot \
invoke unittest --failfast