-
Notifications
You must be signed in to change notification settings - Fork 39
Add a script for running through some basic repository setup #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
roypat
wants to merge
4
commits into
rust-vmm:main
Choose a base branch
from
roypat:setup-script
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
b42aeec
to
9679581
Compare
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 |
And running it a second time on the vhost repo produces
and no further changes |
4 tasks
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
4 tasks
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).
unsafe
code is properly documented.