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
22 changes: 19 additions & 3 deletions .agents/skills/.agent-context-skills.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
{
"version": 1,
"skills": {
"bake-agent-context-usage": {
"package": "bake-agent-context",
"version": "0.3.0"
},
"socketry-project-github-repository": {
"package": "socketry-project",
"version": "0.2.5"
"version": "0.3.3"
},
"socketry-project-pull-requests": {
"package": "socketry-project",
"version": "0.2.5"
"version": "0.3.3"
},
"socketry-project-releasing": {
"package": "socketry-project",
"version": "0.3.3"
},
"socketry-project-setup": {
"package": "socketry-project",
"version": "0.2.5"
"version": "0.3.3"
},
"socketry-project-testing": {
"package": "socketry-project",
"version": "0.3.3"
},
"socketry-project-update": {
"package": "socketry-project",
"version": "0.3.3"
}
}
}
6 changes: 3 additions & 3 deletions .agents/skills/socketry-project-github-repository/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ settings. Do not rename, archive, transfer, or delete a repository without
explicit approval, and do not disable issues, pull requests, or required checks
without approval.

The Cargo-specific release workflow, environment reviewers, and trusted
publishing are covered in the
[`socketry-project-releasing` skill](https://github.com/socketry/socketry-project-rust/blob/main/context/releasing.md).
The `socketry-project-releasing` skill describes the standard Cargo release
process and links to Bake Cargo task documentation for branch rulesets,
crates.io environment reviewers, and trusted publishing.
57 changes: 21 additions & 36 deletions .agents/skills/socketry-project-setup/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
name: socketry-project-setup
description: Set up a new or existing Rust repository for a Socketry project, including its Cargo layout, shared Bake tasks, agent context, tests, and GitHub workflows. Use when creating a crate repository or bringing one into the standard project structure.
description: Bootstrap a Rust repository with Socketry layout, Bake tasks, agent context, tests, and workflows. Use for a new repository or initial setup.
---

# Set Up a Rust Repository

Use this skill to start a Rust repository with the shared Socketry conventions,
agent context, and release tasks.
Use this skill to bootstrap a new Rust repository or add its initial shared
Socketry tooling. For an audit of an established repository, use the
`socketry-project-update` skill.

## Create the repository

Expand Down Expand Up @@ -38,7 +39,7 @@ minimal binary. Add this dependency under the existing `[dependencies]` table in
`bake/Cargo.toml`:

```toml
socketry-project = "0.2"
socketry-project = "0.3"
```

Run regeneration again to link its task registrations:
Expand All @@ -58,55 +59,39 @@ The `socketry-project` dependency makes the shared tasks available to the
private Bake binary. It also registers `cargo:after_version_bump`, which updates
`license.md`, `releases.md`, and generated sections in `readme.md` after a
version change.
It bundles the standard `test` and `test:external` task providers as well.
Keep task tooling out of unrelated published libraries. Consumer projects
should depend on `socketry-project` from their private `bake/` package.

Install the project's agent context:
## Agent context

```sh
cargo bake agent:context:install
```

This installs ordinary context guides under `.agents/context/`, installs
dependency-provided skills under `.agents/skills/`, and updates `agents.md`
with links to ordinary context. Read that index and inspect applicable skills.
Add `--package socketry-project` to install only this crate's context and
skills. See the Agent Context guide provided by `bake-agent-context` for how to
organize shared and project-only guidance.
Follow the [Agent Context section in `readme.md`](../readme.md#agent-context)
to install and discover shared context and skills. Follow
[Conventions](conventions.md#source-and-documentation) for where to keep
package guidance and project-only instructions. The `bake-agent-context`
guide documents installer behavior and options.

## Set up GitHub

Configure repository metadata, collaboration features, pull request defaults,
and branch protection using the `socketry-project-github-repository` skill.
Generate the Cargo workflow with `cargo:setup:workflow`; follow the
[`socketry-project-releasing` skill](https://github.com/socketry/socketry-project-rust/blob/main/context/releasing.md)
before applying rulesets, environment reviewers, or crates.io trusted
publishing.

## Standard workflows
`socketry-project-releasing` skill before applying rulesets, environment
reviewers, or crates.io trusted publishing. It links to the Bake Cargo Readme
for task-specific details.

Keep `.github/workflows/test.yml` for local workspace tests. When
`bake-test-rust` is linked, install the Cargo launcher and run
`cargo bake --locked test` so the optional `test:before` hook also runs.
Otherwise use `cargo test --workspace --locked`. Add platform or feature
matrix entries when the project needs them.
## Test workflows

List selected downstream projects under
`[workspace.metadata.bake.test.external]` in the root `Cargo.toml`. Add
`.github/workflows/external.yml` only when that list is non-empty, and run
`cargo bake --locked test:external` when `bake-test-rust` is linked. The task
keeps checkouts under `external/` and applies local workspace crates as Cargo
patches so downstream tests exercise the source being developed.
Use the `socketry-project-testing` skill for organization-wide testing
expectations. Consult the installed `bake-test-rust` context for canonical
`test.yml` and optional `external.yml` workflows, task setup, coverage options,
and downstream test configuration.

Use `cargo:setup:workflow` from `bake-cargo` to generate
`.github/workflows/publish.yml`. That workflow checks a release candidate on
pull requests, publishes after merge through the configured `crates-io`
environment, and then creates or updates the matching GitHub Release from
`releases.md`. See the [`socketry-project-releasing` skill](https://github.com/socketry/socketry-project-rust/blob/main/context/releasing.md)
for trusted publishing and repository setup. See the Rust Testing context
guide provided by `socketry-project` for test workflow details and optional
downstream compatibility workflows.
`releases.md`. Follow the `socketry-project-releasing` skill for the release
process and `bake-test-rust` context for workflow and task details.

## Work on the project

Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ jobs:
- name: Run workspace tests with Bake
if: runner.os != 'Windows'
run: cargo bake --locked test
- name: Run workspace tests with Cargo on Windows
if: runner.os == 'Windows'
run: cargo test --workspace --locked
- name: Exercise task discovery and invocation
run: |
cargo bake --locked --list
Expand All @@ -40,18 +37,27 @@ jobs:
cargo bake --locked releases:notes v0.1.0

coverage:
runs-on: ubuntu-latest
name: Coverage (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
runner: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v7
- uses: actions-rust-lang/setup-rust-toolchain@v2
with:
components: clippy, llvm-tools-preview, rustfmt
# Isolate this source-installed tool from the old prebuilt-action cache.
cache-shared-key: coverage-cargo-install-v1
- name: Install Bake launcher
run: cargo install socketry-cargo-bake --locked
- name: Install coverage tool
run: cargo install cargo-llvm-cov --locked
- run: cargo fmt --all -- --check
if: matrix.runner == 'ubuntu-latest'
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
- name: Run tests and require complete line coverage
if: matrix.runner == 'ubuntu-latest'
- name: Run tests and require complete source-region coverage
run: cargo bake --locked test:coverage --all-targets true
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bake/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
socketry-project = ">=0.3.3"
bake = { version = "0.19.0", path = ".." }
bake-agent-context = { version = "0.3.0" }
bake-test-rust = { version = "0.2.2" }
bake-test-rust = { version = "0.3.0" }
bake-releases = { version = "0.3.0" }
bake-cargo = { version = "0.4.0" }
bake-license = { version = "0.2.0" }
Expand Down
13 changes: 12 additions & 1 deletion bake/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ fn prepare(
}

fn run() -> Result<()> {
Registry::discover()?.run()
run_registry(Registry::discover())
}

fn run_registry(registry: Result<Registry>) -> Result<()> {
registry?.run()
}

fn main() -> ExitCode {
Expand Down Expand Up @@ -128,6 +132,7 @@ mod tests {

#[test]
fn exercises_example_tasks_and_cargo_failures() {
assert!(run_registry(Err(Error::new("discovery failure"))).is_err());
assert_eq!(greet("Sam".into(), false, vec![]).unwrap(), "Hello, Sam.");
assert_eq!(
greet("Sam".into(), true, vec!["tag".into()]).unwrap(),
Expand Down Expand Up @@ -176,6 +181,12 @@ mod tests {
assert!(prepare(&mut context, "v0.1.0".into(), true).is_ok());
}

#[test]
fn release_notes_require_a_version() {
let mut context = Registry::new().context(".");
assert!(notes(&mut context, &Arguments::default()).is_err());
}

#[test]
fn maps_task_results_to_process_exit_codes() {
assert_eq!(exit_code(Ok(())), ExitCode::SUCCESS);
Expand Down
Loading
Loading