From 60e6a892979ad1c11a9492340a732c187bc479dd Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 3 Oct 2026 11:28:17 -0400 Subject: [PATCH] Add CI: typecheck, lint, tests, migration drift, builds Runs against Postgres and Redis service containers. Fails if schema.ts changes without a generated migration, and bundles the mobile app for iOS and Android to catch Metro resolution issues. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MzFywujuH9TiuXbr9vjoX8 --- .github/workflows/ci.yml | 77 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ada680e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,77 @@ +name: CI + +on: + push: + branches: [master, main] + pull_request: + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + runs-on: ubuntu-latest + timeout-minutes: 20 + + services: + postgres: + image: postgres:17 + env: + POSTGRES_USER: musicshare + POSTGRES_PASSWORD: musicshare + POSTGRES_DB: musicshare_test + ports: ['5432:5432'] + options: >- + --health-cmd "pg_isready -U musicshare" + --health-interval 5s --health-timeout 5s --health-retries 10 + redis: + image: redis:7 + ports: ['6379:6379'] + options: >- + --health-cmd "redis-cli ping" + --health-interval 5s --health-timeout 5s --health-retries 10 + + env: + TEST_DATABASE_URL: postgres://musicshare:musicshare@localhost:5432/musicshare_test + TEST_REDIS_URL: redis://localhost:6379/1 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: npm + + - run: npm ci + + - name: Typecheck + run: npx turbo run typecheck + + - name: Lint + run: npx turbo run lint + + - name: Test + run: npx turbo run test + + - name: Check migrations match the schema + working-directory: apps/api + run: | + npx drizzle-kit generate --name ci-check + if [ -n "$(git status --porcelain drizzle)" ]; then + echo "::error::schema.ts has changes without a migration. Run 'npm run db:generate' and commit the result." + git status --porcelain drizzle + exit 1 + fi + + - name: Build web + run: npx turbo run build --filter=@musicshare/web + env: + NEXT_PUBLIC_API_URL: https://api.example.com + + - name: Bundle mobile (iOS + Android) + working-directory: apps/mobile + run: npx expo export --platform ios --platform android --output-dir /tmp/expo-export + env: + EXPO_PUBLIC_API_URL: https://api.example.com