Add a script for running through some basic repository setup#189
Merged
ShadowCurse merged 6 commits intorust-vmm:mainfrom Oct 16, 2025
Merged
Add a script for running through some basic repository setup#189ShadowCurse merged 6 commits intorust-vmm:mainfrom
ShadowCurse merged 6 commits intorust-vmm:mainfrom
Conversation
b42aeec to
9679581
Compare
Member
Author
|
Sample output of running this script in the vhost repository: where the following changes would be made: diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 37675b73db2b..973292a9c3bc 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,18 +1,27 @@
version: 2
updates:
-- package-ecosystem: cargo
+
+# A weekly update of the rust-vmm-ci submodule
+- package-ecosystem: gitsubmodule
directory: "/"
schedule:
interval: weekly
- allow:
- - dependency-type: direct
- - dependency-type: indirect
- groups:
- vhost:
- patterns:
- - "*"
-- package-ecosystem: gitsubmodule
+ day: monday
+ open-pull-requests-limit: 1
+
+# A weekly update to rust dependencies. These will be grouped,
+# e.g. one PR will contains updates for all dependencies.
+- package-ecosystem: cargo
directory: "/"
schedule:
interval: weekly
- open-pull-requests-limit: 10
+ day: monday
+ open-pull-requests-limit: 1
+ # Make it also update transitive dependencies in Cargo.lock
+ allow:
+ - dependency-type: "all"
+ # Group all available updates into a group called "rust-dependencies"
+ groups:
+ rust-dependencies:
+ patterns:
+ - "*"
diff --git a/.github/workflows/publish-vhost-user-backend.yml b/.github/workflows/publish-vhost-user-backend.yml
new file mode 100644
index 000000000000..24aa8ed12116
--- /dev/null
+++ b/.github/workflows/publish-vhost-user-backend.yml
@@ -0,0 +1,21 @@
+name: Publish to crates.io
+
+on:
+ push:
+ tags: ['vhost-user-backend-v*'] # Triggers when pushing version tags
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ # environment: release # Optional: for enhanced security
+ permissions:
+ id-token: write # Required for OIDC token exchange
+ steps:
+ - uses: actions/checkout@v4
+ - uses: rust-lang/crates-io-auth-action@v1
+ id: auth
+ - run: |
+ cd vhost-user-backend
+ cargo publish
+ env:
+ CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
\ No newline at end of file
diff --git a/.github/workflows/publish-vhost.yml b/.github/workflows/publish-vhost.yml
new file mode 100644
index 000000000000..5bbba7cf6a64
--- /dev/null
+++ b/.github/workflows/publish-vhost.yml
@@ -0,0 +1,21 @@
+name: Publish to crates.io
+
+on:
+ push:
+ tags: ['vhost-v*'] # Triggers when pushing version tags
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ # environment: release # Optional: for enhanced security
+ permissions:
+ id-token: write # Required for OIDC token exchange
+ steps:
+ - uses: actions/checkout@v4
+ - uses: rust-lang/crates-io-auth-action@v1
+ id: auth
+ - run: |
+ cd vhost
+ cargo publish
+ env:
+ CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
\ No newline at end of file
diff --git a/.platform b/.platform
new file mode 100644
index 000000000000..86353074a1f4
--- /dev/null
+++ b/.platform
@@ -0,0 +1,2 @@
+x86_64
+aarch64 |
Member
Author
|
And running it a second time on the vhost repo produces and no further changes |
4 tasks
f29ac18 to
56768d8
Compare
4 tasks
stefano-garzarella
requested changes
Oct 10, 2025
Member
stefano-garzarella
left a comment
There was a problem hiding this comment.
Cool, thanks for that! Just something to fix, the rest LGTM!
Add a repository_setup.sh script that automates a couple of setup steps for setup of new rust-vmm repositories. It also supports updating the configuration of already created repositories by comparing the repository's configuration to the defaults in rust-vmm-ci and giving the option to update. Currently, the script supports dependabot setup and .platform file generation. It does not deal with the coverage files, since I am still hoping to switch us over to codecov.io in the future, at which point that will all changes completely anyway. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Replace the manual instructions for setting up dependabot and .platform file with instructions to run the new script. Move the explanation of the .platform file to the testing section (where we were incorrectly claiming that we only support x86_64 and aarch64, so fix that up too). Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Add a github action sample workflow file for auto-publishing crates on creation of 'v*' tags. The sample workflow assumes a non-workspace setup, so that cargo publish can be run from the repository root (= crate root). For multi-crate repositories, repository_setup.sh will generate derivatives of this file. There is a useless `cd .` in the `run` step which only exists so that sed can easily replace it with the path for crates in a workspace when auto-generating workflows. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Make repository_setup.sh automatically discover whether we have a multi crate cargo workspace, or just a single crate repository, and then generate a publish github action for each of them that triggers when a tag named '$crate_name-v*' (or just 'v*' for single-crate repos) is published. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
stefano-garzarella
approved these changes
Oct 16, 2025
ShadowCurse
approved these changes
Oct 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the PR
Add a repository_setup.sh script that automates a couple of setup steps
for setup of new rust-vmm repositories. It also supports updating the
configuration of already created repositories by comparing the
repository's configuration to the defaults in rust-vmm-ci and giving the
option to update.
Currently, the script supports dependabot setup and .platform file
generation. It does not deal with the coverage files, since I am still
hoping to switch us over to codecov.io in the future, at which point
that will all changes completely anyway. I plan to also add crates.io
publish workflow support before moving this out of draft.
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafecode is properly documented.