Skip to content

Commit

Permalink
ci: Add control-plane test step
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith committed Nov 28, 2024
1 parent b2f996e commit 3c94390
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 7 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
sdk_go: ${{ steps.filter.outputs.sdk_go }}
sdk_react: ${{ steps.filter.outputs.sdk_react }}
cli: ${{ steps.filter.outputs.cli }}
control_plane: ${{ steps.filter.outputs.control_plane }}
app: ${{ steps.filter.outputs.app }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -44,6 +46,117 @@ jobs:
- 'sdk-react/**'
cli:
- 'cli/**'
control_plane:
- 'control-plane/**'
app:
- 'app/**'
build-control-plane:
needs: check_changes
if: ${{ needs.check_changes.outputs.control_plane == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: control-plane
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: control-plane/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build

test-control-plane:
runs-on: ubuntu-latest
needs: [check_changes, build-control-plane]
if: ${{ needs.check_changes.outputs.control_plane == 'true' }}
defaults:
run:
working-directory: control-plane
services:
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: pgvector/pgvector:pg16
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: control-plane/package-lock.json
- name: Install dependencies
run: npm ci
- name: Run tests
run: |
set -eo pipefail
npm run test
if [[ "$(git rev-parse --abbrev-ref HEAD)" == "main" ]]; then
npx run test:ai
fi
env:
REDIS_URL: "redis://localhost:6379"
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/postgres"
DATABASE_SSL_DISABLED: "1"
JWKS_URL: ${{ secrets.TEST_JWKS_URL }}
AWS_ACCESS_KEY_ID: ${{ secrets.TEST_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: "ap-southeast-2"
BEDROCK_AVAILABLE: "true"
SQS_RUN_PROCESS_QUEUE_URL: "PLACEHOLDER"
SQS_RUN_GENERATE_NAME_QUEUE_URL: "PLACEHOLDER"
SQS_LEARNING_INGEST_QUEUE_URL: "PLACEHOLDER"
SQS_CUSTOMER_TELEMETRY_QUEUE_URL: "PLACEHOLDER"
SQS_EXTERNAL_TOOL_CALL_QUEUE_URL: "PLACEHOLDER"

build-app:
needs: check_changes
if: ${{ needs.check_changes.outputs.app == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: app
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: app/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build

build-node:
needs: check_changes
Expand Down
10 changes: 4 additions & 6 deletions control-plane/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion control-plane/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
"@toolhouseai/sdk": "^1.0.4",
"@ts-rest/core": "^3.27.0",
"@ts-rest/fastify": "^3.27.0",
"@ts-rest/fastify": "3.45.2",
"@ts-rest/open-api": "^3.45.2",
"advisory-lock": "^2.0.0",
"ajv": "=8.17.1",
Expand Down

0 comments on commit 3c94390

Please sign in to comment.