diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..543516f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,87 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + web-ci: + name: Web CI + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Lint + run: pnpm --filter @headquarter/web lint + + - name: Typecheck + run: pnpm --filter @headquarter/web typecheck + + - name: Test + run: pnpm --filter @headquarter/web test + + api-ci: + name: API CI + runs-on: ubuntu-latest + services: + postgres: + image: postgres:16 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: headquarter_test + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install API dev dependencies + working-directory: apps/api + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Ruff check + working-directory: apps/api + run: ruff check app/ tests/ + + - name: Mypy + working-directory: apps/api + run: mypy app/ tests/ + + - name: Pytest + working-directory: apps/api + env: + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/headquarter_test + run: pytest diff --git a/apps/api/pyproject.toml b/apps/api/pyproject.toml index 1dc9631..29885ec 100644 --- a/apps/api/pyproject.toml +++ b/apps/api/pyproject.toml @@ -18,6 +18,7 @@ dependencies = [ [project.optional-dependencies] dev = [ "pytest>=8.3.0", + "pytest-asyncio>=0.24.0", "httpx>=0.28.0", "ruff>=0.11.0", "mypy>=1.15.0",