@@ -3,8 +3,18 @@ name: App Tests
3
3
on :
4
4
push :
5
5
branches : [ main ]
6
+ paths-ignore :
7
+ - " **.md"
8
+ - " .azdo/**"
9
+ - " .devcontainer/**"
10
+ - " .github/**"
6
11
pull_request :
7
12
branches : [ main ]
13
+ paths-ignore :
14
+ - " **.md"
15
+ - " .azdo/**"
16
+ - " .devcontainer/**"
17
+ - " .github/**"
8
18
workflow_dispatch :
9
19
10
20
permissions :
@@ -17,68 +27,110 @@ jobs:
17
27
strategy :
18
28
fail-fast : false
19
29
matrix :
20
- os : ["ubuntu-latest", "windows -latest", "macos-latest-xlarge ", "macos-13 "]
21
- python_version : ["3.10", "3.11", "3.12" ]
30
+ os : ["ubuntu-latest", "macos -latest-xlarge ", "macos-13 ", "windows-latest "]
31
+ python_version : ["3.10"]
22
32
exclude :
23
33
- os : macos-latest-xlarge
24
34
python_version : " 3.10"
35
+ env :
36
+ UV_SYSTEM_PYTHON : 1
37
+ POSTGRES_HOST : localhost
38
+ POSTGRES_USERNAME : postgres
39
+ POSTGRES_PASSWORD : root
40
+ POSTGRES_DATABASE : postgres
41
+ POSTGRES_SSL : disable
25
42
steps :
26
43
- uses : actions/checkout@v4
27
- - name : Check for MacOS Runner
28
- if : matrix.os == 'macos-latest-xlarge'
29
- run : brew install postgresql@14
30
- - name : Install pgvector on Windows using install-pgvector.bat
44
+
45
+ - name : (MacOS) Install postgreSQL and pgvector using brew
46
+ if : matrix.os == 'macos-13' || matrix.os == 'macos-latest-xlarge'
47
+ run : |
48
+ brew install postgresql@14
49
+ brew link --overwrite postgresql@14
50
+ brew install pgvector
51
+ brew services start postgresql@14 && sleep 1
52
+ createuser -s ${{ env.POSTGRES_USERNAME }}
53
+ psql -d postgres -c "ALTER USER ${{ env.POSTGRES_USERNAME }} WITH PASSWORD '${{ env.POSTGRES_PASSWORD }}'"
54
+ psql -d postgres -c 'CREATE EXTENSION vector'
55
+
56
+ - name : Install pgvector
31
57
if : matrix.os == 'windows-latest'
32
58
shell : cmd
33
- run : .github\workflows\install-pgvector.bat
34
- - name : Install PostgreSQL development libraries
59
+ run : |
60
+ call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
61
+ cd %TEMP%
62
+ git clone --branch v0.7.4 https://github.com/pgvector/pgvector.git
63
+ cd pgvector
64
+ nmake /NOLOGO /F Makefile.win
65
+ nmake /NOLOGO /F Makefile.win install
66
+ sc config postgresql-x64-14 start=auto
67
+ net start postgresql-x64-14
68
+ "%PGBIN%/psql" -d postgres -c "CREATE EXTENSION vector"
69
+
70
+ - name : (Linux) Install pgvector and set password
35
71
if : matrix.os == 'ubuntu-latest'
36
72
run : |
37
- sudo apt update
38
- sudo apt install postgresql-server-dev-14
39
- - name : Setup postgres
40
- uses : ikalnytskyi/action-setup-postgres@v6
41
- with :
42
- username : admin
43
- password : postgres
44
- database : postgres
45
- - name : Install pgvector on MacOS/Linux using install-pgvector.sh
46
- if : matrix.os != 'windows-latest'
47
- run : .github/workflows/install-pgvector.sh
73
+ sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
74
+ sudo apt-get install postgresql-14-pgvector
75
+ sudo systemctl start postgresql
76
+ sudo -u postgres psql -c "ALTER USER ${{ env.POSTGRES_USERNAME }} PASSWORD '${{ env.POSTGRES_PASSWORD }}'"
77
+ sudo -u postgres psql -c 'CREATE EXTENSION vector'
78
+
48
79
- name : Setup python
49
80
uses : actions/setup-python@v5
50
81
with :
51
82
python-version : ${{ matrix.python_version }}
52
83
architecture : x64
84
+
85
+ - name : Install uv
86
+ uses : astral-sh/setup-uv@v3
87
+ with :
88
+ enable-cache : true
89
+ version : " 0.4.20"
90
+ cache-dependency-glob : " requirements**.txt"
91
+
53
92
- name : Install dependencies
54
93
run : |
55
- python -m pip install -r requirements-dev.txt
94
+ uv pip install -r requirements-dev.txt
95
+
56
96
- name : Install app as editable app
57
97
run : |
58
- python -m pip install -e src/backend
98
+ uv pip install -e src/backend
99
+
59
100
- name : Setup local database with seed data
60
101
run : |
61
- cp .env.sample .env
62
102
python ./src/backend/fastapi_app/setup_postgres_database.py
63
103
python ./src/backend/fastapi_app/setup_postgres_seeddata.py
104
+
64
105
- name : Setup node
65
106
uses : actions/setup-node@v4
66
107
with :
67
108
node-version : 18
109
+
68
110
- name : Build frontend
69
111
run : |
70
112
cd ./src/frontend
71
113
npm install
72
114
npm run build
115
+
116
+ - name : Setup mypy cache
117
+ uses : actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
118
+ with :
119
+ path : ./.mypy_cache
120
+ key : mypy${{ matrix.os }}-${{ matrix.python_version }}-${{ hashFiles('requirements-dev.txt', 'src/backend/requirements.txt', 'src/backend/pyproject.toml') }}
121
+
73
122
- name : Run MyPy
74
123
run : python3 -m mypy .
124
+
75
125
- name : Run Pytest
76
126
run : python3 -m pytest -s -vv --cov --cov-fail-under=85
127
+
77
128
- name : Run E2E tests with Playwright
78
129
id : e2e
79
130
run : |
80
131
playwright install chromium --with-deps
81
132
python3 -m pytest tests/e2e.py --tracing=retain-on-failure
133
+
82
134
- name : Upload test artifacts
83
135
if : ${{ failure() && steps.e2e.conclusion == 'failure' }}
84
136
uses : actions/upload-artifact@v4
0 commit comments