Skip to content

Improve CI

Improve CI #6

---
name: "Single Test Simple"
on: # yamllint disable-line rule:truthy
pull_request: {}
# workflow_dispatch: {}
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
env:
NAUTOBOT_VER: "stable"
PYTHON_VER: "3.11"
jobs:
tests:
runs-on: "ubuntu-22.04"
steps:
- name: "Check Out Repository Code"
uses: "actions/checkout@v4"
- name: "Configure"
id: "config"
env:
COMPOSE_FILE: "docker-compose.base.yml"
run: |
cd development
cp creds.example.env creds.env
# Read Docker image reference from Compose configuration
IMAGE="$(docker compose convert --format json | jq -r .services.nautobot.image)"
cd -
echo "image=${IMAGE}" | tee -a "$GITHUB_OUTPUT"
- name: "Build Docker Image"
uses: "./.github/actions/build-push"
with:
add-image-reference: "${{ steps.config.outputs.image }}"
image-prefix: "ghcr.io/${{ github.repository }}/nautobot-dev"
image-tag: "pr-${{ github.event.pull_request.number }}-${{ env.NAUTOBOT_VER }}-py${{ env.PYTHON_VER }}"
nautobot-version: "${{ env.NAUTOBOT_VER }}"
python-version: "${{ env.PYTHON_VER }}"
- name: "Run Linters"
run: |
docker run \
--rm \
--entrypoint='' \
--volume="$PWD:/source" \
--env-file=development/creds.env \
--env-file=development/development.env \
'${{ steps.config.outputs.image }}' \
invoke tests --lint-only --no-test-docs
- name: "Test With Postgres"
env:
COMPOSE_FILE: "docker-compose.base.yml:docker-compose.postgres.yml:docker-compose.redis.yml:docker-compose.dev.yml"
run: |
cd development
docker compose run \
--rm \
--entrypoint='' \
-- \
nautobot \
invoke unittest --failfast