-
Notifications
You must be signed in to change notification settings - Fork 179
121 lines (98 loc) · 3.05 KB
/
ci.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
name: CI
on: [pull_request, workflow_dispatch]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test-extension:
services:
ollama:
image: ollama/ollama:latest
ports:
- 11434:11434
runs-on: ubuntu-latest
strategy:
matrix:
postgres-version: [ 16, 17 ]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@just
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Verify Docker installation
run: |
docker --version
docker info
- name: Build Docker image
run: just ext docker-build
env:
PG_MAJOR: ${{ matrix.postgres-version }}
- name: Run Docker container
run: just ext docker-run
- name: Build
run: docker exec pgai-ext just build
- name: Lint SQL and Python
run: docker exec pgai-ext just lint
- name: Check Python Formatting
run: docker exec pgai-ext just format-py
- name: Install extension
run: docker exec pgai-ext just install
- name: Run test server
run: docker exec -d
-e OPENAI_API_KEY
-e ANTHROPIC_API_KEY
-e COHERE_API_KEY
-e VOYAGE_API_KEY
pgai-ext just test-server
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
- name: Run tests
run: docker exec
-e OPENAI_API_KEY
-e ANTHROPIC_API_KEY
-e COHERE_API_KEY
-e VOYAGE_API_KEY
-e OLLAMA_HOST
pgai-ext just test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
OLLAMA_HOST: http://localhost:11434
- name: Stop and remove Docker container
run: |
just ext docker-stop
just ext docker-rm
build-and-test-pgai:
services:
ollama:
image: ollama/ollama:latest
ports:
- 11434:11434
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@just
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.29"
enable-cache: true
cache-dependency-glob: "./projects/pgai/uv.lock"
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "./projects/pgai/.python-version"
- name: CI pipeline. Install dependencies, run linters and formatters, execute tests and build the project",
run: just pgai ci
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}