-
Notifications
You must be signed in to change notification settings - Fork 18
119 lines (98 loc) · 3.05 KB
/
apps-api.yaml
File metadata and controls
119 lines (98 loc) · 3.05 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
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
name: Apps / API
on:
workflow_dispatch:
pull_request:
branches: ["*"]
paths:
- apps/api/**
- packages/**
- e2e/**
- .github/workflows/apps-api.yaml
- pnpm-lock.yaml
push:
branches: ["main"]
paths:
- apps/api/**
- packages/**
- e2e/**
- .github/workflows/apps-api.yaml
- pnpm-lock.yaml
jobs:
build:
uses: ./.github/workflows/build-image.yaml
secrets: inherit
with:
image-name: ctrlplane/api
dockerfile: apps/api/Dockerfile
platform: "linux/amd64"
api-tests:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
postgres:
image: postgres:18
env:
POSTGRES_USER: ctrlplane_test
POSTGRES_PASSWORD: test_password
POSTGRES_DB: ctrlplane_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_URL: "postgresql://ctrlplane_test:test_password@localhost:5432/ctrlplane_test?sslmode=disable"
AUTH_SECRET: "d0c1b54c50ccd3c89ee37e9c041f91748d361b09f8fd3b7fe542779c0f3f0983"
AUTH_TRUST_HOST: "true"
BASE_URL: "http://localhost:8080"
VARIABLES_AES_256_KEY: "0000000000000000000000000000000000000000000000000000000000000000"
steps:
- uses: actions/checkout@v4
- name: Setup
uses: ./tooling/github/setup
- name: Copy env
run: |
cp .env.example .env
sed -i "s|POSTGRES_URL=.*|POSTGRES_URL=$POSTGRES_URL|" .env
- name: Build
run: pnpm build
- name: Run migrations
working-directory: packages/db
run: pnpm exec drizzle-kit migrate
- name: Seed test data
run: pnpm -F @ctrlplane/e2e seed
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: apps/workspace-engine/go.mod
- name: Build workspace-engine
run: go build -o ./bin/workspace-engine .
working-directory: apps/workspace-engine
- name: Start workspace-engine
run: ./bin/workspace-engine &
env:
POSTGRES_URL: "postgresql://ctrlplane_test:test_password@localhost:5432/ctrlplane_test?sslmode=disable"
PORT: "8081"
working-directory: apps/workspace-engine
- name: Wait for workspace-engine
run: |
timeout 60s bash -c 'until curl -sf http://localhost:8081/healthz; do sleep 2; done'
- name: Start API server
run: pnpm -F @ctrlplane/web-api dev &
env:
PORT: "8080"
- name: Wait for API server
run: |
timeout 60s bash -c 'until curl -sf http://localhost:8080/api/healthz; do sleep 2; done'
- name: Run API tests
run: pnpm -F @ctrlplane/e2e test:api
env:
BASE_URL: "http://localhost:8080"
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: e2e/playwright-report/
retention-days: 5