forked from getlago/lago-front
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (65 loc) · 1.98 KB
/
Copy pathcodegen.yml
File metadata and controls
79 lines (65 loc) · 1.98 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
name: Run Codegen
on:
pull_request:
types: [opened, reopened, review_requested, ready_for_review, synchronize]
workflow_dispatch:
inputs:
api_branch:
description: Api Branch
required: true
default: "main"
jobs:
codegen:
if: github.event.pull_request.draft == false
name: Run Codegen
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v6
- name: Checkout API Git repository
uses: actions/checkout@v6
with:
repository: getlago/lago-api
ref: ${{ github.event.inputs.api_branch }}
path: api
- name: Build API local image
run: |
docker build -t getlago/api:ci ./api
- name: Generate API RSA Key
run: |
echo "LAGO_RSA_PRIVATE_KEY=\"`openssl genrsa 2048 | base64`\"" >> .env
- name: Launch API
run: docker compose -f ./ci/docker-compose.ci.yml --env-file ./.env up -d api
- name: Install pnpm
uses: pnpm/action-setup@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: "pnpm"
- name: Install Node.js dependencies
run: pnpm install
- name: Build packages
run: pnpm prebuild
- name: Wait for API to be ready
run: |
timeout 5m bash -c '
until curl -s -f -X POST http://localhost:3000/graphql \
-H "Content-Type: application/json" \
-d "{\"query\": \"query { __typename }\"}" > /dev/null; do
echo "Waiting for API to be ready..."
sleep 2
done
'
continue-on-error: true
- name: Get docker logs
if: failure()
run: |
docker logs lago-api
- name: Run codegen
env:
CODEGEN_API: http://localhost:3000/graphql
run: |
pnpm run codegen
- name: Run Typescript
run: pnpm tsc