From d67b3500ec0430f313ef0b9fff7ee858c5259e19 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sat, 10 Jan 2026 10:40:30 +0000 Subject: [PATCH 1/7] build: make bin scripts executable --- bin/build | 0 bin/down | 0 bin/kaocha | 0 bin/logs | 0 bin/restart | 0 bin/restart-server | 0 bin/up | 0 7 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/build mode change 100644 => 100755 bin/down mode change 100644 => 100755 bin/kaocha mode change 100644 => 100755 bin/logs mode change 100644 => 100755 bin/restart mode change 100644 => 100755 bin/restart-server mode change 100644 => 100755 bin/up diff --git a/bin/build b/bin/build old mode 100644 new mode 100755 diff --git a/bin/down b/bin/down old mode 100644 new mode 100755 diff --git a/bin/kaocha b/bin/kaocha old mode 100644 new mode 100755 diff --git a/bin/logs b/bin/logs old mode 100644 new mode 100755 diff --git a/bin/restart b/bin/restart old mode 100644 new mode 100755 diff --git a/bin/restart-server b/bin/restart-server old mode 100644 new mode 100755 diff --git a/bin/up b/bin/up old mode 100644 new mode 100755 From 85b00c1616e30d6a93f7f8c1f8b08b178d5c2842 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sat, 10 Jan 2026 10:42:37 +0000 Subject: [PATCH 2/7] build: drop/seed database scripts --- bin/database-drop | 6 ++++++ bin/database-seed | 8 ++++++++ 2 files changed, 14 insertions(+) create mode 100755 bin/database-drop create mode 100755 bin/database-seed diff --git a/bin/database-drop b/bin/database-drop new file mode 100755 index 0000000000..1642de5998 --- /dev/null +++ b/bin/database-drop @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +set -eux -o pipefail + +docker exec -it mongodb /usr/bin/mongosh netrunner --eval 'db.dropDatabase()' +bin/down diff --git a/bin/database-seed b/bin/database-seed new file mode 100755 index 0000000000..f5135bd0ae --- /dev/null +++ b/bin/database-seed @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +set -eux -o pipefail + +docker exec -it netrunner-server-1 /bin/bash lein fetch +docker exec -it netrunner-server-1 /bin/bash lein create-indexes +bin/restart-server + From 7349e351c86245566d9c6b3d3bed7c662fffeca6 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sat, 10 Jan 2026 11:04:10 +0000 Subject: [PATCH 3/7] build: docker bash/lein helper scripts --- bin/bash | 3 +++ bin/lein | 3 +++ 2 files changed, 6 insertions(+) create mode 100755 bin/bash create mode 100755 bin/lein diff --git a/bin/bash b/bin/bash new file mode 100755 index 0000000000..d34b7e5b08 --- /dev/null +++ b/bin/bash @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +docker exec -it netrunner-server-1 /bin/bash "$@" diff --git a/bin/lein b/bin/lein new file mode 100755 index 0000000000..0fd2e7662d --- /dev/null +++ b/bin/lein @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +bin/bash lein "$@" From 8fe95a758ac06b7171259669d5d046bb65309593 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sat, 10 Jan 2026 11:05:40 +0000 Subject: [PATCH 4/7] build: docker test scripts --- bin/test | 3 +++ bin/test-focus | 3 +++ docker-compose.yml | 1 + test/clj/game/core/say_test.clj | 1 + 4 files changed, 8 insertions(+) create mode 100755 bin/test create mode 100755 bin/test-focus diff --git a/bin/test b/bin/test new file mode 100755 index 0000000000..b3eb31f2f4 --- /dev/null +++ b/bin/test @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +bin/lein kaocha "$@" diff --git a/bin/test-focus b/bin/test-focus new file mode 100755 index 0000000000..0973d7aa36 --- /dev/null +++ b/bin/test-focus @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +bin/lein kaocha --focus "$@" diff --git a/docker-compose.yml b/docker-compose.yml index 44141ee3db..c498796781 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,6 +17,7 @@ services: - "./package.json:/usr/src/app/package.json" - "./src:/usr/src/app/src" - "./test:/usr/src/app/test" + - "./tests.edn:/usr/src/app/tests.edn" - "./docker/docker-prod.edn:/usr/src/app/resources/prod.edn" # Override server configs depends_on: - database diff --git a/test/clj/game/core/say_test.clj b/test/clj/game/core/say_test.clj index 1c5c7bfc20..1a7c8d06a8 100644 --- a/test/clj/game/core/say_test.clj +++ b/test/clj/game/core/say_test.clj @@ -21,6 +21,7 @@ (let [cmd-source (with-out-str (repl/source game.core.commands/parse-command)) implemented-cmds (map str (re-seq #"(?<=\")\/[^ \"]*(?=\")" cmd-source)) documented-cmds (map :name command-info)] + (is true) ;; so kaocha doesn't fail this test with no assertions (doseq [cmd implemented-cmds] (when-not (some #(= % cmd) documented-cmds) (is false (str "command '" cmd "' is undocumented")))) From 99a390be5cb39adfe3cdca5de5a98a553bc542b5 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sat, 10 Jan 2026 11:09:16 +0000 Subject: [PATCH 5/7] build: bin/up keeps process This matches the docker flow in the readme. --- bin/up | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/up b/bin/up index 1318eb0684..d1dcd2c740 100755 --- a/bin/up +++ b/bin/up @@ -1,3 +1,3 @@ #!/usr/bin/env sh -docker-compose up -d --build +docker-compose up --build From 30c85cbfdc8e6f96a5b902131f3ab18d07cd22b6 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sat, 10 Jan 2026 11:22:10 +0000 Subject: [PATCH 6/7] build: repl script --- bin/repl | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 bin/repl diff --git a/bin/repl b/bin/repl new file mode 100755 index 0000000000..524fbd8792 --- /dev/null +++ b/bin/repl @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +bin/lein repl :connect nrepl://localhost:44867 From 092e343790344fe7615214164b9dd8799c475b3c Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sat, 10 Jan 2026 11:23:09 +0000 Subject: [PATCH 7/7] doc: update readme docker instructions with scripts --- README.md | 34 ++++++++++++---------------------- bin/up | 2 +- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 738353ccce..4830dc6b4e 100644 --- a/README.md +++ b/README.md @@ -68,44 +68,34 @@ and open [http://localhost:1042/](http://localhost:1042/). ### Using Docker -You'll need to install [Docker](https://docs.docker.com/get-docker/) and [Docker-Compose](https://docs.docker.com/compose/install/). After that, just run `$ docker-compose up --build` in the project directory (or do the GUI-equivalent of this). If this fails because it "couldn't fetch dependencies", try again, it was just a networking error. +You'll need to install [Docker](https://docs.docker.com/get-docker/) and [Docker-Compose](https://docs.docker.com/compose/install/). After that, just run `bin/up` in the project directory (or do the GUI-equivalent of this). If this fails because it "couldn't fetch dependencies", try again, it was just a networking error. It can take a while. You'll see lots of messages, so just wait until you see something like `netrunner-server-1 | nREPL server started on port 44867`. After that, you can visit [http://localhost:1042/](http://localhost:1042/) and the server should be running. -While coding clojure it's important to have a REPL connection going. The server's REPL is configured to always run on port `44867`, so you can connect using `$ lein repl :connect nrepl://localhost:44867` (or the program of your preference, like your code editor). +While coding clojure it's important to have a REPL connection going. The server's REPL is configured to always run on port `44867`, so you can connect using `$ bin/repl` (or the program of your preference, like your code editor). -Now, let's populate the database and create indexes. First, let's open a terminal inside the server container: `$ docker exec -it netrunner-server-1 /bin/bash`. Now, inside this new therminal, we'll run these two commands: *The `--no-card-images` is optional, and removing it causes the card images to be downloaded, which can be slower.* +Now, let's populate the database and create indexes with `bin/database-seed`. This will download card images, which can be slow. When its done the server will be restarted. If you ever need to drop the database, run `bin/database-drop`. This will keep the card images you downloaded previously, but you'll need to do `bin/up` and `bin/database-seed` again. -``` - $ lein fetch --no-card-images - 1648 cards imported - - $ lein create-indexes - Indexes successfully created. -``` +You can access the servers' bash and lein commands individually using `bin/bash` and `bin/lein`. -After this, just restart the server by running `(restart)` in the REPL. - -To do testing, you run them inside the container: `$ docker exec -it netrunner-server-1 /bin/bash` and then `$ lein kaocha`. ### Tests +To do testing, you run them inside the container with `bin/test` and `bin/test-focus`. + To run all tests: - $ lein kaocha - Ran 2640 tests containing 44704 assertions. - 0 failures, 0 errors. + $ bin/test + 3602 tests, 118797 assertions, 0 failures. To run a single test file: - $ lein kaocha --focus game.cards.agendas-test - Ran 216 tests containing 3536 assertions. - 0 failures, 0 errors. + $ bin/test-focus game.cards.agendas-test + 285 tests, 9715 assertions, 0 failures. Or a single test: - $ lein kaocha --focus game.cards.agendas-test/fifteen-minutes - Ran 1 tests containing 29 assertions. - 0 failures, 0 errors. + $ bin/test-focus game.cards.agendas-test/fifteen-minutes + 1 tests, 47 assertions, 0 failures. For more information refer to the [development guide](https://github.com/mtgred/netrunner/wiki/Getting-Started-with-Development). diff --git a/bin/up b/bin/up index d1dcd2c740..507fe8319d 100755 --- a/bin/up +++ b/bin/up @@ -1,3 +1,3 @@ #!/usr/bin/env sh -docker-compose up --build +docker-compose up