-
Notifications
You must be signed in to change notification settings - Fork 15
142 lines (121 loc) · 3.5 KB
/
apps-workspace-engine.yaml
File metadata and controls
142 lines (121 loc) · 3.5 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Apps / Workspace Engine
on:
pull_request:
branches: ["*"]
paths:
- apps/workspace-engine/**
- .github/workflows/apps-workspace-engine.yaml
push:
branches: ["main"]
paths:
- apps/workspace-engine/**
- .github/workflows/apps-workspace-engine.yaml
jobs:
tests-with-db:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
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
defaults:
run:
working-directory: apps/workspace-engine
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.25"
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: go mod download
- name: Set up Node.js for migrations
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Install dependencies for migrations
working-directory: ./
run: |
pnpm install --filter @ctrlplane/db --frozen-lockfile
- name: Wait for PostgreSQL
run: |
until pg_isready -h localhost -p 5432 -U ctrlplane_test; do
echo "Waiting for postgres..."
sleep 2
done
- name: Run migrations
working-directory: packages/db
env:
POSTGRES_URL: "postgresql://ctrlplane_test:test_password@localhost:5432/ctrlplane_test?sslmode=disable"
run: pnpm exec drizzle-kit migrate
- name: Run DB package tests
working-directory: apps/workspace-engine
env:
POSTGRES_URL: "postgresql://ctrlplane_test:test_password@localhost:5432/ctrlplane_test?sslmode=disable"
USE_DATABASE_BACKING: "1"
SERVICES: "none"
run: go test -race ./pkg/db/... ./test/e2e/...
tests:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
defaults:
run:
working-directory: apps/workspace-engine
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.25"
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: go mod download
- name: Run tests with coverage
env:
SERVICES: "none"
run: go test -race ./...
build:
uses: ./.github/workflows/build-image.yaml
secrets: inherit
with:
image-name: ctrlplane/workspace-engine
dockerfile: apps/workspace-engine/Dockerfile
context: apps/workspace-engine
platform: "linux/amd64"