feat: custom scripts #2709
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Controlplane CI | |
on: | |
pull_request: | |
paths: | |
- "controlplane/**/*" | |
- "connect/**/*" | |
- "composition/**/*" | |
- ".github/workflows/cp-ci.yaml" | |
concurrency: | |
group: ${{github.workflow}}-${{github.head_ref}} | |
cancel-in-progress: true | |
env: | |
CI: true | |
DO_NOT_TRACK: '1' | |
jobs: | |
build_test: | |
timeout-minutes: 10 | |
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 | |
with: | |
fetch-depth: 0 | |
- 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: Check if git is not dirty after generating files | |
run: git diff --no-ext-diff --exit-code | |
- name: Build | |
run: pnpm run --filter ./controlplane --filter ./connect --filter ./shared --filter ./composition build | |
- 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 | |
env: | |
DB_URL: "postgresql://postgres:changeme@localhost:5432/controlplane" | |
build_push_image: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- 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" |