@@ -3,8 +3,18 @@ name: App Tests
33on :
44 push :
55 branches : [ main ]
6+ paths-ignore :
7+ - " **.md"
8+ - " .azdo/**"
9+ - " .devcontainer/**"
10+ - " .github/**"
611 pull_request :
712 branches : [ main ]
13+ paths-ignore :
14+ - " **.md"
15+ - " .azdo/**"
16+ - " .devcontainer/**"
17+ - " .github/**"
818 workflow_dispatch :
919
1020permissions :
@@ -17,68 +27,110 @@ jobs:
1727 strategy :
1828 fail-fast : false
1929 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"]
2232 exclude :
2333 - os : macos-latest-xlarge
2434 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
2542 steps :
2643 - 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
3157 if : matrix.os == 'windows-latest'
3258 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
3571 if : matrix.os == 'ubuntu-latest'
3672 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+
4879 - name : Setup python
4980 uses : actions/setup-python@v5
5081 with :
5182 python-version : ${{ matrix.python_version }}
5283 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+
5392 - name : Install dependencies
5493 run : |
55- python -m pip install -r requirements-dev.txt
94+ uv pip install -r requirements-dev.txt
95+
5696 - name : Install app as editable app
5797 run : |
58- python -m pip install -e src/backend
98+ uv pip install -e src/backend
99+
59100 - name : Setup local database with seed data
60101 run : |
61- cp .env.sample .env
62102 python ./src/backend/fastapi_app/setup_postgres_database.py
63103 python ./src/backend/fastapi_app/setup_postgres_seeddata.py
104+
64105 - name : Setup node
65106 uses : actions/setup-node@v4
66107 with :
67108 node-version : 18
109+
68110 - name : Build frontend
69111 run : |
70112 cd ./src/frontend
71113 npm install
72114 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+
73122 - name : Run MyPy
74123 run : python3 -m mypy .
124+
75125 - name : Run Pytest
76126 run : python3 -m pytest -s -vv --cov --cov-fail-under=85
127+
77128 - name : Run E2E tests with Playwright
78129 id : e2e
79130 run : |
80131 playwright install chromium --with-deps
81132 python3 -m pytest tests/e2e.py --tracing=retain-on-failure
133+
82134 - name : Upload test artifacts
83135 if : ${{ failure() && steps.e2e.conclusion == 'failure' }}
84136 uses : actions/upload-artifact@v4
0 commit comments