77 - " connect/**/*"
88 - " composition/**/*"
99 - " shared/**/*"
10- - " .github/workflows/cp-ci.yaml"
10+ - " .github/workflows/controlplane-ci.yaml"
11+ - " .github/compose/controlplane-ci.yaml"
1112 - " .github/scripts/setup-keycloak.sh"
1213
1314concurrency :
@@ -22,37 +23,30 @@ jobs:
2223 build_test :
2324 timeout-minutes : 20
2425 runs-on : ubuntu-latest
25- services :
26- redis :
27- # Docker Hub image
28- image : redis:7
29- credentials :
30- username : ${{secrets.DOCKER_USERNAME}}
31- password : ${{secrets.DOCKER_PASSWORD}}
32- ports :
33- - 6379:6379
34- postgres :
35- # Docker Hub image
36- image : postgres:15
37- credentials :
38- username : ${{secrets.DOCKER_USERNAME}}
39- password : ${{secrets.DOCKER_PASSWORD}}
40- ports :
41- - 5432:5432
42- env :
43- POSTGRES_USER : postgres
44- POSTGRES_PASSWORD : changeme
45- # Set health checks to wait until postgres has started
46- options : >-
47- --health-cmd pg_isready
48- --health-interval 10s
49- --health-timeout 5s
50- --health-retries 5
26+ permissions :
27+ contents : read
28+ env :
29+ DOCKER_CREDENTIALS_AVAILABLE : ${{ secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }}
5130
5231 steps :
5332 - uses : actions/checkout@v4
33+ with :
34+ persist-credentials : false
35+
36+ - name : Log in to Docker Hub
37+ if : env.DOCKER_CREDENTIALS_AVAILABLE == 'true'
38+ uses : docker/login-action@v3
39+ with :
40+ username : ${{ secrets.DOCKER_USERNAME }}
41+ password : ${{ secrets.DOCKER_PASSWORD }}
5442
55- - uses : ./.github/actions/node
43+ - name : Start service containers
44+ run : docker compose --project-name controlplane-ci --file .github/compose/controlplane-ci.yaml up --detach --wait --wait-timeout 60
45+
46+ - uses : pnpm/setup@84cb39b217b10273981911c288cd62326dc7c6d2 # v2
47+ with :
48+ cache : true
49+ install : false
5650
5751 - name : Install dependencies
5852 run : pnpm install --frozen-lockfile
@@ -106,6 +100,11 @@ jobs:
106100 retention-days : 14
107101 codecov-token : ${{ secrets.CODECOV_TOKEN }}
108102
103+ - name : Stop service containers
104+ if : always()
105+ continue-on-error : true
106+ run : docker compose --project-name controlplane-ci --file .github/compose/controlplane-ci.yaml down --volumes --remove-orphans
107+
109108 build_push_image :
110109 # This is a limitation of GitHub. Only organization members can push to GitHub Container Registry
111110 # For now, we will disable the push to the GitHub Container Registry for external contributors
@@ -124,4 +123,3 @@ jobs:
124123 token : ${{secrets.GITHUB_TOKEN}}
125124 image_name : controlplane
126125 image_description : " Cosmo Controlplane"
127-
0 commit comments