-
-
Notifications
You must be signed in to change notification settings - Fork 296
77 lines (77 loc) · 2.44 KB
/
Copy pathbuild-server.yml
File metadata and controls
77 lines (77 loc) · 2.44 KB
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
permissions:
contents: read
name: build server
on:
pull_request:
paths:
- "carbonserver/**"
- "pyproject.toml"
push:
paths:
- "carbonserver/**"
- "pyproject.toml"
branches: [master]
jobs:
build_server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: "latest"
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --project carbonserver --extra dev
- name: Unit tests on api
run: uv run task test-api-unit
test_api_server:
runs-on: ubuntu-latest
permissions:
contents: read
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:16
# Provide the password for postgres
env:
POSTGRES_DB: codecarbon_db
POSTGRES_PASSWORD: supersecret
POSTGRES_USER: codecarbon-user
POSTGRES_HOST: localhost
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5480:5432
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
version: "latest"
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --project carbonserver --extra dev
- name: Setup database
env:
DATABASE_URL: postgresql://codecarbon-user:supersecret@localhost:5480/codecarbon_db
run: uv run task setup-db
- name: Integration tests on api
env:
CODECARBON_API_URL: http://localhost:8008
DATABASE_URL: postgresql://codecarbon-user:supersecret@localhost:5480/codecarbon_db
run: |
# uv run task dashboard-ci &
# sleep 10 # wait for server to start
# netstat -o -n -a | grep 8008
# uv run task test-api-integ
echo "Integration tests temporarily disabled - need to fix server startup"