-
Notifications
You must be signed in to change notification settings - Fork 738
49 lines (47 loc) · 2.02 KB
/
check-api-for-breaking-changes.yml
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
name: "Check Backend Breaking API Changes"
on:
pull_request:
types: [opened, synchronize]
paths:
- "backend/src/server/routes/**"
jobs:
check-be-api-changes:
name: Check API Changes
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Setup Node 20
uses: actions/setup-node@v3
with:
node-version: "20"
# uncomment this when testing locally using nektos/act
# - uses: KengoTODA/actions-setup-docker-compose@v1
# if: ${{ env.ACT }}
# name: Install `docker-compose` for local simulations
# with:
# version: "2.14.2"
- name: 📦Build the latest image
run: docker build --tag infisical-api .
working-directory: backend
- name: Start postgres and redis
run: touch .env && docker-compose -f "docker-compose.pg.yml" up db redis -d
- name: Start the server
run: docker run --name infisical-api -d -p 4000:4000 -e DB_CONNECTION_URI=$DB_CONNECTION_URI -e REDIS_URL=$REDIS_URL -e JWT_AUTH_SECRET=$JWT_AUTH_SECRET --entrypoint '/bin/sh' infisical-api -c "npm run migration:latest && ls && node dist/main.mjs"
env:
REDIS_URL=redis://host.docker.internal:6379
DB_CONNECTION_URI=postgres://infisical:[email protected]:5432/infisical?sslmode=disable
JWT_AUTH_SECRET=something-random
- name: Install openapi api diff
run: npm install -g openapi-diff
- name: Wait for containers to be stable
run: timeout 60s sh -c 'until docker ps | grep infisical-api | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 2; done'
- name: Get changes made in API
id: openapi-diff
run: openapi-diff https://app.infisical.com/api/docs/json http://localhost:4000/api/docs/json
- name: cleanup
run: |
docker-compose -f "docker-compose.pg.yml" down
docker stop infisical-api
docker remove infisical-api