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
33 changes: 33 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "hexhamming",
"image": "mcr.microsoft.com/devcontainers/python:3.14",
"features": {
"ghcr.io/devcontainers/features/rust:1": {
"version": "stable",
"profile": "minimal",
"components": "rustfmt,clippy,rust-analyzer"
},
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"postCreateCommand": "bash .devcontainer/post-create.sh",
"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer",
"ms-python.python",
"charliermarsh.ruff",
"tamasfe.even-better-toml"
],
"settings": {
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": ["test"],
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
},
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
}
}
}
}
}
9 changes: 9 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail

python -m pip install --upgrade pip
# Keep ruff in sync with the lint job in .github/workflows/pythonpackage.yml.
python -m pip install ruff==0.16.8 maturin pytest pytest-benchmark

python -m pip install .
cargo fetch
7 changes: 6 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ Always reference these instructions first and fallback to search or bash command
## Working Effectively

### Essential Setup Commands
Run these commands in sequence to set up the development environment:
The devcontainer (`.devcontainer/`) and Copilot cloud agent setup
(`.github/workflows/copilot-setup-steps.yml`) already install Rust, ruff, maturin and
pytest and build the package. Otherwise, run these commands in sequence to set up the
development environment:

```bash
# Install Rust toolchain (if not already installed)
Expand Down Expand Up @@ -198,6 +201,8 @@ The project uses GitHub Actions with maturin for cross-platform wheel building:
`scripts/pgo_bench.py` in the job summary. Nothing is published from pull requests
- `Benchmark PR` (`benchmark.yml`): benchmarks every PR against its base branch on x86 and
comments the comparison
- `Copilot Setup Steps` (`copilot-setup-steps.yml`): prepares the Copilot cloud agent's
environment; its ruff pin must match the `lint` job's
- Builds wheels for Linux (manylinux), macOS, Windows
- Tests on Python 3.10-3.14
- **Build time in CI**: 15-45 minutes depending on platform
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Copilot Setup Steps

# Runs automatically when changed so the setup can be validated, and can be
# run manually from the Actions tab.
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml

jobs:
# The job MUST be called `copilot-setup-steps` to be picked up by Copilot.
copilot-setup-steps:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.14"

- name: Install Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
components: rustfmt, clippy

- name: Cache Cargo
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3

- name: Install Python tooling
run: |
python -m pip install --upgrade pip
# Keep ruff in sync with the lint job in pythonpackage.yml.
pip install ruff==0.16.8 maturin pytest pytest-benchmark

- name: Build and install hexhamming
run: pip install .

# Pre-builds the Rust test binaries so the first `cargo test` is fast.
- name: Build Rust tests
run: cargo test --no-default-features --no-run
Loading