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.
This commit is contained in:
Maximilian Bosch 2024-08-17 20:35:43 +02:00
parent 3517acc5ba
commit 3a4e0d4917
Signed by: ma27
SSH key fingerprint: SHA256:d7dmwHmpai66L6KIXA+wxzVbkPq0nGLrcHK3ZNroqZY
8 changed files with 25 additions and 16 deletions

2
.gitignore vendored
View file

@ -5,3 +5,5 @@
/src/sql/tmp.sqlite /src/sql/tmp.sqlite
result result
result-* result-*
.hydra-data
outputs

View file

@ -12,15 +12,14 @@ To enter a shell in which all environment variables (such as `PERL5LIB`)
and dependencies can be found: and dependencies can be found:
```console ```console
$ nix-shell $ nix develop
``` ```
To build Hydra, you should then do: To build Hydra, you should then do:
```console ```console
[nix-shell]$ autoreconfPhase [nix-shell]$ just setup
[nix-shell]$ configurePhase [nix-shell]$ just install
[nix-shell]$ make
``` ```
You start a local database, the webserver, and other components with 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: You can run Hydra's test suite with the following:
```console ```console
[nix-shell]$ make check [nix-shell]$ just test
[nix-shell]$ # to run as many tests as you have cores:
[nix-shell]$ make check YATH_JOB_COUNT=$NIX_BUILD_CORES
[nix-shell]$ # or run yath directly: [nix-shell]$ # or run yath directly:
[nix-shell]$ yath test [nix-shell]$ yath test
[nix-shell]$ # to run as many tests as you have cores: [nix-shell]$ # to run as many tests as you have cores:
[nix-shell]$ yath test -j $NIX_BUILD_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 **Warning**: Currently, the tests can fail
if run with high parallelism [due to an issue in if run with high parallelism [due to an issue in
`Test::PostgreSQL`](https://github.com/TJC/Test-postgresql/issues/40) `Test::PostgreSQL`](https://github.com/TJC/Test-postgresql/issues/40)

View file

@ -3,4 +3,4 @@
# wait for hydra-server to listen # wait for hydra-server to listen
while ! nc -z localhost 63333; do sleep 1; done 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

View file

@ -28,4 +28,4 @@ use-substitutes = true
</hydra_notify> </hydra_notify>
EOF EOF
fi 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

View file

@ -3,4 +3,4 @@
# wait for hydra-server to listen # wait for hydra-server to listen
while ! nc -z localhost 63333; do sleep 1; done 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

View file

@ -3,4 +3,4 @@
# wait until hydra is listening on port 63333 # wait until hydra is listening on port 63333
while ! nc -z localhost 63333; do sleep 1; done 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

11
justfile Normal file
View file

@ -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 }}

View file

@ -37,6 +37,7 @@
, cacert , cacert
, foreman , foreman
, just
, glibcLocales , glibcLocales
, libressl , libressl
, openldap , openldap
@ -191,6 +192,7 @@ stdenv.mkDerivation (finalAttrs: {
pixz pixz
nix-eval-jobs nix-eval-jobs
perlPackages.PLS perlPackages.PLS
just
]; ];
checkInputs = [ checkInputs = [
@ -234,8 +236,8 @@ stdenv.mkDerivation (finalAttrs: {
shellHook = '' shellHook = ''
pushd $(git rev-parse --show-toplevel) >/dev/null pushd $(git rev-parse --show-toplevel) >/dev/null
PATH=$(pwd)/src/hydra-evaluator:$(pwd)/src/script:$(pwd)/src/hydra-queue-runner:$PATH PATH=$(pwd)/outputs/out/bin:$PATH
PERL5LIB=$(pwd)/src/lib:$PERL5LIB PERL5LIB=$(pwd)/src/lib:$(pwd)/t/lib:$PERL5LIB
export HYDRA_HOME="$(pwd)/src/" export HYDRA_HOME="$(pwd)/src/"
mkdir -p .hydra-data mkdir -p .hydra-data
export HYDRA_DATA="$(pwd)/.hydra-data" export HYDRA_DATA="$(pwd)/.hydra-data"