-
Notifications
You must be signed in to change notification settings - Fork 227
127 lines (107 loc) · 3.57 KB
/
controlplane-ci.yaml
File metadata and controls
127 lines (107 loc) · 3.57 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
name: Controlplane CI
on:
pull_request:
paths:
- 'pnpm-lock.yaml'
- "controlplane/**/*"
- "connect/**/*"
- "composition/**/*"
- "shared/**/*"
- ".github/workflows/cp-ci.yaml"
- ".github/scripts/setup-keycloak.sh"
concurrency:
group: ${{github.workflow}}-${{github.head_ref}}
cancel-in-progress: true
env:
CI: true
DO_NOT_TRACK: '1'
jobs:
build_test:
timeout-minutes: 15
runs-on: ubuntu-latest
services:
redis:
# Docker Hub image
image: redis:7
credentials:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
ports:
- 6379:6379
postgres:
# Docker Hub image
image: postgres:15
credentials:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: changeme
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/node
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate code
run: pnpm buf generate --template buf.ts.gen.yaml
- name: Install react-email
run: pnpm add -g react-email
- name: Generate email templates
run: pnpm run --filter ./controlplane/emails build
- name: Lint & format
run: pnpm run --filter ./controlplane/ lint:fix
- uses: ./.github/actions/git-dirty-check
with:
package-name: controlplane
- name: Build
run: pnpm run --filter ./controlplane --filter ./connect --filter ./shared --filter ./composition --filter ./protographic build
- name: Check `dist` directory structure
run: |
if [ ! -f "controlplane/dist/index.js" ]; then
exit 1
fi
shell: bash
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '20.0.2'
- name: Setup Keycloak
run: nohup .github/scripts/setup-keycloak.sh &
- name: Test
run: pnpm run --filter controlplane test:coverage
env:
DB_URL: "postgresql://postgres:changeme@localhost:5432/controlplane"
- name: Upload Coverage to Codecov
uses: ./.github/actions/codecov-upload-pr
with:
artifact-name: controlplane-tests-coverage
coverage-path: |
controlplane/coverage/clover.xml
controlplane/coverage/coverage-final.json
retention-days: 14
codecov-token: ${{ secrets.CODECOV_TOKEN }}
build_push_image:
# This is a limitation of GitHub. Only organization members can push to GitHub Container Registry
# For now, we will disable the push to the GitHub Container Registry for external contributors
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-push-image
with:
docker_username: ${{secrets.DOCKER_USERNAME}}
docker_password: ${{secrets.DOCKER_PASSWORD}}
docker_context: .
dockerfile: controlplane/Dockerfile
token: ${{secrets.GITHUB_TOKEN}}
image_name: controlplane
image_description: "Cosmo Controlplane"