Skip to content

Commit 9033688

Browse files
committed
ci: add copilot instructions
1 parent 2703b16 commit 9033688

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

.github/copilot-instructions.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## General Copilot Instructions
2+
3+
- Commit messages and PR names should follow Conventional Commits specification (https://www.conventionalcommits.org/en/v1.0.0/)
4+
- Use present tense ("add feature" not "added feature")
5+
6+
## Folder Structure
7+
8+
- `/src/mplhep`: Contains the source code for project.
9+
- `/tests`: Contains tests.
10+
- `/docs`: Contains documentation for the project, including API specifications and user guides.
11+
- `/examples`: Is a joint folder for examples which are parts of both documentation and tests.
12+
13+
## Coding Standards
14+
15+
- Use single quotes for strings. Such that printed statements containing strings can use double quotes.
16+
- Follow PEP 8 guidelines for Python code.
17+
- Write docstrings for all public functions and classes using the NumPy/SciPy style.
18+
- Follow ruff configuration in pyproject.toml for linting and formatting
19+
- Use type hints where appropriate (mypy configuration available)
20+
- Run pre-commit hooks before committing
21+
22+
23+
## Testing Guidelines
24+
25+
- For new features, add tests to the `tests/copilot` directory
26+
- When resolving issues, write tests into `tests/from_issues` directory
27+
- Use pytest-mpl for matplotlib-based tests that require visual comparison (most cases)
28+
- If you think it's useful, you can run the test suite with `python -m pytest -r sa --mpl --mpl-results-path=pytest_results -n 4` before submitting changes
29+
- Intentionally changed behaviours might require a new baseline generated as `pytest --mpl-generate-path=tests/baseline` if visual outputs change
30+
31+
32+
## Project-Specific Guidelines
33+
34+
- Keep backward compatibility in mind for public APIs
35+
- Consider optional dependencies vs core requirements carefully

.github/copilot-setup-steps.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- .github/workflows/copilot-setup-steps.yml
10+
pull_request:
11+
paths:
12+
- .github/workflows/copilot-setup-steps.yml
13+
14+
jobs:
15+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
16+
copilot-setup-steps:
17+
runs-on: ubuntu-latest
18+
19+
# Set the permissions to the lowest permissions possible needed for your steps.
20+
# Copilot will be given its own token for its operations.
21+
permissions:
22+
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
23+
contents: read
24+
25+
# You can define any steps you want, and they will run before the agent starts.
26+
# If you do not check out your code, Copilot will do this for you.
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v5
30+
31+
- name: Setup uv
32+
uses: astral-sh/setup-uv@v5
33+
with:
34+
version: "latest"
35+
python-version: ${{ matrix.python-version }}
36+
enable-cache: true
37+
cache-dependency-glob: "**/pyproject.toml"
38+
39+
- name: Requirements check
40+
run: uv pip list
41+
42+
- name: Install core fonts
43+
if: runner.os == 'Linux'
44+
run: |
45+
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
46+
sudo apt-get install ttf-mscorefonts-installer
47+
48+
- name: Install package
49+
run: |
50+
uv pip install -e ".[all]"
51+
uv pip install pytest-github-actions-annotate-failures
52+
uv pip list

0 commit comments

Comments
 (0)