From 358a4ac6d4c08bd3b485d0fc44f23e7d2676a487 Mon Sep 17 00:00:00 2001 From: zseri Date: Sun, 26 Dec 2021 06:10:40 +0100 Subject: feat(3p/tvix): run formatting check in parallel to rest Change-Id: Ia5b3a5e76672143df361fec375903e3582694112 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4632 Tested-by: BuildkiteCI Reviewed-by: grfn Reviewed-by: zseri Autosubmit: zseri --- third_party/nix/default.nix | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix index 3fc89fc7eb..e01fad12f0 100644 --- a/third_party/nix/default.nix +++ b/third_party/nix/default.nix @@ -125,10 +125,6 @@ in lib.fix (self: pkgs.fullLlvm11Stdenv.mkDerivation { export NIX_DATA_DIR=$out/share export NIX_TEST_VAR=foo # this is required by a language test make test - - # Ensure formatting is coherent, but do this after the rest of the - # tests run so that developers get all the useful feedback - fd . $src -e hh -e cc | xargs clang-format --dry-run --Werror ''; preBuild = '' @@ -201,6 +197,41 @@ in lib.fix (self: pkgs.fullLlvm11Stdenv.mkDerivation { export NIX_TEST_VAR=foo ''; }); + + # Ensure formatting is coherent, + # but do this in parallel to the main build because: + # - (in favor of building this after tvix) + # tests run so that developers get all the useful feedback + # - (in favor of building this before tvix) + # if the formatting is broken, and this build was submitted to CI + # it would be a good idea to get this feedback rather sooner than later + # - we don't want builds to differ between local and CI runs + checkfmt = pkgs.fullLlvm11Stdenv.mkDerivation { + name = "tvix-checkfmt"; + inherit src; + nativeBuildInputs = with pkgs; [ clang-tools_11 fd ]; + SANDBOX_SHELL = "${pkgs.busybox}/bin/busybox"; + + buildPhase = '' + set -e + runHook preBuild + fd . $src -e hh -e cc | xargs clang-format --dry-run --Werror + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + touch $out + runHook postInstall + ''; + }; + test-vm = import ./test-vm.nix args; }; + + meta = { + targets = [ + "checkfmt" + ]; + }; }) -- cgit 1.4.1