Skip to content
Open
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
34 changes: 34 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.rs]
indent_size = 4
max_line_length = 120

[*.toml]
indent_size = 2

[*.{yml,yaml}]
indent_size = 2

[*.{json,json5}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab

[*.sh]
indent_size = 4

[Dockerfile*]
indent_size = 4
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Bug Report
description: Report a bug in Clone
labels: ["bug"]
body:
- type: textarea
id: description
attributes:
label: Description
description: A clear description of the bug.
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Steps to Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. Run `clone run --kernel ... --rootfs ...`
2. Inside the guest, run `...`
3. Observe error
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
description: What you expected to happen.
validations:
required: true
- type: textarea
id: environment
attributes:
label: Environment
description: System information.
value: |
- Clone version:
- Host OS/kernel:
- CPU:
- RAM:
- Guest distro:
validations:
required: true
- type: textarea
id: logs
attributes:
label: Logs
description: Relevant log output (run with `RUST_LOG=debug`).
render: shell
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Feature Request
description: Suggest a new feature for Clone
labels: ["enhancement"]
body:
- type: textarea
id: problem
attributes:
label: Problem
description: What problem does this feature solve?
validations:
required: true
- type: textarea
id: solution
attributes:
label: Proposed Solution
description: How should this work?
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives Considered
description: Any alternative approaches you've considered.
- type: textarea
id: context
attributes:
label: Additional Context
description: Any other context (use case, benchmarks, links).
30 changes: 30 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 2
updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
day: monday
groups:
rust-vmm:
patterns:
- "kvm-*"
- "vm-memory"
- "linux-loader"
- "virtio-queue"
async:
patterns:
- "tokio"
- "io-uring"
serialization:
patterns:
- "serde"
- "serde_json"
open-pull-requests-limit: 10

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
open-pull-requests-limit: 5
19 changes: 19 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Summary

<!-- Brief description of what this PR does and why -->

## Changes

<!-- Bullet list of key changes -->

## Test Plan

- [ ] `cargo fmt -- --check` passes
- [ ] `cargo clippy -- -D warnings` passes
- [ ] `cargo test` passes (all unit tests)
- [ ] E2E tests pass (if applicable)
- [ ] Manual testing done (describe below)

## Notes

<!-- Any additional context, trade-offs, or follow-up work -->
127 changes: 127 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_call:

permissions:
contents: read

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

env:
CARGO_TERM_COLOR: always

jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- 'src/**'
- 'crates/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'tests/**'

fmt:
name: Format
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.code == 'true'
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.code == 'true'
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy -- -D warnings

build:
name: Build & Test
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.code == 'true'
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2

- name: Install musl tools
run: sudo apt-get update && sudo apt-get install -y musl-tools

- name: Build (static musl)
run: cargo build --release --target x86_64-unknown-linux-musl

- name: Unit tests
run: cargo test --target x86_64-unknown-linux-musl

- name: Smoke test binary
run: |
./target/x86_64-unknown-linux-musl/release/clone --help
file target/x86_64-unknown-linux-musl/release/clone
ls -lh target/x86_64-unknown-linux-musl/release/clone

- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: clone-linux-x86_64
path: target/x86_64-unknown-linux-musl/release/clone
retention-days: 7

msrv:
name: MSRV check
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.code == 'true'
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.87
- uses: Swatinem/rust-cache@v2
- run: cargo check

deny:
name: Dependency check
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.code == 'true'
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2

security:
name: Security audit
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.code == 'true'
steps:
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Dependabot Auto-Merge

# Triggers on all pull_request events because GitHub Actions does not support
# filtering by actor in the trigger. The `if: github.actor == 'dependabot[bot]'`
# condition on the job ensures only Dependabot PRs are processed.
on:
pull_request:

permissions: {}

jobs:
auto-merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
permissions:
contents: write
pull-requests: write
steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Auto-merge patch and minor updates
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Comment on major updates
if: steps.metadata.outputs.update-type == 'version-update:semver-major'
run: gh pr comment "$PR_URL" --body "Major version update detected. Manual review required."
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release Please

on:
push:
branches: [master]
paths-ignore:
- 'docs/**'
- 'CONTRIBUTING.md'
- 'SECURITY.md'
- 'LICENSE'

permissions:
contents: write
pull-requests: write

concurrency:
group: release-please
cancel-in-progress: false

jobs:
validate:
name: Validate
uses: ./.github/workflows/build.yml

release-please:
name: Create release PR
runs-on: ubuntu-latest
needs: validate
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}

release:
name: Build & publish release
needs: release-please
if: needs.release-please.outputs.release_created
uses: ./.github/workflows/release.yml
with:
tag: ${{ needs.release-please.outputs.tag_name }}
Loading
Loading