-
Notifications
You must be signed in to change notification settings - Fork 13
102 lines (96 loc) · 3.17 KB
/
test-feature-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
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: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_NAUTOBOT_BOT_TOKEN }}
- name: "Build"
id: "build"
uses: "./.github/actions/build"
with:
image-name: "ghcr.io/${{ github.repository }}/nautobot-dev"
image-tag: "pr-${{ github.event.pull_request.number }}-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: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_NAUTOBOT_BOT_TOKEN }}
- 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.example.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
COMPOSE_IMAGE="$(docker compose convert --format json | jq -r .services.nautobot.image)"
echo "compose-image=$COMPOSE_IMAGE" | tee -a $GITHUB_OUTPUT
cd -
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_NAUTOBOT_BOT_TOKEN }}
- name: "Pull Image"
run: |
docker pull '${{ needs.build.outputs.image }}'
docker tag '${{ needs.build.outputs.image }}' '${{ steps.config.outputs.compose-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