Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:

- uses: jdx/mise-action@82a612c5ab8bcda7cc5db6b7e81a8e7584c3dc6e # v5.2.3

- run: mise run setup

- name: Run checks
run: mise run check
env:
Expand Down
32 changes: 13 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
# Тесты стека через задачи mise. В самом шаблоне test заглушка, поэтому здесь
# job пропускается, а в репозитории из шаблона он красный до первой настройки
# (AGENTS.md). Линтеры стека идут шагами hk и запускаются в check.yml.
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
branches:
- main
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
branches:
- main
workflow_dispatch:


concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions: {}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
if: github.repository != 'hexlet-components/component-template'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo "TODO: add workflow"
- uses: jdx/mise-action@82a612c5ab8bcda7cc5db6b7e81a8e7584c3dc6e # v5.2.3

- run: mise run setup
- run: mise run test
16 changes: 16 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# AGENTS.md

Репозиторий создан из шаблона `hexlet-components/component-template`. Шаблон ставит общий слой проверок из [dev-quality-gates](https://github.com/mokevnin/dev-quality-gates): mise, hk, commitlint, rumdl, typos, lychee, jactionlint и betterleaks. Проверки под стек репозитория шаблон не знает, их добавляет первая настройка.

## Первая настройка

Пока этот раздел в файле, репозиторий не настроен. Задача `test` падает, и CI красный.

1. Определи стек по задаче компонента.
2. Пройди [adopt.md](https://raw.githubusercontent.com/mokevnin/dev-quality-gates/main/docs/adopt.md) для этого стека. Общий слой уже стоит, его не трогай. Новые инструменты закрепляются в `mise.toml`, линтеры и форматтеры стека становятся шагами `hk.pkl`, и их запускает `mise run check`. OSV-Scanner добавляется вместе с первым lock-файлом.
3. Фронтенд берёт CSS по `docs/css-frameworks-migration.md` из hexlet-exercise-kit. С React это Vite и Mantine, без React последний Tailwind.
4. Задачи проекта живут в `mise.toml`, а `Makefile` только проксирует `make <задача>` в `mise run <задача>`. Поставь установку зависимостей стека в `setup` перед `hk install` и заполни `test`. Компонент с публикацией получает выкладку в `.github/workflows/main.yml`, actions в ней закрепляются по SHA.
5. Добавь экосистему пакетов стека в `.github/dependabot.yml`.
6. Доведи `README.md` по его заготовке. Замени `component-template` именем репозитория, в том числе в бейджах и `utm_campaign`, опиши компонент и для какого курса, проекта или программы он нужен, удали цитату про шаблон. Блок про Хекслет внизу остаётся.

Настройка закончена, когда `mise run setup`, `mise run check` и `mise run test` проходят, каждый новый шаг проверки один раз упал на подложенном нарушении, а этот раздел удалён из файла.
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
setup:
@echo "TODO: add setup"
# Тонкий прокси: make <задача> запускает mise run <задача>. Задачи живут в mise.toml.
%: FORCE
@mise run $@

test:
@echo "TODO: add tests"

lint:
@echo "TODO: add lint"
# Без этого правила make пытается собрать сам Makefile через прокси.
Makefile: ;
FORCE: ;
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
# component-template

Template for new repositories
[![CI](https://github.com/hexlet-components/component-template/actions/workflows/main.yml/badge.svg)](https://github.com/hexlet-components/component-template/actions/workflows/main.yml)
[![Check](https://github.com/hexlet-components/component-template/actions/workflows/check.yml/badge.svg)](https://github.com/hexlet-components/component-template/actions/workflows/check.yml)

[![Hexlet Ltd. logo](https://raw.githubusercontent.com/Hexlet/assets/master/images/hexlet_logo128.png)](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=pg-dump-example)
> Шаблон репозиториев hexlet-components. Новый репозиторий создаётся командой ниже, а после клона его настраивает раздел «Первая настройка» в [AGENTS.md](AGENTS.md). Настройка заменяет `component-template` в этом файле именем репозитория, заполняет разделы и удаляет эту цитату.
>
> ```sh
> gh repo create hexlet-components/<имя> --public --template hexlet-components/component-template --description "<что это и для какого курса>"
> ```

This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet](https://hexlet.io/pages/about?utm_source=github&utm_medium=link&utm_campaign=pg-dump-example).
Что это и для какого курса, проекта или программы Хекслета. Одним-двумя абзацами: кто пользуется компонентом (студент в уроке, проверка практики, стенд проекта) и что сломается у них, если его поменять.

## Запуск

```sh
mise run setup
mise run test
```

`make <задача>` вызывает ту же задачу mise.

## Проверки

`mise run check` гоняет тот же набор, что CI: разметку, опечатки, ссылки, workflows и проверки стека.

---

[![Hexlet Ltd. logo](https://raw.githubusercontent.com/Hexlet/assets/master/images/hexlet_logo128.png)](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=component-template)

This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet](https://hexlet.io/pages/about?utm_source=github&utm_medium=link&utm_campaign=component-template).
7 changes: 7 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ pkl = "latest"
rumdl = "latest"
typos = "latest"

# Задачи проекта живут здесь, Makefile только проксирует make <задача> в mise run.
# Первая настройка (AGENTS.md) ставит зависимости стека в setup перед hk install
# и заполняет test.
[tasks.setup]
description = "Поставить зависимости и git-хуки"
run = ["hk install"]

[tasks.test]
description = "Тесты стека"
run = 'echo "test не настроен, см. AGENTS.md" >&2; exit 1'

[tasks.check]
description = "Все проверки, тот же набор, что гоняет CI"
run = "hk check --all"
Expand Down
Loading