-
Notifications
You must be signed in to change notification settings - Fork 78
183 lines (153 loc) · 5.58 KB
/
ci.yaml
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Create .env file on push or internal PR
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
uses: SpicyPizza/[email protected]
with:
envkey_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
envkey_UNSTRUCTURED_API_KEY: ${{ secrets.UNSTRUCTURED_API_KEY }}
envkey_PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
envkey_PINECONE_CLOUD: ${{ secrets.PINECONE_CLOUD }}
envkey_PINECONE_REGION: ${{ secrets.PINECONE_REGION }}
- name: Create .env file on fork PR
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
uses: SpicyPizza/[email protected]
- name: Build
uses: docker/bake-action@v5
with:
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
targets: dynamiq-app
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run pre-commit
uses: pre-commit/[email protected]
with:
extra_args: --all-files --show-diff-on-failure --color always
env:
SKIP: 'no-commit-to-branch'
- name: Run conventional commits checker
uses: opensource-nepal/[email protected]
test:
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Create .env file on push or internal PR
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
uses: SpicyPizza/[email protected]
with:
envkey_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
envkey_UNSTRUCTURED_API_KEY: ${{ secrets.UNSTRUCTURED_API_KEY }}
envkey_PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
envkey_PINECONE_CLOUD: ${{ secrets.PINECONE_CLOUD }}
envkey_PINECONE_REGION: ${{ secrets.PINECONE_REGION }}
- name: Create .env file on fork PR
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
uses: SpicyPizza/[email protected]
- name: Load Image
uses: docker/bake-action@v5
with:
load: true
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
targets: dynamiq-app-test
- name: Run tests on push or internal PR
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
run: docker compose up dynamiq-app-test-cov --exit-code-from dynamiq-app-test-cov
- name: Run tests on fork PR
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
run: docker compose up dynamiq-app-test-cov-exclude-integration-with-creds --exit-code-from dynamiq-app-test-cov-exclude-integration-with-creds
- uses: actions/upload-artifact@v4
with:
name: coverage_report
path: ./reports
coverage:
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
needs:
- test
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
pull-requests: write
steps:
- uses: actions/download-artifact@v4
with:
name: coverage_report
path: reports
- name: Produce the coverage report on push or internal PR
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-xml-coverage-path: ./reports/coverage.xml
junitxml-path: ./reports/test-results.xml
report-only-changed-files: true
build-mkdocs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
uses: snok/[email protected]
with:
version: 1.8.3
virtualenvs-create: false
- name: Install dependencies
run: make install-dependencies-dev
- name: Build MkDocs
run: make build-mkdocs
publish-updated-mkdocs:
runs-on: ubuntu-latest
permissions:
contents: write
needs: build-mkdocs
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
uses: snok/[email protected]
with:
version: 1.8.3
virtualenvs-create: false
- name: Install dependencies
run: make install-dependencies-dev
- name: Publish Updated MkDocs
run: make publish-mkdocs