From b85acaf7b409db52b0e00124a46fe8db3705ac7e Mon Sep 17 00:00:00 2001 From: mulhamna Date: Sat, 4 Apr 2026 20:00:25 +0700 Subject: [PATCH] Init : CI Workflows --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++++++ .github/workflows/pr-title.yml | 40 +++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pr-title.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7418b8a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: CI + +on: + pull_request: + branches: + - main + push: + branches: + - development + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint-typecheck-build: + name: Lint, Typecheck & Build + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.15.0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Generate Prisma client + run: pnpm --filter web db:generate + env: + DATABASE_URL: postgresql://appuser:dummy@localhost:5432/virtualoffice + + - name: Typecheck + run: pnpm typecheck + + - name: Lint + run: pnpm lint + + - name: Build + run: pnpm build + env: + # Dummy values — Next.js needs these to complete build + NEXTAUTH_URL: http://localhost:3000 + NEXTAUTH_SECRET: dummy-secret-for-ci-build-only + GOOGLE_CLIENT_ID: dummy-client-id + GOOGLE_CLIENT_SECRET: dummy-client-secret + ALLOWED_WORKSPACE_DOMAIN: example.com + DATABASE_URL: postgresql://appuser:dummy@localhost:5432/virtualoffice + REDIS_URL: redis://localhost:6379 diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml new file mode 100644 index 0000000..036ed8e --- /dev/null +++ b/.github/workflows/pr-title.yml @@ -0,0 +1,40 @@ +name: PR Title Check + +on: + pull_request: + branches: + - main + types: + - opened + - edited + - synchronize + - reopened + +jobs: + check-title: + name: Validate PR Title (Conventional Commits) + runs-on: ubuntu-latest + + steps: + - name: Check PR title format + uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # Allowed types: feat, fix, chore, docs, style, refactor, perf, test, ci, build, revert + types: | + feat + fix + chore + docs + style + refactor + perf + test + ci + build + revert + requireScope: false + subjectPattern: ^.{1,100}$ + subjectPatternError: | + PR title subject harus antara 1-100 karakter.