From 5cd2fe70a40ab3d592a38f6775705e7ebbf70a3b Mon Sep 17 00:00:00 2001 From: SlimusMinus Date: Wed, 21 Oct 2026 22:27:35 +0300 Subject: [PATCH] Add GitHub Actions CI: lint, typecheck, tests and build on PRs to master Runs on every pull request to master and on push to master (Node 22, npm ci, CI=true). The gitea deploy workflow is unchanged. README describes the check and recommends making it required for master. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ README.md | 11 +++++++++++ 2 files changed, 45 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..d92fad4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + pull_request: + branches: [master] + push: + branches: [master] + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + checks: + name: lint, typecheck, test, build + runs-on: ubuntu-latest + timeout-minutes: 20 + env: + CI: true + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + # .npmrc задаёт legacy-peer-deps=true (react-scripts 5 + TypeScript 5) + - run: npm ci + + - run: npm run lint + - run: npm run typecheck + - run: npm run test:ci + - run: npm run build diff --git a/README.md b/README.md index cf52483..d1516e6 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,17 @@ CRA типы не проверяет — их вырезает babel, а про Перед коммитом стоит прогнать все четыре проверки: `lint`, `typecheck`, `test:ci`, `build`. +### CI (GitHub Actions) + +`.github/workflows/ci.yml` запускается на каждый PR в `master` и на push в `master`: +Node 22, `npm ci`, затем те же четыре проверки с `CI=true` (в этом режиме +предупреждения сборки CRA считаются ошибками). `REACT_APP_*` не задаются — для +проверок они не нужны. Деплой по-прежнему делает `.gitea/workflows/deploy.yml`. + +Рекомендуется включить защиту ветки: GitHub → Settings → Branches → правило для +`master` → *Require status checks to pass before merging* → выбрать проверку +`lint, typecheck, test, build` (появится в списке после первого запуска workflow). + --- ## 5. Структура проекта