From 3a4e0d49171d603735f6089485083c0c21e4ecba Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 17 Aug 2024 20:35:43 +0200 Subject: [PATCH] Get dev environment working again * justfile, inspired from Lix. * let foreman use the stuff from outputs, similar to what Lix does> * mess around with PERL5LIB[1] and PATH to get tests running locally. [1] I don't really know how `Setup` was found before tbh. --- .gitignore | 2 ++ doc/manual/src/hacking.md | 14 ++++---------- foreman/start-evaluator.sh | 2 +- foreman/start-hydra.sh | 2 +- foreman/start-notify.sh | 2 +- foreman/start-queue-runner.sh | 2 +- justfile | 11 +++++++++++ package.nix | 6 ++++-- 8 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 justfile diff --git a/.gitignore b/.gitignore index 2050dddd..e0d2e4ec 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ /src/sql/tmp.sqlite result result-* +.hydra-data +outputs diff --git a/doc/manual/src/hacking.md b/doc/manual/src/hacking.md index de826720..62846819 100644 --- a/doc/manual/src/hacking.md +++ b/doc/manual/src/hacking.md @@ -12,15 +12,14 @@ To enter a shell in which all environment variables (such as `PERL5LIB`) and dependencies can be found: ```console -$ nix-shell +$ nix develop ``` To build Hydra, you should then do: ```console -[nix-shell]$ autoreconfPhase -[nix-shell]$ configurePhase -[nix-shell]$ make +[nix-shell]$ just setup +[nix-shell]$ just install ``` You start a local database, the webserver, and other components with @@ -41,18 +40,13 @@ $ ./src/script/hydra-server You can run Hydra's test suite with the following: ```console -[nix-shell]$ make check -[nix-shell]$ # to run as many tests as you have cores: -[nix-shell]$ make check YATH_JOB_COUNT=$NIX_BUILD_CORES +[nix-shell]$ just test [nix-shell]$ # or run yath directly: [nix-shell]$ yath test [nix-shell]$ # to run as many tests as you have cores: [nix-shell]$ yath test -j $NIX_BUILD_CORES ``` -When using `yath` instead of `make check`, ensure you have run `make` -in the root of the repository at least once. - **Warning**: Currently, the tests can fail if run with high parallelism [due to an issue in `Test::PostgreSQL`](https://github.com/TJC/Test-postgresql/issues/40) diff --git a/foreman/start-evaluator.sh b/foreman/start-evaluator.sh index a2858003..8b85b2a3 100755 --- a/foreman/start-evaluator.sh +++ b/foreman/start-evaluator.sh @@ -3,4 +3,4 @@ # wait for hydra-server to listen while ! nc -z localhost 63333; do sleep 1; done -HYDRA_CONFIG=$(pwd)/.hydra-data/hydra.conf exec hydra-evaluator +HYDRA_CONFIG=$(pwd)/.hydra-data/hydra.conf exec $(pwd)/outputs/out/bin/hydra-evaluator diff --git a/foreman/start-hydra.sh b/foreman/start-hydra.sh index bb8cc909..318b02f7 100755 --- a/foreman/start-hydra.sh +++ b/foreman/start-hydra.sh @@ -28,4 +28,4 @@ use-substitutes = true EOF fi -HYDRA_CONFIG=$(pwd)/.hydra-data/hydra.conf exec hydra-dev-server --port 63333 --restart --debug +HYDRA_CONFIG=$(pwd)/.hydra-data/hydra.conf exec $(pwd)/outputs/out/bin/hydra-dev-server --port 63333 --restart --debug diff --git a/foreman/start-notify.sh b/foreman/start-notify.sh index 6a647e54..f79fcd2f 100755 --- a/foreman/start-notify.sh +++ b/foreman/start-notify.sh @@ -3,4 +3,4 @@ # wait for hydra-server to listen while ! nc -z localhost 63333; do sleep 1; done -HYDRA_CONFIG=$(pwd)/.hydra-data/hydra.conf exec hydra-notify +HYDRA_CONFIG=$(pwd)/.hydra-data/hydra.conf exec $(pwd)/outputs/out/bin/hydra-notify diff --git a/foreman/start-queue-runner.sh b/foreman/start-queue-runner.sh index f4fd6048..3a1d2376 100755 --- a/foreman/start-queue-runner.sh +++ b/foreman/start-queue-runner.sh @@ -3,4 +3,4 @@ # wait until hydra is listening on port 63333 while ! nc -z localhost 63333; do sleep 1; done -NIX_REMOTE_SYSTEMS="" HYDRA_CONFIG=$(pwd)/.hydra-data/hydra.conf exec hydra-queue-runner +NIX_REMOTE_SYSTEMS="" HYDRA_CONFIG=$(pwd)/.hydra-data/hydra.conf exec $(pwd)/outputs/out/bin/hydra-queue-runner diff --git a/justfile b/justfile new file mode 100644 index 00000000..8c24774c --- /dev/null +++ b/justfile @@ -0,0 +1,11 @@ +setup *OPTIONS: + meson setup build --prefix="$PWD/outputs/out" $mesonFlags {{ OPTIONS }} + +build *OPTIONS: + meson compile -C build {{ OPTIONS }} + +install *OPTIONS: (build OPTIONS) + meson install -C build + +test *OPTIONS: + meson test -C build --print-errorlogs {{ OPTIONS }} diff --git a/package.nix b/package.nix index 0fbe85a8..8789e058 100644 --- a/package.nix +++ b/package.nix @@ -37,6 +37,7 @@ , cacert , foreman +, just , glibcLocales , libressl , openldap @@ -191,6 +192,7 @@ stdenv.mkDerivation (finalAttrs: { pixz nix-eval-jobs perlPackages.PLS + just ]; checkInputs = [ @@ -234,8 +236,8 @@ stdenv.mkDerivation (finalAttrs: { shellHook = '' pushd $(git rev-parse --show-toplevel) >/dev/null - PATH=$(pwd)/src/hydra-evaluator:$(pwd)/src/script:$(pwd)/src/hydra-queue-runner:$PATH - PERL5LIB=$(pwd)/src/lib:$PERL5LIB + PATH=$(pwd)/outputs/out/bin:$PATH + PERL5LIB=$(pwd)/src/lib:$(pwd)/t/lib:$PERL5LIB export HYDRA_HOME="$(pwd)/src/" mkdir -p .hydra-data export HYDRA_DATA="$(pwd)/.hydra-data"