qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: manos.pitsidianakis@linaro.org, kwolf@redhat.com,
	junjie.mao@hotmail.com, zhao1.liu@intel.com,
	qemu-rust@nondevel.org
Subject: [RFC PATCH 11/11] rust: ci: add job that runs Rust tools
Date: Fri,  8 Nov 2024 19:01:39 +0100	[thread overview]
Message-ID: <20241108180139.117112-12-pbonzini@redhat.com> (raw)
In-Reply-To: <20241108180139.117112-1-pbonzini@redhat.com>

Code checks, as well as documentation generation, are not yet tied
to "make check" because they need new version of the Rust toolchain
(even nightly in the case of "rustfmt").  Run them in CI using the
existing nightly-Rust container.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 .gitlab-ci.d/buildtest-template.yml                | 14 ++++++++++++++
 .gitlab-ci.d/buildtest.yml                         | 14 ++++++++++++++
 .../docker/dockerfiles/fedora-rust-nightly.docker  |  4 ++++
 tests/lcitool/refresh                              |  4 ++++
 4 files changed, 36 insertions(+)

diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml
index 39da7698b09..612e968ff19 100644
--- a/.gitlab-ci.d/buildtest-template.yml
+++ b/.gitlab-ci.d/buildtest-template.yml
@@ -79,6 +79,20 @@
     - $MAKE NINJA=":" $MAKE_CHECK_ARGS
     - section_end test
 
+.rust_test_job_template:
+  extends: .base_job_template
+  stage: test
+  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
+  script:
+    - source scripts/ci/gitlab-ci-section
+    - section_start test "Running Rust code checks"
+    - cd build
+    - pyvenv/bin/meson devenv -w ../rust ${CARGO-cargo} fmt --check
+    - make clippy
+    - pyvenv/bin/meson devenv -w ../rust ${CARGO-cargo} doc --no-deps
+    - pyvenv/bin/meson devenv -w ../rust ${CARGO-cargo} test --doc
+    - section_end test
+
 .native_test_job_template:
   extends: .common_test_job_template
   artifacts:
diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index 336223484d8..5250b61f089 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -142,6 +142,20 @@ check-system-fedora:
     IMAGE: fedora
     MAKE_CHECK_ARGS: check
 
+check-rust-fedora-rust-nightly:
+  extends: .rust_test_job_template
+  needs:
+    - job: build-system-fedora-rust-nightly
+      artifacts: true
+  variables:
+    IMAGE: fedora-rust-nightly
+    MAKE_CHECK_ARGS: check
+  artifacts:
+    when: on_success
+    expire_in: 2 days
+    paths:
+      - rust/target/doc
+
 functional-system-fedora:
   extends: .functional_test_job_template
   needs:
diff --git a/tests/docker/dockerfiles/fedora-rust-nightly.docker b/tests/docker/dockerfiles/fedora-rust-nightly.docker
index 9180c8b5222..a8e4fb279a7 100644
--- a/tests/docker/dockerfiles/fedora-rust-nightly.docker
+++ b/tests/docker/dockerfiles/fedora-rust-nightly.docker
@@ -155,6 +155,7 @@ ENV PYTHON "/usr/bin/python3"
 RUN dnf install -y wget
 ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo
 ENV RUSTC=/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc
+ENV CARGO=/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo
 RUN set -eux && \
   rustArch='x86_64-unknown-linux-gnu' && \
   rustupSha256='6aeece6993e902708983b209d04c0d1dbb14ebb405ddb87def578d41f920f56d' && \
@@ -165,10 +166,13 @@ RUN set -eux && \
   ./rustup-init -y --no-modify-path --profile default --default-toolchain nightly --default-host ${rustArch} && \
   chmod -R a+w $RUSTUP_HOME $CARGO_HOME && \
   /usr/local/cargo/bin/rustup --version && \
+  /usr/local/cargo/bin/rustup run nightly cargo --version && \
   /usr/local/cargo/bin/rustup run nightly rustc --version && \
+  test "$CARGO" = "$(/usr/local/cargo/bin/rustup +nightly which cargo)" && \
   test "$RUSTC" = "$(/usr/local/cargo/bin/rustup +nightly which rustc)"
 ENV PATH=$CARGO_HOME/bin:$PATH
 RUN /usr/local/cargo/bin/rustup run nightly cargo install bindgen-cli
