forked from keyshade-xyz/keyshade
-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (120 loc) · 4.08 KB
/
Copy pathvalidate-platform.yaml
File metadata and controls
145 lines (120 loc) · 4.08 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
143
144
145
name: Validate Platform
on:
push:
branches:
- '!develop'
- '!main'
paths:
[
'packages/api-client/**',
'apps/platform/**',
'.github/workflows/validate-platform.yaml',
'.github/workflows/deploy-platform.yaml'
]
pull_request:
paths:
[
'packages/api-client/**',
'apps/platform/**',
'.github/workflows/deploy-platform.yaml',
'.github/workflows/validate-platform.yaml'
]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validate-node-build:
runs-on: ubuntu-latest
timeout-minutes: 15
name: Validate Platform (Node)
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.2.0
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install packages
run: |
pnpm i
- name: Build deps
run: |
pnpm build:schema
pnpm build:api-client
- name: Lint
run: |
pnpm run lint:platform
# - name: Build
# run: |
# pnpm run build:platform
validate-docker-build:
runs-on: ubuntu-latest
timeout-minutes: 15
name: Validate Platform (Docker)
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Platform image
env:
GITHUB_SHA: ${{ github.sha }}
NEXT_PUBLIC_BACKEND_URL: http://127.0.0.1:4200
NEXT_PUBLIC_SENTRY_ENVIRONMENT: ci
NEXT_PUBLIC_POSTHOG_KEY: test-key
NEXT_PUBLIC_POSTHOG_HOST: https://app.posthog.com
run: |
docker build -t keyshade/platform:ci-${GITHUB_SHA} -f apps/platform/Dockerfile \
--build-arg NEXT_PUBLIC_BACKEND_URL=$NEXT_PUBLIC_BACKEND_URL \
--build-arg NEXT_PUBLIC_SENTRY_ENVIRONMENT=$NEXT_PUBLIC_SENTRY_ENVIRONMENT \
--build-arg NEXT_PUBLIC_POSTHOG_KEY=$NEXT_PUBLIC_POSTHOG_KEY \
--build-arg NEXT_PUBLIC_POSTHOG_HOST=$NEXT_PUBLIC_POSTHOG_HOST \
.
- name: Verify Platform image
run: docker image inspect keyshade/platform:ci-${{ github.sha }}
- name: Start Platform
env:
GITHUB_SHA: ${{ github.sha }}
run: |
docker compose -f docker-compose-test.yml --profile ci-platform up -d
echo "Waiting for Platform to be healthy..."
timeout 60s bash -c 'until docker inspect --format="{{.State.Health.Status}}" platform-ci 2>/dev/null | grep -q "healthy"; do sleep 2; echo "Waiting..."; done'
echo "Platform is healthy"
- name: Platform health check
run: |
curl -fsSL "http://127.0.0.1:3025/api/health" || {
echo "Health check failed"
docker compose -f docker-compose-test.yml logs platform-ci
exit 1
}
echo "Health check passed"
- name: Cleanup
if: always()
env:
GITHUB_SHA: ${{ github.sha }}
run: |
set -euo pipefail
if [ "${{ job.status }}" != 'success' ]; then
echo "=== Docker Compose Logs ==="
docker compose -f docker-compose-test.yml --profile ci-platform logs
fi
docker compose -f docker-compose-test.yml --profile ci-platform down -v --remove-orphans || true
docker image rm -f keyshade/platform:ci-${GITHUB_SHA} || true