-
Notifications
You must be signed in to change notification settings - Fork 96
154 lines (149 loc) · 4.61 KB
/
test.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
docker-build:
runs-on: ubuntu-latest
env:
IMAGE: danihodovic/celery-exporter
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare Image Metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
- name: Set Up QEMU
uses: docker/setup-qemu-action@v3
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Test Multi-Arch Building Of Image
uses: docker/build-push-action@v6
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
platforms: linux/amd64,linux/arm64
push: false
annotations: ${{ steps.metadata.outputs.annotations }}
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}
helm-chart:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Up Helm
uses: azure/[email protected]
with:
version: v3.14.4
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
check-latest: true
- name: Set Up Chart-Testing
uses: helm/[email protected]
- name: Run Chart-Testing (List-Changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run Chart-Testing (Lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
- name: Create Kind Cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/[email protected]
- name: Run Chart-Testing (Install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }}
pylint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Up Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: 3.12
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load Cached Venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root
- name: Format
run: |
source .venv/bin/activate
black . --check
- name: Type Check
run: |
source .venv/bin/activate
mypy .
- name: Run Pylint
run: |
source .venv/bin/activate
pylint $(git ls-files -- '*.py' ':!:**/migrations/*.py')
pytest:
runs-on: ubuntu-latest
services:
redis:
image: redis:6
ports: ['6379:6379']
rabbitmq:
image: rabbitmq:3
ports: ['5672:5672']
strategy:
matrix:
broker: [memory, redis, rabbitmq]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Up Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: 3.12
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load Cached Venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root
source .venv/bin/activate
- name: Run Pytest
run: |
source .venv/bin/activate
pytest --broker=${{ matrix.broker }} --ignore .poetry --cov