Skip to content

Improve CI

Improve CI #11

Workflow file for this run

---
name: "Test Feature Pull Request"
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:
build:
runs-on: "ubuntu-22.04"
outputs:
image: ${{ steps.build.outputs.image }}
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Build"
id: "build"
uses: "./.github/actions/build"
with:
image-name: "${{ github.repository }}/nautobot-dev"
image-tag: "${{ github.ref_name }}-py${{ env.PYTHON_VER }}-${{ env.NAUTOBOT_VER }}"
nautobot-version: "${{ env.NAUTOBOT_VER }}"
python-version: "${{ env.PYTHON_VER }}"
push: true
linters:
needs: build
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Pull Image"
run: |
docker pull '${{ needs.build.outputs.image }}'
- name: "Run Linters"
run: |
docker run \
--rm \
--entrypoint='' \
--volume="$PWD:/source" \
--env-file development/creds.env \
--env-file development/development.env \
'${{ needs.build.outputs.image }}' \
invoke tests --lint-only --no-test-docs
test-postgres:
needs: build
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
IMAGE="$(docker compose convert --format json | jq -r .services.nautobot.image)"
echo "image=$IMAGE" >> $GITHUB_ENV
cd -
- name: "Pull Image"
run: |
docker pull '${{ needs.build.outputs.image }}'
docker tag '${{ needs.build.outputs.image }}' '${{ steps.config.outputs.image }}'
- 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