+RUN $CARGO --list
 # As a final step configure the user (if env is defined)
 ARG USER
 ARG UID
diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh
index 51012783c0f..6720516b942 100755
--- a/tests/lcitool/refresh
+++ b/tests/lcitool/refresh
@@ -121,6 +121,7 @@ fedora_rustup_nightly_extras = [
     "RUN dnf install -y wget\n",
     "ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo\n",
     "ENV RUSTC=/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc\n",
+    "ENV CARGO=/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo\n",
     "RUN set -eux && \\\n",
     "  rustArch='x86_64-unknown-linux-gnu' && \\\n",
     "  rustupSha256='6aeece6993e902708983b209d04c0d1dbb14ebb405ddb87def578d41f920f56d' && \\\n",
@@ -131,10 +132,13 @@ fedora_rustup_nightly_extras = [
     "  ./rustup-init -y --no-modify-path --profile default --default-toolchain nightly --default-host ${rustArch} && \\\n",
     "  chmod -R a+w $RUSTUP_HOME $CARGO_HOME && \\\n",
     "  /usr/local/cargo/bin/rustup --version && \\\n",
+    "  /usr/local/cargo/bin/rustup run nightly cargo --version && \\\n",
     "  /usr/local/cargo/bin/rustup run nightly rustc --version && \\\n",
+    '  test "$CARGO" = "$(/usr/local/cargo/bin/rustup +nightly which cargo)" && \\\n',
     '  test "$RUSTC" = "$(/usr/local/cargo/bin/rustup +nightly which rustc)"\n',
     'ENV PATH=$CARGO_HOME/bin:$PATH\n',
     'RUN /usr/local/cargo/bin/rustup run nightly cargo install bindgen-cli\n',
+    'RUN $CARGO --list\n',
 ]
 
 ubuntu2204_bindgen_extras = [
-- 
2.47.0



  parent reply	other threads:[~2024-11-08 18:05 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08 18:01 [RFC PATCH 00/11] rust: improved integration with cargo Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 01/11] rust: qemu_api: do not disable lints outside bindgen-generated code Paolo Bonzini
2024-11-12  2:25   ` Junjie Mao
2024-11-12  5:33     ` Paolo Bonzini
2024-11-12 10:10       ` Junjie Mao
2024-11-12 18:47         ` Paolo Bonzini
2024-11-13  6:46           ` Junjie Mao
2024-11-13 10:41             ` Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 02/11] rust: build: move rustc_args.py invocation to individual crates Paolo Bonzini
2024-11-12  3:02   ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 03/11] rust: build: restrict --cfg generation to only required symbols Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 04/11] rust: build: generate warning flags from Cargo.toml Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 05/11] rust: cargo: store desired warning levels in workspace Cargo.toml Paolo Bonzini
2024-11-12  3:12   ` Junjie Mao
2024-11-12  5:28     ` Paolo Bonzini
2024-11-12  5:40       ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 06/11] rust: build: move strict lints handling to rustc_args.py Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 07/11] rust: fix a couple style issues from clippy Paolo Bonzini
2024-11-13  6:59   ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 08/11] rust: build: establish a baseline of lints across all crates Paolo Bonzini
2024-11-13  7:14   ` Junjie Mao
2024-11-13 10:02     ` Paolo Bonzini
2024-11-13 10:13       ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 09/11] rust: build: add "make clippy", "make rustfmt" Paolo Bonzini
2024-11-13  7:20   ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 10/11] rust: fix doc test syntax Paolo Bonzini
2024-11-13  7:22   ` Junjie Mao
2024-11-08 18:01 ` Paolo Bonzini [this message]
2024-11-08 18:12   ` [RFC PATCH 11/11] rust: ci: add job that runs Rust tools Daniel P. Berrangé
2024-11-14 13:07 ` [RFC PATCH 00/11] rust: improved integration with cargo Alex Bennée
2024-11-14 13:11   ` Paolo Bonzini
2024-11-14 15:22     ` Alex Bennée
2024-11-14 15:38       ` Paolo Bonzini
2024-11-14 17:27         ` Alex Bennée
2024-11-14 18:18           ` Paolo Bonzini
2024-11-14 21:13             ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241108180139.117112-12-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=junjie.mao@hotmail.com \
    --cc=kwolf@redhat.com \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-rust@nondevel.org \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).