Skip to content

Improve CI

Improve CI #3

---
name: "Check Pull Request Quality Assurance"
on: # yamllint disable-line rule:truthy
- "pull_request"
# env:
# STABLE_NAUTOBOT_VERSION: "stable"
# LATEST_PYTHON_VERSION: "3.11"
#
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"
database:
- "postgres"
env:
PYTHON_VER: "${{ matrix.python-version }}"
NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
COMPOSE_FILE: "docker-compose.base.yml:docker-compose.${{ matrix.database }}.yml:docker-compose.redis.yml:docker-compose.dev.yml"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Configure"
id: "config"
run: |
cd development
cp creds.example.env creds.env
IMAGE="$(docker compose convert --format json | jq -r .services.nautobot.image)"
cd -
echo "image=${IMAGE}" >> $GITHUB_OUTPUT
- name: "Build"
run: |
cd development
docker compose build \
--progress=plain \
-- \
nautobot
- name: "black"
run: |
docker run \
--rm \
--entrypoint='' \
--volume="$PWD:/source" \
"${{ steps.config.outputs.image }}" \
invoke black
- name: "pylint"
run: |
docker run \
--rm \
--entrypoint='' \
--volume="$PWD:/source" \
--env-file development/creds.env \
--env-file development/development.env \
"${{ steps.config.outputs.image }}" \
invoke pylint
- name: "unittest"
run: |
cd development
docker compose run \
--rm \
--entrypoint='' \
-- \
nautobot \
invoke unittest --failfast