diff --git a/README.md b/README.md index 3c7c48c..1cd8d62 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,16 @@ git submodule add https://github.com/rust-vmm/rust-vmm-ci.git git commit -s -m "Added rust-vmm-ci as submodule" ``` -2. Create the coverage test configuration file named +2. Run the initial setup script for configuring dependabot for automated cargo + and submodule updates, as well as configuring which hardware platforms CI + should be run for: + +```bash +# Script has to be run relative to the repository root! +./rust-vmm-ci/setup_repository.sh +``` + +3. Create the coverage test configuration file named `coverage_config_ARCH.json` in the root of the repository, where `ARCH` is the architecture of the machine. There are two coverage test configuration files, one per each platform. @@ -55,14 +64,6 @@ Additionally, the following optional fields are available: This file is required for the coverage integration so it needs to be added to the repository as well. -3. Copy one of the two provided dependabot configurations to `.github/dependabot.yml`, - e.g. run `cp rust-vmm-ci/dependabot-{weekly,monthly}.yml .github/dependabot.yml`. - Note that just symlinking the file does not work, as dependabot will not - follow symlinks into submodules. This means that updates to these files made in - rust-vmm-ci will need to be manually consumed for now. We recommend setting up - weekly dependabot updates only if the crate receives multiple contributions a week, - and if you expect to have the bandwidth to address weekly dependency PRs. - 4. Create a new pipeline definition in Buildkite. For this step ask one of the rust-vmm Buildkite [admins](CODEOWNERS) to create one for you. The process is explained [here](https://github.com/rust-vmm/community/blob/main/docs/setup_new_repo.md#set-up-ci). @@ -119,24 +120,7 @@ For most use cases, overriding or extending the configuration is not necessary. want to do so if, for example, the platform needs a custom device that is not available on the existing test instances or if we need a specialized hypervisor. -6. Tests will be running on `x86_64` and `aarch64` platforms by default. To change -this, e.g. to enable other experimental platforms like `riscv64`, a `.platform` -file can be included in the repository root. This file documents what platforms -are to be enabled for the repository. - -If `.platform` file is provided, it will be strictly observed. In `.platform` -file, each platform are separated by newline character. Currently, we support -`x86_64`, `aarch64` and `riscv64` platforms. - -For example, we can enable tests to be run on `riscv64` platform in addition to -`x86_64` and `aarch64` by: -``` -x86_64 -aarch64 -riscv64 -``` - -7. The code owners of the repository will have to setup a WebHook for +6. The code owners of the repository will have to setup a WebHook for triggering the CI on [pull request](https://developer.github.com/v3/activity/events/types/#pullrequestevent) and [push](https://developer.github.com/v3/activity/events/types/#pushevent) @@ -148,7 +132,9 @@ The [Buildkite](https://buildkite.com) pipeline is the definition of tests to be run as part of the CI. It includes steps for running unit tests and linters (including coding style checks), and computing the coverage. -Currently the tests can run on Linux `x86_64` and `aarch64` hosts. +Currently the tests can run on Linux `x86_64`, `aarch64` and `riscv64` +(virtualized inside QEMU) hosts. Which hosts tests should be ran for is +determined by the `.platform` file in the repository root. Example of step that checks the build: diff --git a/publish.yml b/publish.yml new file mode 100644 index 0000000..14d1e1b --- /dev/null +++ b/publish.yml @@ -0,0 +1,21 @@ +name: Publish to crates.io + +on: + push: + tags: ['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 . + cargo publish + env: + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} diff --git a/repository_setup.sh b/repository_setup.sh new file mode 100755 index 0000000..2cc9223 --- /dev/null +++ b/repository_setup.sh @@ -0,0 +1,144 @@ +#/bin/bash + +set -euo pipefail + +cat <> $PLATFORMS_FILE + fi + done +} + +setup_dependabot_config() { + mkdir -p $(dirname $DEPENDABOT_FILE) + + cat < $workflow_file + echo "If not already done, go to https://crates.io/crates/$crate_name/settings and add $(basename $workflow_file) as a trusted publisher!" + fi + done + else + question="Single crate repository detected, setup running 'cargo publish' at repository root when tags matching 'v*' are published? (if a .github/workflows/publish.yml file already exists, it will be overwritten)" + if confirm "$question"; then + cp $RUST_VMM_CI/publish.yml .github/workflows/publish.yml + fi + fi +fi