diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 0800595..d47a49a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,10 +1,17 @@ ## Summary + ## Related issue + Closes # ## Changes made -- + +- + ## Author checklist + +`bun run pr` runs all the commands below in one go. + - [ ] Matches the spec - [ ] `bun run format` - code has been formatted - [ ] `bun run lint` - no prettier/eslint errors @@ -14,4 +21,5 @@ Closes # - [ ] I tested the relevant changes manually ## Reviewer manual testing checklist -- [ ] \ No newline at end of file + +- [ ] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c6d69a1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: + pull_request: + workflow_dispatch: + +concurrency: + group: ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + checks: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Check out repository + uses: actions/checkout@v5 + + - name: Set up Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install --frozen-lockfile + + # Needed by the vitest browser-mode project (chromium via playwright) + - name: Install Playwright browsers + run: bunx playwright install chromium --with-deps + + # `bun run format` is local-only; CI verifies formatting via prettier --check in `lint` + - name: Lint (prettier + eslint) + run: bun run lint + + - name: Check (svelte-check + TypeScript) + run: bun run check + + - name: Test + run: bun run test + + - name: Build + run: bun run build diff --git a/README.md b/README.md index dedd261..df2b941 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,14 @@ bun run test # unit tests bun run build # production build ``` +Or run them all in one go: + +```sh +bun run pr +``` + +CI runs the same checks (all except `format`) on every pull request. + ## License -This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. \ No newline at end of file +This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. diff --git a/package.json b/package.json index ff6ab5a..40d85c2 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "lint": "prettier --check . && eslint .", "format": "prettier --write .", "test:unit": "vitest", - "test": "npm run test:unit -- --run" + "test": "npm run test:unit -- --run", + "pr": "bun run format && bun run lint && bun run check && bun run test && bun run build" }, "devDependencies": { "@eslint/js": "^10.0.1",