From 6d5de830e2cd3d6899488c40c47ecf7240b3dce4 Mon Sep 17 00:00:00 2001 From: Jules Zhou Date: Thu, 12 Nov 2026 01:57:39 +0000 Subject: [PATCH] ci: test the Laravel backend and build the Next.js frontend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No CI existed. The backend has 40 tests written and they were never run automatically. backend: PHP 8.3, composer install, then 'php artisan test' against a real PostgreSQL service — phpunit.xml points at pgsql/workless_test, not SQLite, so the Feature tests (which use RefreshDatabase) need a live database. frontend: Node 22, npm ci, npm run build. No lint step for the frontend yet: 'npm run lint' currently reports 23 errors and 26 warnings, almost all explicit 'any'. Fixing those is its own change; a permanently red CI would just be ignored. Verified locally: php artisan test --testsuite=Unit -> 16 tests, 34 assertions, all passing. The 24 Feature tests need the Postgres service this workflow adds. --- .github/workflows/ci.yml | 84 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 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..1d546de --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,84 @@ +name: CI + +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + backend: + name: backend (Laravel) + runs-on: ubuntu-latest + timeout-minutes: 15 + + # phpunit.xml points at PostgreSQL (DB_CONNECTION=pgsql, DB_DATABASE=workless_test), + # so the tests need a real database, not SQLite. + services: + postgres: + image: postgres:16 + env: + POSTGRES_DB: workless_test + POSTGRES_USER: workless + POSTGRES_PASSWORD: workless_secret + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + defaults: + run: + working-directory: backend + + steps: + - uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "8.3" + extensions: mbstring, pdo_pgsql, pgsql, bcmath, gd, zip, xml, curl, intl + coverage: none + + - name: Install dependencies + run: composer install --prefer-dist --no-interaction --no-progress + + - name: Prepare environment + run: | + cp .env.example .env + php artisan key:generate + + - name: Run tests + run: php artisan test + + frontend: + name: frontend (Next.js) + runs-on: ubuntu-latest + timeout-minutes: 10 + + defaults: + run: + working-directory: frontend + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + cache-dependency-path: frontend/package-lock.json + + - name: Install + run: npm ci + + - name: Build + run: npm run build