Skip to content

xtask: Return an error if formatting errors occur #3104

xtask: Return an error if formatting errors occur

xtask: Return an error if formatting errors occur #3104

name: Developer Productivity
on:
merge_group:
push:
pull_request:
jobs:
# Job to run change detection
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step.
outputs:
nix-src: ${{ steps.filter.outputs.nix-src }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
nix-src:
- 'nix/**'
- 'shell.nix'
# This is a convenience test to verify that the toolchain provided by
# shell.nix is valid and can build + run the integration test.
#
# It only runs if the "nix-src" output of the "changes" job is true.
nix_shell_toolchain:
name: "Nix toolchain: `cargo xtask run` works"
needs: changes
if: ${{ needs.changes.outputs.nix-src == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: cachix/install-nix-action@v30
with:
# This channel is only required to invoke "nix-shell".
# Everything inside that nix-shell will use a pinned version of nixpkgs.
nix_path: nixpkgs=channel:nixpkgs-unstable
# Dedicated step to separate all the
# "copying path '/nix/store/...' from 'https://cache.nixos.org'."
# messages from the actual build output. This job takes ~60secs.
- name: Prepare Nix Store
run: nix-shell --pure --run "cargo --version"
- name: Run VM tests
run: |
COMMAND="cargo xtask run --target x86_64 --headless --ci --tpm=v1"
echo "Executing in nix shell: $COMMAND"
nix-shell --pure --run "$COMMAND"