Skip to content

Commit

Permalink
Fixes openstatusHQ#966: Add docker and checker.yml configurations for…
Browse files Browse the repository at this point in the history
… running migrations in CI
  • Loading branch information
parthiv011 committed Aug 4, 2024
1 parent 6f3ef73 commit bc3dc73
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 4 deletions.
47 changes: 43 additions & 4 deletions .github/workflows/checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,51 @@ jobs:
ci:
name: Continuous Integration
runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: 15
services:
sqld:
image: ghcr.io/tursodatabase/libsql-server:latest
ports:
- 8080:8080

env:
DATABASE_URL: http://127.0.0.1:8080
DATABASE_AUTH_TOKEN: "any-token"

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9.1.4

- name: Set up bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: pnpm install

- name: Run database migrations
run: pnpm run migrate
working-directory: ./packages/db

- name: Build Docker image
run: docker build -t your-image-name --build-arg DATABASE_URL=${{ env.DATABASE_URL }} --build-arg DATABASE_AUTH_TOKEN=${{ env.DATABASE_AUTH_TOKEN }} .

- name: Run Go setup
uses: actions/setup-go@v5
with:
go-version: '>=1.22.0'
- name: Run test

- name: Run Go tests
run: go test -timeout 30s -race -count=1 ./...
working-directory: apps/checker
6 changes: 6 additions & 0 deletions apps/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ RUN rm -rf /app/packages/integrations/vercel
# Temp solution for bun
RUN bun install --ignore-scripts

# Run Database migrations
WORKDIR /app/packages/db
ENV DATABASE_URL=$DATABASE_URL
ENV DATABASE_AUTH_TOKEN=$DATABASE_AUTH_TOKEN
RUN bun run migrate

EXPOSE 3000

WORKDIR /app/apps/server
Expand Down

0 comments on commit bc3dc73

Please sign in to comment.