From d5946683afa8b28f51bf622caba6a1dc7d8f4068 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 17:29:13 -0400 Subject: [PATCH 01/29] Build CI --- .github/workflows/build-and-test.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/build-and-test.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..61d39b4 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,25 @@ +name: Python-Publish + +on: + pull_request: + branches: + - main + push: + branches: + - main + +permissions: + contents: read + +test: + runs-on: ubuntu-latest + steps: + - name: Checkout main + uses: actions/checkout@v4 + + - name: Install DCSS Webtiles + run: | + mkdir ./crawl + mkdir ./crawl/main + git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" + ls ./crawl/main \ No newline at end of file From 70e4de5a6cf978670e9c677db8ac551c189d7f8e Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 17:31:35 -0400 Subject: [PATCH 02/29] Added jobs --- .github/workflows/build-and-test.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 61d39b4..d3969a8 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -11,15 +11,16 @@ on: permissions: contents: read -test: - runs-on: ubuntu-latest - steps: - - name: Checkout main - uses: actions/checkout@v4 +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout main + uses: actions/checkout@v4 - - name: Install DCSS Webtiles - run: | - mkdir ./crawl - mkdir ./crawl/main - git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" - ls ./crawl/main \ No newline at end of file + - name: Install DCSS Webtiles + run: | + mkdir ./crawl + mkdir ./crawl/main + git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" + ls ./crawl/main \ No newline at end of file From 9b6df6ebdd399ee55b4feea349b227d0922a9c7e Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 17:35:43 -0400 Subject: [PATCH 03/29] Test build --- .github/workflows/build-and-test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index d3969a8..bb5e553 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -23,4 +23,8 @@ jobs: mkdir ./crawl mkdir ./crawl/main git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" - ls ./crawl/main \ No newline at end of file + + mkdir ./crawl/dcss-0.29 + cp -r ./crawl/main/crawl/. ./crawl/dcss-0.29 + git -C ./crawl/dcss-0.29 checkout stone_soup-0.29 + make -C ./crawl/dcss-0.29/crawl-ref/source WEBTILES=y \ No newline at end of file From e06da805a4c8312affe91ad24bad89439b7320f1 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 17:45:52 -0400 Subject: [PATCH 04/29] Add dependencies --- .github/workflows/build-and-test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index bb5e553..30582cc 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,4 +1,4 @@ -name: Python-Publish +name: Build & Test on: pull_request: @@ -20,6 +20,9 @@ jobs: - name: Install DCSS Webtiles run: | + + apt install build-essential libncursesw5-dev bison flex liblua5.1-0-dev libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 + mkdir ./crawl mkdir ./crawl/main git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" From 204c036adaee683367af5dabc3b5e9ffad549016 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 17:48:24 -0400 Subject: [PATCH 05/29] Apt -> apt-get --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 30582cc..92515f3 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -21,7 +21,7 @@ jobs: - name: Install DCSS Webtiles run: | - apt install build-essential libncursesw5-dev bison flex liblua5.1-0-dev libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 + sudo apt-get install build-essential libncursesw5-dev bison flex liblua5.1-0-dev libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 mkdir ./crawl mkdir ./crawl/main From f0e4f4dc15b4ccaa2789bea5ff6444169a7adb66 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 17:52:22 -0400 Subject: [PATCH 06/29] Test no-webtiles --- .github/workflows/build-and-test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 92515f3..0fa9027 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -21,7 +21,8 @@ jobs: - name: Install DCSS Webtiles run: | - sudo apt-get install build-essential libncursesw5-dev bison flex liblua5.1-0-dev libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 + sudo apt-get install build-essential libncursesw5-dev bison flex liblua5.1-0-dev \ + libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 mkdir ./crawl mkdir ./crawl/main @@ -30,4 +31,4 @@ jobs: mkdir ./crawl/dcss-0.29 cp -r ./crawl/main/crawl/. ./crawl/dcss-0.29 git -C ./crawl/dcss-0.29 checkout stone_soup-0.29 - make -C ./crawl/dcss-0.29/crawl-ref/source WEBTILES=y \ No newline at end of file + make -C ./crawl/dcss-0.29/crawl-ref/source \ No newline at end of file From e769efa7febebd59ba04f2e7699a91648b3eb81f Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 17:59:54 -0400 Subject: [PATCH 07/29] Install missing python deps --- .github/workflows/build-and-test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 0fa9027..e34b7b4 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -22,7 +22,9 @@ jobs: run: | sudo apt-get install build-essential libncursesw5-dev bison flex liblua5.1-0-dev \ - libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 + libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 \ + bzip2 python-minimal ncurses-term locales-all sqlite3 libpcre3 liblua5.1-0 + locales autoconf lsof flex libbot-basicbot-perl lua5.1 man libpng-dev python3-tornado mkdir ./crawl mkdir ./crawl/main @@ -31,4 +33,4 @@ jobs: mkdir ./crawl/dcss-0.29 cp -r ./crawl/main/crawl/. ./crawl/dcss-0.29 git -C ./crawl/dcss-0.29 checkout stone_soup-0.29 - make -C ./crawl/dcss-0.29/crawl-ref/source \ No newline at end of file + make -C ./crawl/dcss-0.29/crawl-ref/source WEBTILES=y \ No newline at end of file From a91dbe3377f211db025772fcc416ce7838cbed5b Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 18:00:54 -0400 Subject: [PATCH 08/29] Remove missing dep --- .github/workflows/build-and-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e34b7b4..733152b 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -23,8 +23,8 @@ jobs: sudo apt-get install build-essential libncursesw5-dev bison flex liblua5.1-0-dev \ libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 \ - bzip2 python-minimal ncurses-term locales-all sqlite3 libpcre3 liblua5.1-0 - locales autoconf lsof flex libbot-basicbot-perl lua5.1 man libpng-dev python3-tornado + bzip2 ncurses-term locales-all sqlite3 libpcre3 liblua5.1-0 locales autoconf \ + lsof flex libbot-basicbot-perl lua5.1 man libpng-dev python3-tornado mkdir ./crawl mkdir ./crawl/main From 514af88b20843128a77a635c3f19fe5e37011a2e Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 18:05:18 -0400 Subject: [PATCH 09/29] verify python version --- .github/workflows/build-and-test.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 733152b..911d422 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -30,7 +30,16 @@ jobs: mkdir ./crawl/main git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" - mkdir ./crawl/dcss-0.29 - cp -r ./crawl/main/crawl/. ./crawl/dcss-0.29 - git -C ./crawl/dcss-0.29 checkout stone_soup-0.29 - make -C ./crawl/dcss-0.29/crawl-ref/source WEBTILES=y \ No newline at end of file + python3 -V + + # mkdir ./crawl/dcss-0.32 + # cp -r ./crawl/main/crawl/. ./crawl/dcss-0.32 + # git -C ./crawl/dcss-0.32 checkout stone_soup-0.32 + # make -C ./crawl/dcss-0.32/crawl-ref/source WEBTILES=y + + # mkdir ./crawl/server + # cp -r ./crawl/dcss-0.32/crawl-ref/source/webserver/. ./crawl/server + # sed -i -e 's/subprocess.signal/signal_module/g' ./crawl/server/webtiles/process_handler.py + # sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py + # cp ./tests/config/config.py ./crawl/server/config.py + # cp ./tests/config/init-player.sh ./crawl/server/init-player.sh \ No newline at end of file From 9c38e33d4ba33b7075cf829647dc358b7584a3a3 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 18:13:51 -0400 Subject: [PATCH 10/29] Run webtiles --- .github/workflows/build-and-test.yml | 30 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 911d422..8814122 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -30,16 +30,20 @@ jobs: mkdir ./crawl/main git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" - python3 -V - - # mkdir ./crawl/dcss-0.32 - # cp -r ./crawl/main/crawl/. ./crawl/dcss-0.32 - # git -C ./crawl/dcss-0.32 checkout stone_soup-0.32 - # make -C ./crawl/dcss-0.32/crawl-ref/source WEBTILES=y - - # mkdir ./crawl/server - # cp -r ./crawl/dcss-0.32/crawl-ref/source/webserver/. ./crawl/server - # sed -i -e 's/subprocess.signal/signal_module/g' ./crawl/server/webtiles/process_handler.py - # sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py - # cp ./tests/config/config.py ./crawl/server/config.py - # cp ./tests/config/init-player.sh ./crawl/server/init-player.sh \ No newline at end of file + mkdir ./crawl/dcss-0.32 + cp -r ./crawl/main/crawl/. ./crawl/dcss-0.32 + git -C ./crawl/dcss-0.32 checkout stone_soup-0.32 + make -C ./crawl/dcss-0.32/crawl-ref/source WEBTILES=y + + mkdir ./crawl/server + cp -r ./crawl/dcss-0.32/crawl-ref/source/webserver/. ./crawl/server + sed -i -e 's/subprocess.signal/signal_module/g' ./crawl/server/webtiles/process_handler.py + sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py + cp ./tests/config/config.py ./crawl/server/config.py + cp ./tests/config/init-player.sh ./crawl/server/init-player.sh + + echo save_dir = ./crawl/server/saves-0.32 > ./crawl/server/init-0.32.txt + + python3 crawl/server/server.py & + + curl localhost:8080 \ No newline at end of file From e275fe09789a1fb568edc74ab7ab3155a09c7422 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 18:37:42 -0400 Subject: [PATCH 11/29] find file --- .github/workflows/build-and-test.yml | 42 +++++++++++++++------------- Justfile | 2 +- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8814122..075bf00 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -21,29 +21,31 @@ jobs: - name: Install DCSS Webtiles run: | - sudo apt-get install build-essential libncursesw5-dev bison flex liblua5.1-0-dev \ - libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 \ - bzip2 ncurses-term locales-all sqlite3 libpcre3 liblua5.1-0 locales autoconf \ - lsof flex libbot-basicbot-perl lua5.1 man libpng-dev python3-tornado + ls ./ - mkdir ./crawl - mkdir ./crawl/main - git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" + # sudo apt-get install build-essential libncursesw5-dev bison flex liblua5.1-0-dev \ + # libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 \ + # bzip2 ncurses-term locales-all sqlite3 libpcre3 liblua5.1-0 locales autoconf \ + # lsof flex libbot-basicbot-perl lua5.1 man libpng-dev python3-tornado - mkdir ./crawl/dcss-0.32 - cp -r ./crawl/main/crawl/. ./crawl/dcss-0.32 - git -C ./crawl/dcss-0.32 checkout stone_soup-0.32 - make -C ./crawl/dcss-0.32/crawl-ref/source WEBTILES=y + # mkdir ./crawl + # mkdir ./crawl/main + # git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" - mkdir ./crawl/server - cp -r ./crawl/dcss-0.32/crawl-ref/source/webserver/. ./crawl/server - sed -i -e 's/subprocess.signal/signal_module/g' ./crawl/server/webtiles/process_handler.py - sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py - cp ./tests/config/config.py ./crawl/server/config.py - cp ./tests/config/init-player.sh ./crawl/server/init-player.sh + # mkdir ./crawl/dcss-0.32 + # cp -r ./crawl/main/crawl/. ./crawl/dcss-0.32 + # git -C ./crawl/dcss-0.32 checkout stone_soup-0.32 + # make -C ./crawl/dcss-0.32/crawl-ref/source WEBTILES=y - echo save_dir = ./crawl/server/saves-0.32 > ./crawl/server/init-0.32.txt + # mkdir ./crawl/server + # cp -r ./crawl/dcss-0.32/crawl-ref/source/webserver/. ./crawl/server + # sed -i -e 's/subprocess.signal/signal_module/g' ./crawl/server/webtiles/process_handler.py + # sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py + # cp ./tests/config/config.py ./crawl/server/config.py + # cp ./tests/config/init-player.sh ./crawl/server/init-player.sh - python3 crawl/server/server.py & + # echo save_dir = ./crawl/server/saves-0.32 > ./crawl/server/init-0.32.txt - curl localhost:8080 \ No newline at end of file + # python3 crawl/server/server.py & + + # curl localhost:8080 \ No newline at end of file diff --git a/Justfile b/Justfile index 85eb7fc..b3c1304 100644 --- a/Justfile +++ b/Justfile @@ -41,7 +41,7 @@ dcss-create-users: cd ./dcss-api && cargo -r run --example 0_setup dcss-run: - python crawl/server/server.py + python3 crawl/server/server.py dcss-clear: rm -rf ./saves From 439e302c167aa7ebe5eee9b689836b455386d55f Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 18:41:08 -0400 Subject: [PATCH 12/29] File moved --- .github/workflows/build-and-test.yml | 42 +++++++++++++--------------- Justfile | 4 +-- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 075bf00..b5d6465 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -21,31 +21,29 @@ jobs: - name: Install DCSS Webtiles run: | - ls ./ + sudo apt-get install build-essential libncursesw5-dev bison flex liblua5.1-0-dev \ + libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 \ + bzip2 ncurses-term locales-all sqlite3 libpcre3 liblua5.1-0 locales autoconf \ + lsof flex libbot-basicbot-perl lua5.1 man libpng-dev python3-tornado - # sudo apt-get install build-essential libncursesw5-dev bison flex liblua5.1-0-dev \ - # libsqlite3-dev libz-dev pkg-config python3-yaml binutils-gold python-is-python3 \ - # bzip2 ncurses-term locales-all sqlite3 libpcre3 liblua5.1-0 locales autoconf \ - # lsof flex libbot-basicbot-perl lua5.1 man libpng-dev python3-tornado + mkdir ./crawl + mkdir ./crawl/main + git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" - # mkdir ./crawl - # mkdir ./crawl/main - # git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" + mkdir ./crawl/dcss-0.32 + cp -r ./crawl/main/crawl/. ./crawl/dcss-0.32 + git -C ./crawl/dcss-0.32 checkout stone_soup-0.32 + make -C ./crawl/dcss-0.32/crawl-ref/source WEBTILES=y - # mkdir ./crawl/dcss-0.32 - # cp -r ./crawl/main/crawl/. ./crawl/dcss-0.32 - # git -C ./crawl/dcss-0.32 checkout stone_soup-0.32 - # make -C ./crawl/dcss-0.32/crawl-ref/source WEBTILES=y + mkdir ./crawl/server + cp -r ./crawl/dcss-0.32/crawl-ref/source/webserver/. ./crawl/server + sed -i -e 's/subprocess.signal/signal_module/g' ./crawl/server/webtiles/process_handler.py + sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py + cp ./crawl-config/config.py ./crawl/server/config.py + cp ./crawl-config/init-player.sh ./crawl/server/init-player.sh - # mkdir ./crawl/server - # cp -r ./crawl/dcss-0.32/crawl-ref/source/webserver/. ./crawl/server - # sed -i -e 's/subprocess.signal/signal_module/g' ./crawl/server/webtiles/process_handler.py - # sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py - # cp ./tests/config/config.py ./crawl/server/config.py - # cp ./tests/config/init-player.sh ./crawl/server/init-player.sh + echo save_dir = ./crawl/server/saves-0.32 > ./crawl/server/init-0.32.txt - # echo save_dir = ./crawl/server/saves-0.32 > ./crawl/server/init-0.32.txt + python3 crawl/server/server.py & - # python3 crawl/server/server.py & - - # curl localhost:8080 \ No newline at end of file + curl localhost:8080 \ No newline at end of file diff --git a/Justfile b/Justfile index b3c1304..4aaba7a 100644 --- a/Justfile +++ b/Justfile @@ -28,8 +28,8 @@ setup-dcss-server: cp -r ./crawl/dcss-0.32/crawl-ref/source/webserver/. ./crawl/server sed -i -e 's/subprocess.signal/signal_module/g' ./crawl/server/webtiles/process_handler.py sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py - cp ./tests/config/config.py ./crawl/server/config.py - cp ./tests/config/init-player.sh ./crawl/server/init-player.sh + cp ./crawl-config/config.py ./crawl/server/config.py + cp ./crawl-config/init-player.sh ./crawl/server/init-player.sh echo save_dir = ./crawl/server/saves-0.29 > ./crawl/server/init-0.29.txt echo save_dir = ./crawl/server/saves-0.30 > ./crawl/server/init-0.30.txt echo save_dir = ./crawl/server/saves-0.31 > ./crawl/server/init-0.31.txt From b7b041ca5002798acbb19107829ac16a761f97b1 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 18:58:41 -0400 Subject: [PATCH 13/29] Disable other versions --- crawl-config/config.py | 96 ++++++++++++++++++------------------- crawl-config/init-player.sh | 82 +++++++++++++++---------------- 2 files changed, 89 insertions(+), 89 deletions(-) diff --git a/crawl-config/config.py b/crawl-config/config.py index 49603a2..63ae1ba 100644 --- a/crawl-config/config.py +++ b/crawl-config/config.py @@ -186,54 +186,54 @@ # Non-templated example: it's possible just to set every field directly. import collections games = collections.OrderedDict([ - ("dcss-0.29", dict( - version = "0.29", - name = "Play 0.29", - crawl_binary = "./crawl/dcss-0.29/crawl-ref/source/crawl", - rcfile_path = "./crawl/server/rcs-0.29/", - macro_path = "./crawl/server/rcs-0.29/", - morgue_path = "./crawl/server/rcs-0.29/%n", - inprogress_path = "./crawl/server/rcs-0.29/running", - ttyrec_path = "./crawl/server/rcs-0.29/ttyrecs/%n", - socket_path = "./crawl/server/rcs-0.29/", - client_path = "./crawl/dcss-0.29/crawl-ref/source/webserver/game_data/", - morgue_url = None, - show_save_info = True, - allowed_with_hold = True, - options = ["-seed"], - )), - ("dcss-0.30", dict( - version = "0.30", - name = "Play 0.30", - crawl_binary = "./crawl/dcss-0.30/crawl-ref/source/crawl", - rcfile_path = "./crawl/server/rcs-0.30/", - macro_path = "./crawl/server/rcs-0.30/", - morgue_path = "./crawl/server/rcs-0.30/%n", - inprogress_path = "./crawl/server/rcs-0.30/running", - ttyrec_path = "./crawl/server/rcs-0.30/ttyrecs/%n", - socket_path = "./crawl/server/rcs-0.30/", - client_path = "./crawl/dcss-0.30/crawl-ref/source/webserver/game_data/", - morgue_url = None, - show_save_info = True, - allowed_with_hold = True, - options = ["-seed"], - )), - ("dcss-0.31", dict( - version = "0.31", - name = "Play 0.31", - crawl_binary = "./crawl/dcss-0.31/crawl-ref/source/crawl", - rcfile_path = "./crawl/server/rcs-0.31/", - macro_path = "./crawl/server/rcs-0.31/", - morgue_path = "./crawl/server/rcs-0.31/%n", - inprogress_path = "./crawl/server/rcs-0.31/running", - ttyrec_path = "./crawl/server/rcs-0.31/ttyrecs/%n", - socket_path = "./crawl/server/rcs-0.31/", - client_path = "./crawl/dcss-0.31/crawl-ref/source/webserver/game_data/", - morgue_url = None, - show_save_info = True, - allowed_with_hold = True, - options = ["-seed"], - )), + # ("dcss-0.29", dict( + # version = "0.29", + # name = "Play 0.29", + # crawl_binary = "./crawl/dcss-0.29/crawl-ref/source/crawl", + # rcfile_path = "./crawl/server/rcs-0.29/", + # macro_path = "./crawl/server/rcs-0.29/", + # morgue_path = "./crawl/server/rcs-0.29/%n", + # inprogress_path = "./crawl/server/rcs-0.29/running", + # ttyrec_path = "./crawl/server/rcs-0.29/ttyrecs/%n", + # socket_path = "./crawl/server/rcs-0.29/", + # client_path = "./crawl/dcss-0.29/crawl-ref/source/webserver/game_data/", + # morgue_url = None, + # show_save_info = True, + # allowed_with_hold = True, + # options = ["-seed"], + # )), + # ("dcss-0.30", dict( + # version = "0.30", + # name = "Play 0.30", + # crawl_binary = "./crawl/dcss-0.30/crawl-ref/source/crawl", + # rcfile_path = "./crawl/server/rcs-0.30/", + # macro_path = "./crawl/server/rcs-0.30/", + # morgue_path = "./crawl/server/rcs-0.30/%n", + # inprogress_path = "./crawl/server/rcs-0.30/running", + # ttyrec_path = "./crawl/server/rcs-0.30/ttyrecs/%n", + # socket_path = "./crawl/server/rcs-0.30/", + # client_path = "./crawl/dcss-0.30/crawl-ref/source/webserver/game_data/", + # morgue_url = None, + # show_save_info = True, + # allowed_with_hold = True, + # options = ["-seed"], + # )), + # ("dcss-0.31", dict( + # version = "0.31", + # name = "Play 0.31", + # crawl_binary = "./crawl/dcss-0.31/crawl-ref/source/crawl", + # rcfile_path = "./crawl/server/rcs-0.31/", + # macro_path = "./crawl/server/rcs-0.31/", + # morgue_path = "./crawl/server/rcs-0.31/%n", + # inprogress_path = "./crawl/server/rcs-0.31/running", + # ttyrec_path = "./crawl/server/rcs-0.31/ttyrecs/%n", + # socket_path = "./crawl/server/rcs-0.31/", + # client_path = "./crawl/dcss-0.31/crawl-ref/source/webserver/game_data/", + # morgue_url = None, + # show_save_info = True, + # allowed_with_hold = True, + # options = ["-seed"], + # )), ("dcss-0.32", dict( version = "0.32", name = "Play 0.32", diff --git a/crawl-config/init-player.sh b/crawl-config/init-player.sh index b134810..d3dae76 100755 --- a/crawl-config/init-player.sh +++ b/crawl-config/init-player.sh @@ -1,46 +1,46 @@ #!/bin/sh -RCDIR=./crawl/server/rcs-0.29/ -INPROGRESSDIR=./crawl/server/rcs-0.29/running -TTYRECDIR=./crawl/server/rcs-0.29/ttyrecs/$1 -DEFAULT_RC=./crawl/server/init-0.29.txt -PLAYERNAME=$1 - -mkdir -p $RCDIR -mkdir -p $INPROGRESSDIR -mkdir -p $TTYRECDIR - -if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then - cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc -fi - -RCDIR=./crawl/server/rcs-0.30/ -INPROGRESSDIR=./crawl/server/rcs-0.30/running -TTYRECDIR=./crawl/server/rcs-0.30/ttyrecs/$1 -DEFAULT_RC=./crawl/server/init-0.30.txt -PLAYERNAME=$1 - -mkdir -p $RCDIR -mkdir -p $INPROGRESSDIR -mkdir -p $TTYRECDIR - -if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then - cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc -fi - -RCDIR=./crawl/server/rcs-0.31/ -INPROGRESSDIR=./crawl/server/rcs-0.31/running -TTYRECDIR=./crawl/server/rcs-0.31/ttyrecs/$1 -DEFAULT_RC=./crawl/server/init-0.31.txt -PLAYERNAME=$1 - -mkdir -p $RCDIR -mkdir -p $INPROGRESSDIR -mkdir -p $TTYRECDIR - -if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then - cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc -fi +# RCDIR=./crawl/server/rcs-0.29/ +# INPROGRESSDIR=./crawl/server/rcs-0.29/running +# TTYRECDIR=./crawl/server/rcs-0.29/ttyrecs/$1 +# DEFAULT_RC=./crawl/server/init-0.29.txt +# PLAYERNAME=$1 + +# mkdir -p $RCDIR +# mkdir -p $INPROGRESSDIR +# mkdir -p $TTYRECDIR + +# if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then +# cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc +# fi + +# RCDIR=./crawl/server/rcs-0.30/ +# INPROGRESSDIR=./crawl/server/rcs-0.30/running +# TTYRECDIR=./crawl/server/rcs-0.30/ttyrecs/$1 +# DEFAULT_RC=./crawl/server/init-0.30.txt +# PLAYERNAME=$1 + +# mkdir -p $RCDIR +# mkdir -p $INPROGRESSDIR +# mkdir -p $TTYRECDIR + +# if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then +# cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc +# fi + +# RCDIR=./crawl/server/rcs-0.31/ +# INPROGRESSDIR=./crawl/server/rcs-0.31/running +# TTYRECDIR=./crawl/server/rcs-0.31/ttyrecs/$1 +# DEFAULT_RC=./crawl/server/init-0.31.txt +# PLAYERNAME=$1 + +# mkdir -p $RCDIR +# mkdir -p $INPROGRESSDIR +# mkdir -p $TTYRECDIR + +# if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then +# cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc +# fi RCDIR=./crawl/server/rcs-0.32/ INPROGRESSDIR=./crawl/server/rcs-0.32/running From 5111e8a7207c5fde332fc8d4945108d1dd5cffef Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Mon, 10 Mar 2025 19:15:54 -0400 Subject: [PATCH 14/29] Give it time to boot up --- .github/workflows/build-and-test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index b5d6465..3d6d696 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -46,4 +46,6 @@ jobs: python3 crawl/server/server.py & - curl localhost:8080 \ No newline at end of file + sleep 5 + + curl http://localhost:8080 \ No newline at end of file From a7c1e7e2693e555ab42a908818ebf7e5483b521e Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Tue, 11 Mar 2025 17:54:52 -0400 Subject: [PATCH 15/29] Create users & start tests --- .github/workflows/build-and-test.yml | 30 +++++++++++----------------- Justfile | 6 +++--- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 3d6d696..6aeb002 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -18,7 +18,9 @@ jobs: - name: Checkout main uses: actions/checkout@v4 - - name: Install DCSS Webtiles + - uses: extractions/setup-just@v2 + + - name: Install dependencies run: | sudo apt-get install build-essential libncursesw5-dev bison flex liblua5.1-0-dev \ @@ -26,26 +28,18 @@ jobs: bzip2 ncurses-term locales-all sqlite3 libpcre3 liblua5.1-0 locales autoconf \ lsof flex libbot-basicbot-perl lua5.1 man libpng-dev python3-tornado - mkdir ./crawl - mkdir ./crawl/main - git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" + - name: Build DCSS Webtiles (multiple versions) + run: just setup-dcss-server - mkdir ./crawl/dcss-0.32 - cp -r ./crawl/main/crawl/. ./crawl/dcss-0.32 - git -C ./crawl/dcss-0.32 checkout stone_soup-0.32 - make -C ./crawl/dcss-0.32/crawl-ref/source WEBTILES=y + - name: Run DCSS Webtiles + run: just dcss-run && sleep 5 - mkdir ./crawl/server - cp -r ./crawl/dcss-0.32/crawl-ref/source/webserver/. ./crawl/server - sed -i -e 's/subprocess.signal/signal_module/g' ./crawl/server/webtiles/process_handler.py - sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py - cp ./crawl-config/config.py ./crawl/server/config.py - cp ./crawl-config/init-player.sh ./crawl/server/init-player.sh + - name: Create users + run: just dcss-create-users - echo save_dir = ./crawl/server/saves-0.32 > ./crawl/server/init-0.32.txt + - name: Test dcss-api + run: cd ./dcss-api/ & cargo test successful_connect - python3 crawl/server/server.py & - sleep 5 - curl http://localhost:8080 \ No newline at end of file + \ No newline at end of file diff --git a/Justfile b/Justfile index 4aaba7a..af41231 100644 --- a/Justfile +++ b/Justfile @@ -37,12 +37,12 @@ setup-dcss-server: rm -rf ./crawl/main -dcss-create-users: - cd ./dcss-api && cargo -r run --example 0_setup - dcss-run: python3 crawl/server/server.py +dcss-create-users: + cd ./dcss-api && cargo -r run --example 0_setup + dcss-clear: rm -rf ./saves rm -rf ./crawl/server/rcs-0.29/* From 2ce4098c5debcbb6e89cacb953d8866edf137f9f Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Tue, 11 Mar 2025 17:56:35 -0400 Subject: [PATCH 16/29] Disable some builds --- Justfile | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Justfile b/Justfile index af41231..cc552a2 100644 --- a/Justfile +++ b/Justfile @@ -4,20 +4,20 @@ setup-dcss-server: mkdir ./crawl/main git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" - mkdir ./crawl/dcss-0.29 - cp -r ./crawl/main/crawl/. ./crawl/dcss-0.29 - git -C ./crawl/dcss-0.29 checkout stone_soup-0.29 - make -C ./crawl/dcss-0.29/crawl-ref/source WEBTILES=y + # mkdir ./crawl/dcss-0.29 + # cp -r ./crawl/main/crawl/. ./crawl/dcss-0.29 + # git -C ./crawl/dcss-0.29 checkout stone_soup-0.29 + # make -C ./crawl/dcss-0.29/crawl-ref/source WEBTILES=y - mkdir ./crawl/dcss-0.30 - cp -r ./crawl/main/crawl/. ./crawl/dcss-0.30 - git -C ./crawl/dcss-0.30 checkout stone_soup-0.30 - make -C ./crawl/dcss-0.30/crawl-ref/source WEBTILES=y + # mkdir ./crawl/dcss-0.30 + # cp -r ./crawl/main/crawl/. ./crawl/dcss-0.30 + # git -C ./crawl/dcss-0.30 checkout stone_soup-0.30 + # make -C ./crawl/dcss-0.30/crawl-ref/source WEBTILES=y - mkdir ./crawl/dcss-0.31 - cp -r ./crawl/main/crawl/. ./crawl/dcss-0.31 - git -C ./crawl/dcss-0.31 checkout stone_soup-0.31 - make -C ./crawl/dcss-0.31/crawl-ref/source WEBTILES=y + # mkdir ./crawl/dcss-0.31 + # cp -r ./crawl/main/crawl/. ./crawl/dcss-0.31 + # git -C ./crawl/dcss-0.31 checkout stone_soup-0.31 + # make -C ./crawl/dcss-0.31/crawl-ref/source WEBTILES=y mkdir ./crawl/dcss-0.32 cp -r ./crawl/main/crawl/. ./crawl/dcss-0.32 @@ -30,9 +30,9 @@ setup-dcss-server: sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py cp ./crawl-config/config.py ./crawl/server/config.py cp ./crawl-config/init-player.sh ./crawl/server/init-player.sh - echo save_dir = ./crawl/server/saves-0.29 > ./crawl/server/init-0.29.txt - echo save_dir = ./crawl/server/saves-0.30 > ./crawl/server/init-0.30.txt - echo save_dir = ./crawl/server/saves-0.31 > ./crawl/server/init-0.31.txt + # echo save_dir = ./crawl/server/saves-0.29 > ./crawl/server/init-0.29.txt + # echo save_dir = ./crawl/server/saves-0.30 > ./crawl/server/init-0.30.txt + # echo save_dir = ./crawl/server/saves-0.31 > ./crawl/server/init-0.31.txt echo save_dir = ./crawl/server/saves-0.32 > ./crawl/server/init-0.32.txt rm -rf ./crawl/main From 45c6580d2cf7f07d570eb7b30ff5465f6f369ff8 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Tue, 11 Mar 2025 18:09:31 -0400 Subject: [PATCH 17/29] Fix forever loop --- .github/workflows/build-and-test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 6aeb002..060480a 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -35,7 +35,9 @@ jobs: run: just dcss-run && sleep 5 - name: Create users - run: just dcss-create-users + run: | + python3 crawl/server/server.py + sleep 5 - name: Test dcss-api run: cd ./dcss-api/ & cargo test successful_connect From 8474547cd832d0a36378f450c35ae3edb3e0569a Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Tue, 11 Mar 2025 18:09:44 -0400 Subject: [PATCH 18/29] real fix --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 060480a..cdc45bc 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -36,7 +36,7 @@ jobs: - name: Create users run: | - python3 crawl/server/server.py + python3 crawl/server/server.py & sleep 5 - name: Test dcss-api From 7804d5b3b9bcbca08b38c0fdbf3e547b57d4f349 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Tue, 11 Mar 2025 18:40:43 -0400 Subject: [PATCH 19/29] Loop tests for all versions --- Justfile | 10 +- dcss-api/tests/common.rs | 34 ++ dcss-api/tests/rc_file_test.rs | 28 +- dcss-api/tests/start_game_test.rs | 81 ++-- dcss-api/tests/versions_test.rs | 345 ------------------ dcss-scenario-builder/tests/common.rs | 34 ++ dcss-scenario-builder/tests/test_incorrect.rs | 51 +-- dcss-scenario-builder/tests/test_wizmode.rs | 41 +-- 8 files changed, 149 insertions(+), 475 deletions(-) create mode 100644 dcss-api/tests/common.rs delete mode 100644 dcss-api/tests/versions_test.rs create mode 100644 dcss-scenario-builder/tests/common.rs diff --git a/Justfile b/Justfile index cc552a2..3cfa516 100644 --- a/Justfile +++ b/Justfile @@ -62,10 +62,16 @@ dcss-disable-logging: sed -i -e 's/print("SENT FROM DCSS: ", msg, data)/# type: (str, Any) -> bool/g' ./crawl/server/webtiles/ws_handler.py test-api: - cd ./dcss-api && cargo test + cd ./dcss-api && GAME_ID=dcss-0.29 cargo test + cd ./dcss-api && GAME_ID=dcss-0.30 cargo test + cd ./dcss-api && GAME_ID=dcss-0.31 cargo test + cd ./dcss-api && GAME_ID=dcss-0.32 cargo test test-scenario: - cd ./dcss-scenario-builder && cargo test + cd ./dcss-scenario-builder && GAME_ID=dcss-0.29 cargo test + cd ./dcss-scenario-builder && GAME_ID=dcss-0.30 cargo test + cd ./dcss-scenario-builder && GAME_ID=dcss-0.31 cargo test + cd ./dcss-scenario-builder && GAME_ID=dcss-0.32 cargo test setup-python: rm -rf ./dcss-api-python/pyo3 diff --git a/dcss-api/tests/common.rs b/dcss-api/tests/common.rs new file mode 100644 index 0000000..e346f72 --- /dev/null +++ b/dcss-api/tests/common.rs @@ -0,0 +1,34 @@ +#![allow(dead_code)] + +use dcss_api::Webtile; + +pub(crate) fn reset_test(username: &str, game_id: &str) { + // Connect to DCSS Webtile + let mut webtile = + Webtile::connect("ws://localhost:8080/socket", 0, "0.32").expect("Failed to connect"); + + // Empty message queue; + while webtile.get_message().is_some() {} + + // Log in (to a user called "Username", with a password "Password") + let _game_ids = webtile + .login_with_credentials(username, "Password") + .expect("Failed to login"); + + // Empty message queue; + while webtile.get_message().is_some() {} + + webtile + .start_game(game_id, "b", "f", "b") + .expect("Failed to start game"); + + // Empty message queue; + while webtile.get_message().is_some() {} + + webtile.quit_game().expect("Failed to quit game"); + + // Empty message queue; + while webtile.get_message().is_some() {} + + webtile.disconnect().expect("Failed to disconnect"); +} diff --git a/dcss-api/tests/rc_file_test.rs b/dcss-api/tests/rc_file_test.rs index f81b98d..d0d1283 100644 --- a/dcss-api/tests/rc_file_test.rs +++ b/dcss-api/tests/rc_file_test.rs @@ -2,6 +2,8 @@ use dcss_api::Webtile; #[test] fn write_read_rc() { + let game_id = std::env::var("GAME_ID").unwrap(); + let mut webtile = Webtile::connect("ws://localhost:8080/socket", 0, "0.32").expect("Failed to connect."); @@ -16,10 +18,12 @@ fn write_read_rc() { while webtile.get_message().is_some() {} webtile - .set_rc_file("dcss-0.32", "this is a test") + .set_rc_file(game_id.as_str(), "this is a test") .expect("Failed to write"); - let rc_file = webtile.get_rc_file("dcss-0.32").expect("Failed to read."); + let rc_file = webtile + .get_rc_file(game_id.as_str()) + .expect("Failed to read."); assert_eq!("this is a test", rc_file); @@ -27,10 +31,12 @@ fn write_read_rc() { while webtile.get_message().is_some() {} webtile - .set_rc_file("dcss-0.32", "show_more = false\nrest_delay = -1") + .set_rc_file(game_id.as_str(), "show_more = false\nrest_delay = -1") .expect("Failed to write"); - let rc_file = webtile.get_rc_file("dcss-0.32").expect("Failed to read."); + let rc_file = webtile + .get_rc_file(game_id.as_str()) + .expect("Failed to read."); assert_eq!("show_more = false\nrest_delay = -1", rc_file); @@ -39,6 +45,8 @@ fn write_read_rc() { #[test] fn blank_rc_file() { + let game_id = std::env::var("GAME_ID").unwrap(); + let mut webtile = Webtile::connect("ws://localhost:8080/socket", 0, "0.32").expect("Failed to connect."); @@ -53,10 +61,12 @@ fn blank_rc_file() { while webtile.get_message().is_some() {} webtile - .set_rc_file("dcss-0.32", "") + .set_rc_file(game_id.as_str(), "") .expect("Failed to write"); - let rc_file = webtile.get_rc_file("dcss-0.32").expect("Failed to read."); + let rc_file = webtile + .get_rc_file(game_id.as_str()) + .expect("Failed to read."); assert_eq!("", rc_file); @@ -64,10 +74,12 @@ fn blank_rc_file() { while webtile.get_message().is_some() {} webtile - .set_rc_file("dcss-0.32", "show_more = false\nrest_delay = -1") + .set_rc_file(game_id.as_str(), "show_more = false\nrest_delay = -1") .expect("Failed to write"); - let rc_file = webtile.get_rc_file("dcss-0.32").expect("Failed to read."); + let rc_file = webtile + .get_rc_file(game_id.as_str()) + .expect("Failed to read."); assert_eq!("show_more = false\nrest_delay = -1", rc_file); diff --git a/dcss-api/tests/start_game_test.rs b/dcss-api/tests/start_game_test.rs index 6255530..8229a5f 100644 --- a/dcss-api/tests/start_game_test.rs +++ b/dcss-api/tests/start_game_test.rs @@ -1,41 +1,14 @@ +mod common; + use dcss_api::{BlockingError, Error, Webtile}; use serde_json::from_str; -fn reset_test(username: &str) { - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.32").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials(username, "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game("dcss-0.32", "b", "f", "b") - .expect("Failed to start game"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile.quit_game().expect("Failed to quit game"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile.disconnect().expect("Failed to disconnect"); -} - #[test] fn start_game_seeded() { + let game_id = std::env::var("GAME_ID").unwrap(); + // Safe test -- login start game, quit, and then test - reset_test("Username"); + common::reset_test("Username", game_id.as_str()); // Connect to DCSS Webtile let mut webtile = @@ -53,7 +26,7 @@ fn start_game_seeded() { while webtile.get_message().is_some() {} webtile - .start_game_seeded("dcss-0.32", "1", true, "b", "f", "b") + .start_game_seeded(game_id.as_str(), "1", true, "b", "f", "b") .expect("Failed to start game"); // Get last message @@ -89,7 +62,7 @@ fn start_game_seeded() { while webtile.get_message().is_some() {} webtile - .start_game_seeded("dcss-0.32", "158985", false, "b", "f", "b") + .start_game_seeded(game_id.as_str(), "158985", false, "b", "f", "b") .expect("Failed to start game"); // Get last message @@ -112,8 +85,10 @@ fn start_game_seeded() { #[test] fn start_game() { + let game_id = std::env::var("GAME_ID").unwrap(); + // Safe test -- login start game, quit, and then test - reset_test("Username"); + common::reset_test("Username", game_id.as_str()); // Connect to DCSS Webtile let mut webtile = @@ -131,7 +106,7 @@ fn start_game() { while webtile.get_message().is_some() {} webtile - .start_game("dcss-0.32", "b", "f", "b") + .start_game(game_id.as_str(), "b", "f", "b") .expect("Failed to start game"); let mut msgs = from_str("{}").unwrap(); @@ -159,8 +134,10 @@ fn start_game() { #[test] fn save_game_continue() { + let game_id = std::env::var("GAME_ID").unwrap(); + // Safe test -- login start game, quit, and then test - reset_test("Username"); + common::reset_test("Username", game_id.as_str()); // Connect to DCSS Webtile let mut webtile = @@ -178,7 +155,7 @@ fn save_game_continue() { while webtile.get_message().is_some() {} webtile - .start_game("dcss-0.32", "b", "f", "b") + .start_game(game_id.as_str(), "b", "f", "b") .expect("Failed to start game"); // Get last message @@ -200,7 +177,7 @@ fn save_game_continue() { assert!(last_message["msg"] == "go_lobby"); webtile - .continue_game("dcss-0.32") + .continue_game(game_id.as_str()) .expect("Failed to continue game"); // Get last message @@ -218,8 +195,10 @@ fn save_game_continue() { #[test] fn start_game_two_accounts() { + let game_id = std::env::var("GAME_ID").unwrap(); + // Safe test -- login start game, quit, and then test - reset_test("Username"); + common::reset_test("Username", game_id.as_str()); // Connect to DCSS Webtile let mut webtile = @@ -237,7 +216,7 @@ fn start_game_two_accounts() { while webtile.get_message().is_some() {} webtile - .start_game("dcss-0.32", "b", "f", "b") + .start_game(game_id.as_str(), "b", "f", "b") .expect("Failed to start game"); let mut msgs = from_str("{}").unwrap(); @@ -263,7 +242,7 @@ fn start_game_two_accounts() { webtile.disconnect().expect("Failed to disconnect"); // Safe test -- login start game, quit, and then test - reset_test("Username2"); + common::reset_test("Username2", game_id.as_str()); // Connect to DCSS Webtile let mut webtile = @@ -281,7 +260,7 @@ fn start_game_two_accounts() { while webtile.get_message().is_some() {} webtile - .start_game("dcss-0.32", "b", "f", "b") + .start_game(game_id.as_str(), "b", "f", "b") .expect("Failed to start game"); let mut msgs = from_str("{}").unwrap(); @@ -309,9 +288,11 @@ fn start_game_two_accounts() { #[test] fn start_game_two_accounts_combined() { + let game_id = std::env::var("GAME_ID").unwrap(); + // Safe test -- login start game, quit, and then test - reset_test("Username"); - reset_test("Username2"); + common::reset_test("Username", game_id.as_str()); + common::reset_test("Username2", game_id.as_str()); // Connect to DCSS Webtile let mut webtile1 = @@ -336,10 +317,10 @@ fn start_game_two_accounts_combined() { while webtile2.get_message().is_some() {} webtile1 - .start_game("dcss-0.32", "b", "f", "b") + .start_game(game_id.as_str(), "b", "f", "b") .expect("Failed to start game"); webtile2 - .start_game("dcss-0.32", "b", "f", "b") + .start_game(game_id.as_str(), "b", "f", "b") .expect("Failed to start game"); let mut msgs = from_str("{}").unwrap(); @@ -387,8 +368,10 @@ fn start_game_two_accounts_combined() { #[test] fn real_blocking_error() { + let game_id = std::env::var("GAME_ID").unwrap(); + // Safe test -- login start game, quit, and then test - reset_test("Username"); + common::reset_test("Username", game_id.as_str()); // Connect to DCSS Webtile let mut webtile = @@ -406,7 +389,7 @@ fn real_blocking_error() { while webtile.get_message().is_some() {} webtile - .start_game_seeded("dcss-0.32", "1", true, "b", "f", "b") + .start_game_seeded(game_id.as_str(), "1", true, "b", "f", "b") .expect("Failed to start game"); // Get last message diff --git a/dcss-api/tests/versions_test.rs b/dcss-api/tests/versions_test.rs deleted file mode 100644 index d05a5de..0000000 --- a/dcss-api/tests/versions_test.rs +++ /dev/null @@ -1,345 +0,0 @@ -use dcss_api::Webtile; -use serde_json::from_str; - -fn reset_test(username: &str, version: &str) { - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.32").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials(username, "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game(version, "b", "f", "b") - .expect("Failed to start game"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile.quit_game().expect("Failed to quit game"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile.disconnect().expect("Failed to disconnect"); -} - -#[test] -fn start_game_seeded_0_29() { - // Safe test -- login start game, quit, and then test - reset_test("Username", "dcss-0.29"); - - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.29").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials("Username", "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game_seeded("dcss-0.29", "1", true, "b", "f", "b") - .expect("Failed to start game"); - - // Get last message - let mut msgs = from_str("{}").unwrap(); - while let Some(message) = webtile.get_message() { - if message["msg"] == "msgs" { - msgs = message; - break; - } - } - - assert!(msgs["messages"] - .to_string() - .contains("Game seed: 1 (custom seed)")); - - webtile.quit_game().expect("Failed to quit game"); - - webtile.disconnect().expect("Failed to disconnect"); - - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.29").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials("Username", "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game_seeded("dcss-0.29", "158985", false, "b", "f", "b") - .expect("Failed to start game"); - - // Get last message - let mut msgs = from_str("{}").unwrap(); - while let Some(message) = webtile.get_message() { - if message["msg"] == "msgs" { - msgs = message; - break; - } - } - - assert!(msgs["messages"] - .to_string() - .contains("Game seed: 158985 (custom seed)")); - - webtile.quit_game().expect("Failed to quit game"); - - webtile.disconnect().expect("Failed to disconnect"); -} - -#[test] -fn start_game_seeded_0_30() { - // Safe test -- login start game, quit, and then test - reset_test("Username", "dcss-0.30"); - - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.30").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials("Username", "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game_seeded("dcss-0.30", "1", true, "b", "f", "b") - .expect("Failed to start game"); - - // Get last message - let mut msgs = from_str("{}").unwrap(); - while let Some(message) = webtile.get_message() { - if message["msg"] == "msgs" { - msgs = message; - break; - } - } - - assert!(msgs["messages"] - .to_string() - .contains("Game seed: 1 (custom seed)")); - - webtile.quit_game().expect("Failed to quit game"); - - webtile.disconnect().expect("Failed to disconnect"); - - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.30").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials("Username", "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game_seeded("dcss-0.30", "158985", false, "b", "f", "b") - .expect("Failed to start game"); - - // Get last message - let mut msgs = from_str("{}").unwrap(); - while let Some(message) = webtile.get_message() { - if message["msg"] == "msgs" { - msgs = message; - break; - } - } - - assert!(msgs["messages"] - .to_string() - .contains("Game seed: 158985 (custom seed)")); - - webtile.quit_game().expect("Failed to quit game"); - - webtile.disconnect().expect("Failed to disconnect"); -} - -#[test] -fn start_game_seeded_0_31() { - // Safe test -- login start game, quit, and then test - reset_test("Username", "dcss-0.31"); - - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.31").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials("Username", "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game_seeded("dcss-0.31", "1", true, "b", "f", "b") - .expect("Failed to start game"); - - // Get last message - let mut msgs = from_str("{}").unwrap(); - while let Some(message) = webtile.get_message() { - if message["msg"] == "msgs" { - msgs = message; - break; - } - } - - assert!(msgs["messages"] - .to_string() - .contains("Game seed: 1 (custom seed)")); - - webtile.quit_game().expect("Failed to quit game"); - - webtile.disconnect().expect("Failed to disconnect"); - - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.31").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials("Username", "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game_seeded("dcss-0.31", "158985", false, "b", "f", "b") - .expect("Failed to start game"); - - // Get last message - let mut msgs = from_str("{}").unwrap(); - while let Some(message) = webtile.get_message() { - if message["msg"] == "msgs" { - msgs = message; - break; - } - } - - assert!(msgs["messages"] - .to_string() - .contains("Game seed: 158985 (custom seed)")); - - webtile.quit_game().expect("Failed to quit game"); - - webtile.disconnect().expect("Failed to disconnect"); -} - -#[test] -fn start_game_seeded_0_32() { - // Safe test -- login start game, quit, and then test - reset_test("Username", "dcss-0.32"); - - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.32").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials("Username", "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game_seeded("dcss-0.32", "1", true, "b", "f", "b") - .expect("Failed to start game"); - - // Get last message - let mut msgs = from_str("{}").unwrap(); - while let Some(message) = webtile.get_message() { - if message["msg"] == "msgs" { - msgs = message; - break; - } - } - - assert!(msgs["messages"] - .to_string() - .contains("Game seed: 1 (custom seed)")); - - webtile.quit_game().expect("Failed to quit game"); - - webtile.disconnect().expect("Failed to disconnect"); - - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.32").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials("Username", "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game_seeded("dcss-0.32", "158985", false, "b", "f", "b") - .expect("Failed to start game"); - - // Get last message - let mut msgs = from_str("{}").unwrap(); - while let Some(message) = webtile.get_message() { - if message["msg"] == "msgs" { - msgs = message; - break; - } - } - - assert!(msgs["messages"] - .to_string() - .contains("Game seed: 158985 (custom seed)")); - - webtile.quit_game().expect("Failed to quit game"); - - webtile.disconnect().expect("Failed to disconnect"); -} diff --git a/dcss-scenario-builder/tests/common.rs b/dcss-scenario-builder/tests/common.rs new file mode 100644 index 0000000..e346f72 --- /dev/null +++ b/dcss-scenario-builder/tests/common.rs @@ -0,0 +1,34 @@ +#![allow(dead_code)] + +use dcss_api::Webtile; + +pub(crate) fn reset_test(username: &str, game_id: &str) { + // Connect to DCSS Webtile + let mut webtile = + Webtile::connect("ws://localhost:8080/socket", 0, "0.32").expect("Failed to connect"); + + // Empty message queue; + while webtile.get_message().is_some() {} + + // Log in (to a user called "Username", with a password "Password") + let _game_ids = webtile + .login_with_credentials(username, "Password") + .expect("Failed to login"); + + // Empty message queue; + while webtile.get_message().is_some() {} + + webtile + .start_game(game_id, "b", "f", "b") + .expect("Failed to start game"); + + // Empty message queue; + while webtile.get_message().is_some() {} + + webtile.quit_game().expect("Failed to quit game"); + + // Empty message queue; + while webtile.get_message().is_some() {} + + webtile.disconnect().expect("Failed to disconnect"); +} diff --git a/dcss-scenario-builder/tests/test_incorrect.rs b/dcss-scenario-builder/tests/test_incorrect.rs index 8c26043..b7f020b 100644 --- a/dcss-scenario-builder/tests/test_incorrect.rs +++ b/dcss-scenario-builder/tests/test_incorrect.rs @@ -1,42 +1,15 @@ +mod common; + use dcss_api::Webtile; use dcss_scenario_builder::start_game_with_scenario; -fn reset_test(username: &str) { - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.32").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials(username, "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game("dcss-0.32", "b", "f", "b") - .expect("Failed to start game"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile.quit_game().expect("Failed to quit game"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile.disconnect().expect("Failed to disconnect"); -} - #[should_panic] #[test] fn verify_no_character() { + let game_id = std::env::var("GAME_ID").unwrap(); + // Safe test -- login start game, quit, and then test - reset_test("Username"); + common::reset_test("Username", game_id.as_str()); // Connect to DCSS Webtile let mut webtile = @@ -53,7 +26,7 @@ fn verify_no_character() { // Start game with simple scenario. start_game_with_scenario( &mut webtile, - "dcss-0.32", + game_id.as_str(), "b", "i", "c", @@ -65,8 +38,10 @@ fn verify_no_character() { #[should_panic] #[test] fn verify_too_wide() { + let game_id = std::env::var("GAME_ID").unwrap(); + // Safe test -- login start game, quit, and then test - reset_test("Username"); + common::reset_test("Username", game_id.as_str()); // Connect to DCSS Webtile let mut webtile = @@ -83,7 +58,7 @@ fn verify_too_wide() { // Start game with simple scenario. start_game_with_scenario( &mut webtile, - "dcss-0.32", + game_id.as_str(), "b", "i", "c", @@ -95,8 +70,10 @@ fn verify_too_wide() { #[should_panic] #[test] fn verify_too_long() { + let game_id = std::env::var("GAME_ID").unwrap(); + // Safe test -- login start game, quit, and then test - reset_test("Username"); + common::reset_test("Username", game_id.as_str()); // Connect to DCSS Webtile let mut webtile = @@ -113,7 +90,7 @@ fn verify_too_long() { // Start game with simple scenario. start_game_with_scenario( &mut webtile, - "dcss-0.32", + game_id.as_str(), "b", "i", "c", diff --git a/dcss-scenario-builder/tests/test_wizmode.rs b/dcss-scenario-builder/tests/test_wizmode.rs index cd7433e..f913543 100644 --- a/dcss-scenario-builder/tests/test_wizmode.rs +++ b/dcss-scenario-builder/tests/test_wizmode.rs @@ -1,41 +1,14 @@ +mod common; + use dcss_api::{Error, Webtile}; use dcss_scenario_builder::start_game_with_scenario; -fn reset_test(username: &str) { - // Connect to DCSS Webtile - let mut webtile = - Webtile::connect("ws://localhost:8080/socket", 0, "0.32").expect("Failed to connect"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - // Log in (to a user called "Username", with a password "Password") - let _game_ids = webtile - .login_with_credentials(username, "Password") - .expect("Failed to login"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile - .start_game("dcss-0.32", "b", "f", "b") - .expect("Failed to start game"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile.quit_game().expect("Failed to quit game"); - - // Empty message queue; - while webtile.get_message().is_some() {} - - webtile.disconnect().expect("Failed to disconnect"); -} - #[test] fn verify_wizmode() -> Result<(), Error> { + let game_id = std::env::var("GAME_ID").unwrap(); + // Safe test -- login start game, quit, and then test - reset_test("Username"); + common::reset_test("Username", game_id.as_str()); // Connect to DCSS Webtile let mut webtile = @@ -52,7 +25,7 @@ fn verify_wizmode() -> Result<(), Error> { // Start game with simple scenario. start_game_with_scenario( &mut webtile, - "dcss-0.32", + game_id.as_str(), "b", "i", "c", @@ -62,7 +35,7 @@ fn verify_wizmode() -> Result<(), Error> { webtile.save_game().expect("Failed to save game."); - webtile.continue_game("dcss-0.32")?; + webtile.continue_game(game_id.as_str())?; while let Some(message) = webtile.get_message() { if message["msg"].as_str().unwrap() == "player" From 9b5b98bfd6efa73f2c77f51ca57de48392561214 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Tue, 11 Mar 2025 18:57:35 -0400 Subject: [PATCH 20/29] Fix bug --- .github/workflows/build-and-test.yml | 8 ++++---- dcss-data/tests/common.rs | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index cdc45bc..438a087 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -32,13 +32,13 @@ jobs: run: just setup-dcss-server - name: Run DCSS Webtiles - run: just dcss-run && sleep 5 - - - name: Create users - run: | + run: | python3 crawl/server/server.py & sleep 5 + - name: Create users + run: just dcss-create-users + - name: Test dcss-api run: cd ./dcss-api/ & cargo test successful_connect diff --git a/dcss-data/tests/common.rs b/dcss-data/tests/common.rs index fbb956a..008876d 100644 --- a/dcss-data/tests/common.rs +++ b/dcss-data/tests/common.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use dcss_api::Webtile; fn reset_test(username: &str) { From cadcffe59684e109d78d951cfe7545db3c029513 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Tue, 11 Mar 2025 19:13:36 -0400 Subject: [PATCH 21/29] Install cargo --- .github/workflows/build-and-test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 438a087..0446b72 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -18,6 +18,13 @@ jobs: - name: Checkout main uses: actions/checkout@v4 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt + default: true + - uses: extractions/setup-just@v2 - name: Install dependencies From 5429f5e2347304f9dd695f8d56197d59bb808db8 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Tue, 11 Mar 2025 19:46:14 -0400 Subject: [PATCH 22/29] Fix typo --- Justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Justfile b/Justfile index 3cfa516..8ee03c2 100644 --- a/Justfile +++ b/Justfile @@ -41,7 +41,7 @@ dcss-run: python3 crawl/server/server.py dcss-create-users: - cd ./dcss-api && cargo -r run --example 0_setup + cd ./dcss-api && cargo run -r --example 0_setup dcss-clear: rm -rf ./saves From 91e5729a514bd1843e1a389b64119d96813e523a Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Tue, 11 Mar 2025 20:02:40 -0400 Subject: [PATCH 23/29] Update tests --- .github/workflows/build-and-test.yml | 5 +++-- Justfile | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 0446b72..327aebf 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -47,8 +47,9 @@ jobs: run: just dcss-create-users - name: Test dcss-api - run: cd ./dcss-api/ & cargo test successful_connect - + run: just test-api + - name: Test dcss-scenario-builder + run: just test-scenario \ No newline at end of file diff --git a/Justfile b/Justfile index 8ee03c2..bf3cab7 100644 --- a/Justfile +++ b/Justfile @@ -62,15 +62,15 @@ dcss-disable-logging: sed -i -e 's/print("SENT FROM DCSS: ", msg, data)/# type: (str, Any) -> bool/g' ./crawl/server/webtiles/ws_handler.py test-api: - cd ./dcss-api && GAME_ID=dcss-0.29 cargo test - cd ./dcss-api && GAME_ID=dcss-0.30 cargo test - cd ./dcss-api && GAME_ID=dcss-0.31 cargo test + # cd ./dcss-api && GAME_ID=dcss-0.29 cargo test + # cd ./dcss-api && GAME_ID=dcss-0.30 cargo test + # cd ./dcss-api && GAME_ID=dcss-0.31 cargo test cd ./dcss-api && GAME_ID=dcss-0.32 cargo test test-scenario: - cd ./dcss-scenario-builder && GAME_ID=dcss-0.29 cargo test - cd ./dcss-scenario-builder && GAME_ID=dcss-0.30 cargo test - cd ./dcss-scenario-builder && GAME_ID=dcss-0.31 cargo test + # cd ./dcss-scenario-builder && GAME_ID=dcss-0.29 cargo test + # cd ./dcss-scenario-builder && GAME_ID=dcss-0.30 cargo test + # cd ./dcss-scenario-builder && GAME_ID=dcss-0.31 cargo test cd ./dcss-scenario-builder && GAME_ID=dcss-0.32 cargo test setup-python: From c3fc2c2b6391b1e1886a94ac41174f54ad3e551d Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Wed, 12 Mar 2025 16:32:38 -0400 Subject: [PATCH 24/29] Full test --- Justfile | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/Justfile b/Justfile index bf3cab7..6bdb27e 100644 --- a/Justfile +++ b/Justfile @@ -4,20 +4,20 @@ setup-dcss-server: mkdir ./crawl/main git -C ./crawl/main/ clone "https://github.com/crawl/crawl.git" - # mkdir ./crawl/dcss-0.29 - # cp -r ./crawl/main/crawl/. ./crawl/dcss-0.29 - # git -C ./crawl/dcss-0.29 checkout stone_soup-0.29 - # make -C ./crawl/dcss-0.29/crawl-ref/source WEBTILES=y + mkdir ./crawl/dcss-0.29 + cp -r ./crawl/main/crawl/. ./crawl/dcss-0.29 + git -C ./crawl/dcss-0.29 checkout stone_soup-0.29 + make -C ./crawl/dcss-0.29/crawl-ref/source WEBTILES=y - # mkdir ./crawl/dcss-0.30 - # cp -r ./crawl/main/crawl/. ./crawl/dcss-0.30 - # git -C ./crawl/dcss-0.30 checkout stone_soup-0.30 - # make -C ./crawl/dcss-0.30/crawl-ref/source WEBTILES=y + mkdir ./crawl/dcss-0.30 + cp -r ./crawl/main/crawl/. ./crawl/dcss-0.30 + git -C ./crawl/dcss-0.30 checkout stone_soup-0.30 + make -C ./crawl/dcss-0.30/crawl-ref/source WEBTILES=y - # mkdir ./crawl/dcss-0.31 - # cp -r ./crawl/main/crawl/. ./crawl/dcss-0.31 - # git -C ./crawl/dcss-0.31 checkout stone_soup-0.31 - # make -C ./crawl/dcss-0.31/crawl-ref/source WEBTILES=y + mkdir ./crawl/dcss-0.31 + cp -r ./crawl/main/crawl/. ./crawl/dcss-0.31 + git -C ./crawl/dcss-0.31 checkout stone_soup-0.31 + make -C ./crawl/dcss-0.31/crawl-ref/source WEBTILES=y mkdir ./crawl/dcss-0.32 cp -r ./crawl/main/crawl/. ./crawl/dcss-0.32 @@ -30,10 +30,6 @@ setup-dcss-server: sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py cp ./crawl-config/config.py ./crawl/server/config.py cp ./crawl-config/init-player.sh ./crawl/server/init-player.sh - # echo save_dir = ./crawl/server/saves-0.29 > ./crawl/server/init-0.29.txt - # echo save_dir = ./crawl/server/saves-0.30 > ./crawl/server/init-0.30.txt - # echo save_dir = ./crawl/server/saves-0.31 > ./crawl/server/init-0.31.txt - echo save_dir = ./crawl/server/saves-0.32 > ./crawl/server/init-0.32.txt rm -rf ./crawl/main @@ -62,15 +58,15 @@ dcss-disable-logging: sed -i -e 's/print("SENT FROM DCSS: ", msg, data)/# type: (str, Any) -> bool/g' ./crawl/server/webtiles/ws_handler.py test-api: - # cd ./dcss-api && GAME_ID=dcss-0.29 cargo test - # cd ./dcss-api && GAME_ID=dcss-0.30 cargo test - # cd ./dcss-api && GAME_ID=dcss-0.31 cargo test + cd ./dcss-api && GAME_ID=dcss-0.29 cargo test + cd ./dcss-api && GAME_ID=dcss-0.30 cargo test + cd ./dcss-api && GAME_ID=dcss-0.31 cargo test cd ./dcss-api && GAME_ID=dcss-0.32 cargo test test-scenario: - # cd ./dcss-scenario-builder && GAME_ID=dcss-0.29 cargo test - # cd ./dcss-scenario-builder && GAME_ID=dcss-0.30 cargo test - # cd ./dcss-scenario-builder && GAME_ID=dcss-0.31 cargo test + cd ./dcss-scenario-builder && GAME_ID=dcss-0.29 cargo test + cd ./dcss-scenario-builder && GAME_ID=dcss-0.30 cargo test + cd ./dcss-scenario-builder && GAME_ID=dcss-0.31 cargo test cd ./dcss-scenario-builder && GAME_ID=dcss-0.32 cargo test setup-python: From a101e7874f122f56f1643ae35068233920eddc92 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Wed, 12 Mar 2025 17:14:49 -0400 Subject: [PATCH 25/29] Added python to ci --- .github/workflows/build-and-test.yml | 13 +- Justfile | 5 +- dcss-api-python/tests/rc_file_test.py | 22 +- dcss-api-python/tests/scenario_test.py | 32 ++- dcss-api-python/tests/start_game_test.py | 55 ++-- dcss-api-python/tests/versions_test.py | 321 ----------------------- 6 files changed, 79 insertions(+), 369 deletions(-) delete mode 100644 dcss-api-python/tests/versions_test.py diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 327aebf..39d31b2 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -4,9 +4,6 @@ on: pull_request: branches: - main - push: - branches: - - main permissions: contents: read @@ -46,10 +43,14 @@ jobs: - name: Create users run: just dcss-create-users - - name: Test dcss-api + - name: Test Rust dcss-api run: just test-api - - name: Test dcss-scenario-builder + - name: Test Rust dcss-scenario-builder run: just test-scenario - \ No newline at end of file + - name: Setup python dcss-api + run: just setup-python + + - name: Test python dcss-api + run: just test-python diff --git a/Justfile b/Justfile index 6bdb27e..7602028 100644 --- a/Justfile +++ b/Justfile @@ -77,7 +77,10 @@ setup-python: source ./dcss-api-python/pyo3/bin/activate && cd ./dcss-api-python/ && maturin develop -r test-python: - source ./dcss-api-python/pyo3/bin/activate && pytest ./dcss-api-python/tests + source ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.29 pytest ./dcss-api-python/tests + source ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.30 pytest ./dcss-api-python/tests + source ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.31 pytest ./dcss-api-python/tests + source ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.32 pytest ./dcss-api-python/tests cargo-update: cd ./dcss-api && cargo update diff --git a/dcss-api-python/tests/rc_file_test.py b/dcss-api-python/tests/rc_file_test.py index 1e65cf6..d18ab25 100644 --- a/dcss-api-python/tests/rc_file_test.py +++ b/dcss-api-python/tests/rc_file_test.py @@ -2,9 +2,11 @@ import dcss_api from dcss_api import APIErr import json - +import os def test_write_read_rc(): + game_id = os.environ['GAME_ID'] + # Connect to DCSS Webtile webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -16,18 +18,18 @@ def test_write_read_rc(): while (message := webtile.get_message()) != None: pass - webtile.set_rc_file("dcss-0.32", "this is a test") + webtile.set_rc_file(game_id, "this is a test") - rc_file = webtile.get_rc_file("dcss-0.32") + rc_file = webtile.get_rc_file(game_id) assert rc_file == "this is a test" while (message := webtile.get_message()) != None: pass - webtile.set_rc_file("dcss-0.32", "show_more = false\nrest_delay = -1") + webtile.set_rc_file(game_id, "show_more = false\nrest_delay = -1") - rc_file = webtile.get_rc_file("dcss-0.32") + rc_file = webtile.get_rc_file(game_id) assert rc_file == "show_more = false\nrest_delay = -1" @@ -35,6 +37,8 @@ def test_write_read_rc(): def test_blank_rc_file(): + game_id = os.environ['GAME_ID'] + # Connect to DCSS Webtile webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -46,18 +50,18 @@ def test_blank_rc_file(): while (message := webtile.get_message()) != None: pass - webtile.set_rc_file("dcss-0.32", "") + webtile.set_rc_file(game_id, "") - rc_file = webtile.get_rc_file("dcss-0.32") + rc_file = webtile.get_rc_file(game_id) assert rc_file == "" while (message := webtile.get_message()) != None: pass - webtile.set_rc_file("dcss-0.32", "show_more = false\nrest_delay = -1") + webtile.set_rc_file(game_id, "show_more = false\nrest_delay = -1") - rc_file = webtile.get_rc_file("dcss-0.32") + rc_file = webtile.get_rc_file(game_id) assert rc_file == "show_more = false\nrest_delay = -1" diff --git a/dcss-api-python/tests/scenario_test.py b/dcss-api-python/tests/scenario_test.py index c77c4f8..31c7960 100644 --- a/dcss-api-python/tests/scenario_test.py +++ b/dcss-api-python/tests/scenario_test.py @@ -1,9 +1,11 @@ import pytest import dcss_api import json +import os from dcss_api import ScenarioErr -def reset_test(username): +def reset_test(username, game_id): + # Connect to DCSS Webtile webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -15,7 +17,7 @@ def reset_test(username): while (message := webtile.get_message()) != None: pass - webtile.start_game("dcss-0.32", "b", "f", "b") + webtile.start_game(game_id, "b", "f", "b") while (message := webtile.get_message()) != None: pass @@ -28,7 +30,9 @@ def reset_test(username): webtile.disconnect() def test_wizmode(): - reset_test("Username") + game_id = os.environ['GAME_ID'] + + reset_test("Username", game_id) webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -41,11 +45,11 @@ def test_wizmode(): pass yaml_file = "./dcss-scenario-builder/tests/test_scenarios/simple_map.yaml" - webtile.start_game_with_scenario("dcss-0.32", "b", "f", "b", yaml_file) + webtile.start_game_with_scenario(game_id, "b", "f", "b", yaml_file) webtile.save_game() - webtile.continue_game("dcss-0.32") + webtile.continue_game(game_id) while (message := webtile.get_message()) != None: json_message = json.loads(message) @@ -61,7 +65,9 @@ def test_wizmode(): def test_no_character(): - reset_test("Username") + game_id = os.environ['GAME_ID'] + + reset_test("Username", game_id) webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -76,7 +82,7 @@ def test_no_character(): yaml_file = "./dcss-scenario-builder/tests/test_scenarios/no_char.yaml" try: - webtile.start_game_with_scenario("dcss-0.32", "b", "f", "b", yaml_file) + webtile.start_game_with_scenario(game_id, "b", "f", "b", yaml_file) except ScenarioErr as e: if "Missing `@` on `D:1`" in e.args[0]: assert True @@ -85,7 +91,9 @@ def test_no_character(): def test_too_wide(): - reset_test("Username") + game_id = os.environ['GAME_ID'] + + reset_test("Username", game_id) webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -100,7 +108,7 @@ def test_too_wide(): yaml_file = "./dcss-scenario-builder/tests/test_scenarios/too_wide.yaml" try: - webtile.start_game_with_scenario("dcss-0.32", "b", "f", "b", yaml_file) + webtile.start_game_with_scenario(game_id, "b", "f", "b", yaml_file) except ScenarioErr as e: if "Maximum width of map is 79 columns" in e.args[0]: assert True @@ -109,7 +117,9 @@ def test_too_wide(): def test_too_long(): - reset_test("Username") + game_id = os.environ['GAME_ID'] + + reset_test("Username", game_id) webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -124,7 +134,7 @@ def test_too_long(): yaml_file = "./dcss-scenario-builder/tests/test_scenarios/too_long.yaml" try: - webtile.start_game_with_scenario("dcss-0.32", "b", "f", "b", yaml_file) + webtile.start_game_with_scenario(game_id, "b", "f", "b", yaml_file) except ScenarioErr as e: if "Maximum height of map is 69 rows" in e.args[0]: assert True diff --git a/dcss-api-python/tests/start_game_test.py b/dcss-api-python/tests/start_game_test.py index e67d362..4925532 100644 --- a/dcss-api-python/tests/start_game_test.py +++ b/dcss-api-python/tests/start_game_test.py @@ -1,10 +1,11 @@ import pytest import dcss_api -from dcss_api import BlockingErr import json +import os +from dcss_api import BlockingErr -def reset_test(username): +def reset_test(username, game_id): # Connect to DCSS Webtile webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -16,7 +17,7 @@ def reset_test(username): while (message := webtile.get_message()) != None: pass - webtile.start_game("dcss-0.32", "b", "f", "b") + webtile.start_game(game_id, "b", "f", "b") while (message := webtile.get_message()) != None: pass @@ -30,7 +31,9 @@ def reset_test(username): def test_start_game_seeded(): - reset_test("Username") + game_id = os.environ['GAME_ID'] + + reset_test("Username", game_id) # Connect to DCSS Webtile webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -43,7 +46,7 @@ def test_start_game_seeded(): while (message := webtile.get_message()) != None: pass - webtile.start_game_seeded("dcss-0.32", "1", True, "b", "f", "b") + webtile.start_game_seeded(game_id, "1", True, "b", "f", "b") msgs = None while (message := webtile.get_message()) != None: @@ -77,7 +80,7 @@ def test_start_game_seeded(): while (message := webtile.get_message()) != None: pass - webtile.start_game_seeded("dcss-0.32", "158985", True, "b", "f", "b") + webtile.start_game_seeded(game_id, "158985", True, "b", "f", "b") msgs = None while (message := webtile.get_message()) != None: @@ -103,7 +106,9 @@ def test_start_game_seeded(): def test_start_game(): - reset_test("Username") + game_id = os.environ['GAME_ID'] + + reset_test("Username", game_id) # Connect to DCSS Webtile webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -116,7 +121,7 @@ def test_start_game(): while (message := webtile.get_message()) != None: pass - webtile.start_game("dcss-0.32", "b", "f", "b") + webtile.start_game(game_id, "b", "f", "b") msgs = None while (message := webtile.get_message()) != None: @@ -137,7 +142,9 @@ def test_start_game(): def test_start_game(): - reset_test("Username") + game_id = os.environ['GAME_ID'] + + reset_test("Username", game_id) # Connect to DCSS Webtile webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -150,7 +157,7 @@ def test_start_game(): while (message := webtile.get_message()) != None: pass - webtile.start_game("dcss-0.32", "b", "f", "b") + webtile.start_game(game_id, "b", "f", "b") json_message = None while (message := webtile.get_message()) != None: @@ -166,7 +173,7 @@ def test_start_game(): assert json_message["msg"] == "go_lobby" - webtile.continue_game("dcss-0.32") + webtile.continue_game(game_id) json_message = None while (message := webtile.get_message()) != None: @@ -180,7 +187,9 @@ def test_start_game(): def test_start_game_two_accounts(): - reset_test("Username") + game_id = os.environ['GAME_ID'] + + reset_test("Username", game_id) webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -192,7 +201,7 @@ def test_start_game_two_accounts(): while (message := webtile.get_message()) != None: pass - webtile.start_game("dcss-0.32", "b", "f", "b") + webtile.start_game(game_id, "b", "f", "b") msgs = None while (message := webtile.get_message()) != None: @@ -219,7 +228,7 @@ def test_start_game_two_accounts(): webtile.disconnect() - reset_test("Username2") + reset_test("Username2", game_id) webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -231,7 +240,7 @@ def test_start_game_two_accounts(): while (message := webtile.get_message()) != None: pass - webtile.start_game("dcss-0.32", "b", "f", "b") + webtile.start_game(game_id, "b", "f", "b") msgs = None while (message := webtile.get_message()) != None: @@ -260,8 +269,10 @@ def test_start_game_two_accounts(): def test_start_game_two_accounts_combined(): - reset_test("Username") - reset_test("Username2") + game_id = os.environ['GAME_ID'] + + reset_test("Username", game_id) + reset_test("Username2", game_id) webtile1 = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") webtile2 = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -279,8 +290,8 @@ def test_start_game_two_accounts_combined(): while (message := webtile2.get_message()) != None: pass - webtile1.start_game("dcss-0.32", "b", "f", "b") - webtile2.start_game("dcss-0.32", "b", "f", "b") + webtile1.start_game(game_id, "b", "f", "b") + webtile2.start_game(game_id, "b", "f", "b") msgs = None while (message := webtile1.get_message()) != None: @@ -332,7 +343,9 @@ def test_start_game_two_accounts_combined(): def test_real_blocking_error(): - reset_test("Username") + game_id = os.environ['GAME_ID'] + + reset_test("Username", game_id) webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") @@ -344,7 +357,7 @@ def test_real_blocking_error(): while (message := webtile.get_message()) != None: pass - webtile.start_game("dcss-0.32", "b", "f", "b") + webtile.start_game(game_id, "b", "f", "b") msgs = None while (message := webtile.get_message()) != None: diff --git a/dcss-api-python/tests/versions_test.py b/dcss-api-python/tests/versions_test.py deleted file mode 100644 index 8cbd8ca..0000000 --- a/dcss-api-python/tests/versions_test.py +++ /dev/null @@ -1,321 +0,0 @@ -import pytest -import dcss_api -from dcss_api import BlockingErr -import json - - -def reset_test(username, version): - # Connect to DCSS Webtile - webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") - - while (message := webtile.get_message()) != None: - pass - - webtile.login_with_credentials(username, "Password") - - while (message := webtile.get_message()) != None: - pass - - webtile.start_game(version, "b", "f", "b") - - while (message := webtile.get_message()) != None: - pass - - webtile.quit_game() - - while (message := webtile.get_message()) != None: - pass - - webtile.disconnect() - - -def test_start_game_seeded_0_29(): - reset_test("Username", "dcss-0.29") - - # Connect to DCSS Webtile - webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.29") - - while (message := webtile.get_message()) != None: - pass - - webtile.login_with_credentials("Username", "Password") - - while (message := webtile.get_message()) != None: - pass - - webtile.start_game_seeded("dcss-0.29", "1", True, "b", "f", "b") - - msgs = None - while (message := webtile.get_message()) != None: - json_message = json.loads(message) - if json_message["msg"] == "msgs": - msgs = json_message - break - - found = False - for msg in msgs["messages"]: - if "Game seed: 1 (custom seed)" in msg["text"]: - found = True - break - - assert found - - webtile.quit_game() - - while (message := webtile.get_message()) != None: - pass - - webtile.disconnect() - - webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.29") - - while (message := webtile.get_message()) != None: - pass - - webtile.login_with_credentials("Username", "Password") - - while (message := webtile.get_message()) != None: - pass - - webtile.start_game_seeded("dcss-0.29", "158985", True, "b", "f", "b") - - msgs = None - while (message := webtile.get_message()) != None: - json_message = json.loads(message) - if json_message["msg"] == "msgs": - msgs = json_message - break - - found = False - for msg in msgs["messages"]: - if "Game seed: 158985 (custom seed)" in msg["text"]: - found = True - break - - assert found - - webtile.quit_game() - - while (message := webtile.get_message()) != None: - pass - - webtile.disconnect() - - -def test_start_game_seeded_0_30(): - reset_test("Username", "dcss-0.30") - - # Connect to DCSS Webtile - webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.30") - - while (message := webtile.get_message()) != None: - pass - - webtile.login_with_credentials("Username", "Password") - - while (message := webtile.get_message()) != None: - pass - - webtile.start_game_seeded("dcss-0.30", "1", True, "b", "f", "b") - - msgs = None - while (message := webtile.get_message()) != None: - json_message = json.loads(message) - if json_message["msg"] == "msgs": - msgs = json_message - break - - found = False - for msg in msgs["messages"]: - if "Game seed: 1 (custom seed)" in msg["text"]: - found = True - break - - assert found - - webtile.quit_game() - - while (message := webtile.get_message()) != None: - pass - - webtile.disconnect() - - webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.30") - - while (message := webtile.get_message()) != None: - pass - - webtile.login_with_credentials("Username", "Password") - - while (message := webtile.get_message()) != None: - pass - - webtile.start_game_seeded("dcss-0.30", "158985", True, "b", "f", "b") - - msgs = None - while (message := webtile.get_message()) != None: - json_message = json.loads(message) - if json_message["msg"] == "msgs": - msgs = json_message - break - - found = False - for msg in msgs["messages"]: - if "Game seed: 158985 (custom seed)" in msg["text"]: - found = True - break - - assert found - - webtile.quit_game() - - while (message := webtile.get_message()) != None: - pass - - webtile.disconnect() - - -def test_start_game_seeded_0_31(): - reset_test("Username", "dcss-0.31") - - # Connect to DCSS Webtile - webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.31") - - while (message := webtile.get_message()) != None: - pass - - webtile.login_with_credentials("Username", "Password") - - while (message := webtile.get_message()) != None: - pass - - webtile.start_game_seeded("dcss-0.31", "1", True, "b", "f", "b") - - msgs = None - while (message := webtile.get_message()) != None: - json_message = json.loads(message) - if json_message["msg"] == "msgs": - msgs = json_message - break - - found = False - for msg in msgs["messages"]: - if "Game seed: 1 (custom seed)" in msg["text"]: - found = True - break - - assert found - - webtile.quit_game() - - while (message := webtile.get_message()) != None: - pass - - webtile.disconnect() - - webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.31") - - while (message := webtile.get_message()) != None: - pass - - webtile.login_with_credentials("Username", "Password") - - while (message := webtile.get_message()) != None: - pass - - webtile.start_game_seeded("dcss-0.31", "158985", True, "b", "f", "b") - - msgs = None - while (message := webtile.get_message()) != None: - json_message = json.loads(message) - if json_message["msg"] == "msgs": - msgs = json_message - break - - found = False - for msg in msgs["messages"]: - if "Game seed: 158985 (custom seed)" in msg["text"]: - found = True - break - - assert found - - webtile.quit_game() - - while (message := webtile.get_message()) != None: - pass - - webtile.disconnect() - - -def test_start_game_seeded_0_32(): - reset_test("Username", "dcss-0.32") - - # Connect to DCSS Webtile - webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") - - while (message := webtile.get_message()) != None: - pass - - webtile.login_with_credentials("Username", "Password") - - while (message := webtile.get_message()) != None: - pass - - webtile.start_game_seeded("dcss-0.32", "1", True, "b", "f", "b") - - msgs = None - while (message := webtile.get_message()) != None: - json_message = json.loads(message) - if json_message["msg"] == "msgs": - msgs = json_message - break - - found = False - for msg in msgs["messages"]: - if "Game seed: 1 (custom seed)" in msg["text"]: - found = True - break - - assert found - - webtile.quit_game() - - while (message := webtile.get_message()) != None: - pass - - webtile.disconnect() - - webtile = dcss_api.WebtilePy("ws://localhost:8080/socket", 0, "0.32") - - while (message := webtile.get_message()) != None: - pass - - webtile.login_with_credentials("Username", "Password") - - while (message := webtile.get_message()) != None: - pass - - webtile.start_game_seeded("dcss-0.32", "158985", True, "b", "f", "b") - - msgs = None - while (message := webtile.get_message()) != None: - json_message = json.loads(message) - if json_message["msg"] == "msgs": - msgs = json_message - break - - found = False - for msg in msgs["messages"]: - if "Game seed: 158985 (custom seed)" in msg["text"]: - found = True - break - - assert found - - webtile.quit_game() - - while (message := webtile.get_message()) != None: - pass - - webtile.disconnect() \ No newline at end of file From 6646ba5f653e0b5f26d6e0bbf3b830e90b94e1ae Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Wed, 12 Mar 2025 18:10:14 -0400 Subject: [PATCH 26/29] Fix missing versions --- Justfile | 4 + crawl-config/config.py | 439 ++++-------------------------------- crawl-config/init-player.sh | 82 +++---- 3 files changed, 95 insertions(+), 430 deletions(-) diff --git a/Justfile b/Justfile index 7602028..219c121 100644 --- a/Justfile +++ b/Justfile @@ -30,6 +30,10 @@ setup-dcss-server: sed -i -e 's/import subprocess/import signal as signal_module/g' ./crawl/server/webtiles/process_handler.py cp ./crawl-config/config.py ./crawl/server/config.py cp ./crawl-config/init-player.sh ./crawl/server/init-player.sh + echo save_dir = ./crawl/server/saves-0.29 > ./crawl/server/init-0.29.txt + echo save_dir = ./crawl/server/saves-0.30 > ./crawl/server/init-0.30.txt + echo save_dir = ./crawl/server/saves-0.31 > ./crawl/server/init-0.31.txt + echo save_dir = ./crawl/server/saves-0.32 > ./crawl/server/init-0.32.txt rm -rf ./crawl/main diff --git a/crawl-config/config.py b/crawl-config/config.py index 63ae1ba..6ef4f4f 100644 --- a/crawl-config/config.py +++ b/crawl-config/config.py @@ -1,239 +1,77 @@ -# ### Server Operators ### -# If you want to customise any settings in this file, you'll need to work around -# the fact that is version controlled. Some options: -# 1. Use a local commit and always do a rebase pull on top of it. (This may -# affect versioning, though.) -# 2. Create config.yml and write your overrides in there. -# 3. Use a more complicated scripting system; for example, dgamelaunch-config -# supports templating this file and automatically handles merging the -# server config with the repository files. -# -# ### Developers ### -# Warning! Servers will not update or merge with the version controlled copy of -# this file, so any parameters here should be presented as recommendations or -# documentation of the default, not a default value, and option name changes -# here will require manual intervention on the part of server admins. New -# values should always come with a default that does not lead to crashes, so -# that something sensible happens on DGL upgrade. -# -# To add new default values, see the `webtiles.config` module. Note that -# webtiles.config.get(x) returns `None` if `x` is not present in the config -# data, so this can be taken as a default default value. -# -# Bad assumptions about config defaults particularly impacts templated html -# files, which are loaded and called dynamically, so *do* get updated -# immediately on a rebuild (unlike python code in this module or -# webtiles.config). If something like client.html raises an exception, this -# will trigger 500 errors across the whole server. - import logging import os - +import collections import yaml -# Where to look for `games.d/`, `config.yml`, and other things. server_path = os.path.dirname(os.path.abspath(__file__)) -# Set to False to enable `local webtiles` mode: the regular webtiles lobby -# is disabled, and opening webtiles loads the game main menu. (default: True) -# dgl_mode = False - -# to enable ttyrec writing at the server level: -# enable_ttyrecs = False - -# set `bind_nonsecure` to False to use only SSL. Set to `"redirect"` to bind -# the nonsecure ports as indicated, but redirect them to an SSL port. bind_nonsecure = True bind_address = "" bind_port = 8080 -# Or listen on multiple address/port pairs (overriding the above) with: -# bind_pairs = ( -# ("127.0.0.1", 8080), -# ("localhost", 8082), -# ("", 8180), # All addresses -# ) - -# set `ssl_options` to Tornado ssl options in order to use ssl on the specified -# port. For a real deployment, in addition to certfile/keyfile as below, you -# will probably need to provide "ca_certs" with your full CA cert chain. -# The server needs read access to keyfile when accepting new connections, so -# it should be readable by the user running the server (not just root). -# -# For local testing, you can generate a self-signed cert with a command like: -# ``` -# openssl req -x509 -out localhost.crt -keyout localhost.key \ -# -newkey rsa:2048 -nodes -sha256 \ -# -subj '/CN=localhost' -extensions EXT -config <( \ -# printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth") -# ``` -# (this sort of cert will generate security warnings in modern browsers, so it -# is appropriate only for development use) - ssl_options = None # No SSL -# ssl_options = { -# "certfile": "./webserver/localhost.crt", -# "keyfile": "./webserver/localhost.key" -# } ssl_address = "" ssl_port = 8443 -# Or listen on multiple address/port pairs (overriding the above) with: -# ssl_bind_pairs = ( -# ("127.0.0.1", 8081), -# ("localhost", 8083), -# ) - -# to log to a file directly, uncomment and add something like: -# "filename": "webtiles.log", -# logging_config = { -# "level": logging.INFO, -# "format": "%(asctime)s %(levelname)s: %(message)s" -# } - -# sometimes useful for debugging: -# logging.getLogger('asyncio').setLevel(logging.DEBUG) - password_db = "./crawl/server/passwd.db3" -# Uncomment and change if you want this db somewhere separate from the -# password_db location. -#settings_db = "./webserver/user_settings.db3" static_path = "./crawl/server/static" template_path = "./crawl/server/templates/" -# Path for server-side unix sockets (to be used to communicate with crawl) -# server_socket_path = None # None: Uses global temp dir - -# Server name, so far only used in the ttyrec metadata server_id = "" -# Disable caching of game data files game_data_no_cache = True -# Watch socket dirs for games not started by the server -# watch_socket_dirs = False - -################ -# Game configs -################ -# -# The webtiles server needs some game modes configured in order to run. The -# default in-repo configuration enables regular mode, seeded, tutorial, and -# sprint for the `crawl` binary as built in the repository. (Build with -# `WEBTILES=y`.) -# -# You can define game configs in two ways: -# 1. As *.yml files in `games.d/`. (default; see games.d/base.yml) -# 2. With a dictionary `games` in this file -# -# Both of these formats are essentially the same. See the commented examples -# below, as well as the comments and examples in games.d/base.yml for more -# information on the format and how it is used. Examples from production -# servers are also available in branches of the repository: -# https://github.com/crawl/dgamelaunch-config -# (These are further templated using the scripts in that package.) - -# to override yml loading, simply set `games` in this file; see the example -# below. To force using both sources, set `use_game_yaml` to True. Games -# defined in this file will precede games defined in games.d. Templates -# defined in this file are always loaded. -# use_game_yaml = True - -# Templating game configurations: -# You can define a set of parameters to use as a template across multiple -# game configs. To use a template by name, use the `template` parameter. -# Recursive templating is supported. If a template named `default` is defined, -# it will be used as the template for any game definitions that specify no -# template at all (see example below). If `default` is defined, it can be -# explicitly overridden by using the template name `base` (which cannot be -# redefined). - -# Templating string values: -# if the `version` key is set, most game parameters will support templating -# with %v, %V, and %r. -# %v: the version value as-is -# %V: the capitalized version value (e.g. "trunk" -> "Trunk") -# %r: the 'raw' version, which strips off an initial "0.". So for example, -# "0.29" would give just "29". If this substring does not occur, %r -# is equivalent to %v. (Implementation note: characters before a "0." -# will be dropped as well. Not relevant for normal crawl versions of -# course.) -# -# Most fields (though not all, in particular, not any game-general ones and -# not socket_path) also support templating with %n, which gives the player's -# username. -# -# The bare minimum necessary fields are what it takes to get the crawl binary -# running. Games are called with the following argv; some of these fields can -# be inferred when not set. -# [ -# $crawl_binary, -# *$pre_options, -# "-name", "%n", -# "-rc", "$rcfile_path/%n.rc", -# "-macro", "$macro_path/%n.macro", -# "-morgue", "$morgue_path," -# *$options, -# "-dir", "$dir_path" -# "-webtiles-socket", "$socket_path/%n:$timestamp.sock", -# "-await-connection" -# ] -# -# The example below illustrates basic uses of both of these. - -# Non-templated example: it's possible just to set every field directly. -import collections games = collections.OrderedDict([ - # ("dcss-0.29", dict( - # version = "0.29", - # name = "Play 0.29", - # crawl_binary = "./crawl/dcss-0.29/crawl-ref/source/crawl", - # rcfile_path = "./crawl/server/rcs-0.29/", - # macro_path = "./crawl/server/rcs-0.29/", - # morgue_path = "./crawl/server/rcs-0.29/%n", - # inprogress_path = "./crawl/server/rcs-0.29/running", - # ttyrec_path = "./crawl/server/rcs-0.29/ttyrecs/%n", - # socket_path = "./crawl/server/rcs-0.29/", - # client_path = "./crawl/dcss-0.29/crawl-ref/source/webserver/game_data/", - # morgue_url = None, - # show_save_info = True, - # allowed_with_hold = True, - # options = ["-seed"], - # )), - # ("dcss-0.30", dict( - # version = "0.30", - # name = "Play 0.30", - # crawl_binary = "./crawl/dcss-0.30/crawl-ref/source/crawl", - # rcfile_path = "./crawl/server/rcs-0.30/", - # macro_path = "./crawl/server/rcs-0.30/", - # morgue_path = "./crawl/server/rcs-0.30/%n", - # inprogress_path = "./crawl/server/rcs-0.30/running", - # ttyrec_path = "./crawl/server/rcs-0.30/ttyrecs/%n", - # socket_path = "./crawl/server/rcs-0.30/", - # client_path = "./crawl/dcss-0.30/crawl-ref/source/webserver/game_data/", - # morgue_url = None, - # show_save_info = True, - # allowed_with_hold = True, - # options = ["-seed"], - # )), - # ("dcss-0.31", dict( - # version = "0.31", - # name = "Play 0.31", - # crawl_binary = "./crawl/dcss-0.31/crawl-ref/source/crawl", - # rcfile_path = "./crawl/server/rcs-0.31/", - # macro_path = "./crawl/server/rcs-0.31/", - # morgue_path = "./crawl/server/rcs-0.31/%n", - # inprogress_path = "./crawl/server/rcs-0.31/running", - # ttyrec_path = "./crawl/server/rcs-0.31/ttyrecs/%n", - # socket_path = "./crawl/server/rcs-0.31/", - # client_path = "./crawl/dcss-0.31/crawl-ref/source/webserver/game_data/", - # morgue_url = None, - # show_save_info = True, - # allowed_with_hold = True, - # options = ["-seed"], - # )), + ("dcss-0.29", dict( + version = "0.29", + name = "Play 0.29", + crawl_binary = "./crawl/dcss-0.29/crawl-ref/source/crawl", + rcfile_path = "./crawl/server/rcs-0.29/", + macro_path = "./crawl/server/rcs-0.29/", + morgue_path = "./crawl/server/rcs-0.29/%n", + inprogress_path = "./crawl/server/rcs-0.29/running", + ttyrec_path = "./crawl/server/rcs-0.29/ttyrecs/%n", + socket_path = "./crawl/server/rcs-0.29/", + client_path = "./crawl/dcss-0.29/crawl-ref/source/webserver/game_data/", + morgue_url = None, + show_save_info = True, + allowed_with_hold = True, + options = ["-seed"], + )), + ("dcss-0.30", dict( + version = "0.30", + name = "Play 0.30", + crawl_binary = "./crawl/dcss-0.30/crawl-ref/source/crawl", + rcfile_path = "./crawl/server/rcs-0.30/", + macro_path = "./crawl/server/rcs-0.30/", + morgue_path = "./crawl/server/rcs-0.30/%n", + inprogress_path = "./crawl/server/rcs-0.30/running", + ttyrec_path = "./crawl/server/rcs-0.30/ttyrecs/%n", + socket_path = "./crawl/server/rcs-0.30/", + client_path = "./crawl/dcss-0.30/crawl-ref/source/webserver/game_data/", + morgue_url = None, + show_save_info = True, + allowed_with_hold = True, + options = ["-seed"], + )), + ("dcss-0.31", dict( + version = "0.31", + name = "Play 0.31", + crawl_binary = "./crawl/dcss-0.31/crawl-ref/source/crawl", + rcfile_path = "./crawl/server/rcs-0.31/", + macro_path = "./crawl/server/rcs-0.31/", + morgue_path = "./crawl/server/rcs-0.31/%n", + inprogress_path = "./crawl/server/rcs-0.31/running", + ttyrec_path = "./crawl/server/rcs-0.31/ttyrecs/%n", + socket_path = "./crawl/server/rcs-0.31/", + client_path = "./crawl/dcss-0.31/crawl-ref/source/webserver/game_data/", + morgue_url = None, + show_save_info = True, + allowed_with_hold = True, + options = ["-seed"], + )), ("dcss-0.32", dict( version = "0.32", name = "Play 0.32", @@ -254,162 +92,16 @@ dgl_status_file = "./crawl/server/status" -# Extra paths to tail for milestone updates. This is a legacy setting, you -# should use `milestone_path` or `dir_path` for each game in the games dict. -# (This setting can be a string or list of strings.) -# milestone_file = ["./milestones"] - -# status_file_update_rate = 30 -# lobby_update_rate = 2 - -# recording_term_size = (80, 24) - -# max_connections = 100 - -# Script to initialize a user, e.g. make sure the paths -# and the rc file exist. This is not done by the server -# at the moment. This value init_player_program = "./crawl/server/init-player.sh" -# how often to check for an active connection while playing; this has an effect -# on how often a connection is checked for basic life, as well as the following -# two idle timer settings. -# connection_timeout = 10 * 60 - -# the maximum allowed idle time while playing. This timer is checked in -# intervals determined by `connection_timout`, so values will essentially be -# rounded up to that setting -# max_idle_time = 5 * 60 * 60 - -# the maximum allowed idle time in the lobby. Negative values will disable the -# lobby idle timer. This timer is rounded up to the value of the -# `connection_timeout` setting, similar to `max_idle_time`. -# max_lobby_idle_time = 3 * 60 * 60 - -# use_gzip = True - -# Seconds until stale HTTP connections are closed -# This corresponds to the tornado parameter `idle_connection_timeout`, which -# will automatically close idle http connections that do not respond after a -# period of time. Setting this to `None` gives the tornado default (1 hour). -# This setting usually does not affect websockets connections, which use the -# above webtiles-internal timeouts. -# http_connection_timeout = None - -# Set this to true if you are behind a reverse proxy -# Your proxy must set header X-Real-IP -# -# Enabling this option when webtiles is NOT protected behind a reverse proxy -# introduces a security risk. An attacker could inject a false address into the -# X-Real-IP header. Do not enable this option if the webtiles server is -# directly exposed to users. -# http_xheaders = None - -# kill_timeout = 10 # Seconds until crawl is killed after HUP is sent - -# max_passwd_length = 20 - -# Username management options. -# -# This options are used on a running webserver only for new account creation! -# It is possible to run a ban query against an existing userdb with them as -# well, see wtutil.py options --check-config-bans and --run-config-bans. For -# banning offensive names, skip to `banned` below. Crawl nicknames are case -# preserving but not case sensitive. To be an acceptable username, a string -# must pass all three of these checks (if defined). -# -# 1. Use `nick_regex` to modify the basic format for valid nicknames. -# a nick is allowed if it matches this regex. It is not recommended to modify -# this unless you really know what you're doing, and this default should not -# ever be modified to something less restrictive for official servers. -# nick_regex = r"^[a-zA-Z0-9]{3,20}$" -# -# 2. `nick_check_fun` if defined, is a function that returns true on valid -# nicknames. You can use this for arbitrary custom nick checks in a server -# config. You will need to do case management manually in this function. -# def nick_check_fun(s): -# return s.lower() != "plog" and s.lower() != "muggle" -# -# 3. For easily excluding a larger list of usernames from account creation, you -# can use the `banned` option. This can take a simple list of names, or some -# more complex things. Instead of or in addition to putting banned names in -# config, you can put them in files named `banned_players.txt` and -# `banned_players.yml`. The latter must have a single dict entry `banned` -# that is allowed to use the complex options below. -# -# Simple example: -# banned = ['plog', 'muggle', 'muggles', 'ihatemuggles'] -# -# Complex example. This will ban many things, for example, -# plain 'muggle', leetspeak variants like 'mugg13s', versions of the phrase -# embedded into other contexts with different letter repeats such as -# 'xx1hatemugggglesxx', etc. It is recommended to be fairly cautious when using -# these extended options, because of -# https://en.wikipedia.org/wiki/Scunthorpe_problem; there are very few English -# slurs where it is a good idea to turn on all three of these options. -# You can mix plain strings with complex entries, as shown here: -# -# banned = ['plog', -# {'options': {'leet': True, 'repeats': True, 'part': True}, -# 'names': ['muggle']}] -# it is allowed to mix in plain strings with dicts in this list, - -# Example to demonstrate this same list in yml form: -# banned: -# - plog -# - options: -# leet: True -# repeats: True -# part: True -# names: -# - muggle -# -# It is recommended to use an external file rather than defining this option -# directly in config. (Among other reasons, this means that server admins are -# only viewing/editing a file likely filled with slurs when they are actually -# intending to...) - -# Set to True to allow users to request a password reset email. Some settings -# must be properly configured for this to work: -# allow_password_reset = False -# Set to True to allow dgl admin users to generate password reset tokens in the -# admin panel. Only use if you really trust your admin users! -# admin_password_reset = False - -# Set to the primary URL where a player would reach the main lobby -# For example: "http://crawl.akrasiac.org/" -# This is required for for password reset, as it will be the base URL for -# recovery URLs. Use "http://localhost:8080/" for testing. lobby_url = "http://localhost:8080/" -# Proper SMTP settings are required for password reset to function properly. -# if smtp_host is anything other than `localhost`, you may need to adjust the -# timeout settings (see server.py, calls to ioloop.set_blocking_log_threshold). -# TODO: set_blocking_log_threshold is deprecated in tornado 5+... -# Ideally, test out these settings carefully in a non-production setting -# before enabling this, as there's a bunch of ways for this to go wrong and you -# don't want to get your SMTP server blocklisted. smtp_host = "localhost" smtp_port = 25 smtp_use_ssl = False smtp_user = "" # set to None for no auth smtp_password = "" -smtp_from_addr = "noreply@crawl.example.org" # The address from which automated - # emails will be sent - -# crypt() algorithm, e.g. "1" for MD5 or "6" for SHA-512; see crypt(3). If -# false, use traditional DES (but then only the first eight characters of the -# password are significant). If set to "broken", use traditional DES with -# the password itself as the salt; this is necessary for compatibility with -# dgamelaunch, but should be avoided if possible because it leaks the first -# two characters of the password's plaintext. -# crypt_algorithm = "broken" - -# The length of the salt string to use. If crypt_algorithm is false, this -# setting is ignored and the salt is two characters. -# crypt_salt_length = 16 - -# login_token_lifetime = 7 # Days +smtp_from_addr = "noreply@crawl.example.org" uid = None # If this is not None, the server will setuid to that (numeric) id gid = None # after binding its sockets. @@ -419,40 +111,9 @@ chroot = None pidfile = None -# daemon = False # If true, the server will detach from the session after startup -# Set to a URL with %s where lowercased player name should go in order to -# hyperlink WebTiles spectator names to their player pages. -# For example: "http://crawl.akrasiac.org/scoring/players/%s.html" -# Set to None to disable player page hyperlinks player_url = None -# set one of these for various moderation modes. Disabled preempts hold. In -# account hold mode, new accounts cannot use chat, cannot spectate, and do -# not appear in the lobby until explicitly approved by an admin. They can still -# play. (Of course, they can still log out and spectate as anon.) -# new_accounts_disabled = True -# new_accounts_hold = True - -# customize chat limits. Set to 0 or False to disable chat. Value in characters. -# max_chat_length = 1000 - -# If set to True, a SIGHUP triggers an attempt to reload the config and game -# data. Some values cannot be reloaded (including this one), and to reset a -# value to its default, you need to explicitly set the value rather than -# comment it out. -# If not explicitly set, this defaults to False. hup_reloads_config = True -# set to do periodic logging of user load -# load_logging_rate = 10 # seconds, set to 0 to explicitly disable -# slow_callback_alert = 0.25 # seconds, set to None to explicitly disable - -# Only for development: -# This is insecure; do not set development_mode = True in production! -# development_mode = False - -# Disable caching of static files which are not part of game data. -# no_cache = development_mode -# Automatically log in all users with the username given here. autologin = None diff --git a/crawl-config/init-player.sh b/crawl-config/init-player.sh index d3dae76..b134810 100755 --- a/crawl-config/init-player.sh +++ b/crawl-config/init-player.sh @@ -1,46 +1,46 @@ #!/bin/sh -# RCDIR=./crawl/server/rcs-0.29/ -# INPROGRESSDIR=./crawl/server/rcs-0.29/running -# TTYRECDIR=./crawl/server/rcs-0.29/ttyrecs/$1 -# DEFAULT_RC=./crawl/server/init-0.29.txt -# PLAYERNAME=$1 - -# mkdir -p $RCDIR -# mkdir -p $INPROGRESSDIR -# mkdir -p $TTYRECDIR - -# if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then -# cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc -# fi - -# RCDIR=./crawl/server/rcs-0.30/ -# INPROGRESSDIR=./crawl/server/rcs-0.30/running -# TTYRECDIR=./crawl/server/rcs-0.30/ttyrecs/$1 -# DEFAULT_RC=./crawl/server/init-0.30.txt -# PLAYERNAME=$1 - -# mkdir -p $RCDIR -# mkdir -p $INPROGRESSDIR -# mkdir -p $TTYRECDIR - -# if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then -# cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc -# fi - -# RCDIR=./crawl/server/rcs-0.31/ -# INPROGRESSDIR=./crawl/server/rcs-0.31/running -# TTYRECDIR=./crawl/server/rcs-0.31/ttyrecs/$1 -# DEFAULT_RC=./crawl/server/init-0.31.txt -# PLAYERNAME=$1 - -# mkdir -p $RCDIR -# mkdir -p $INPROGRESSDIR -# mkdir -p $TTYRECDIR - -# if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then -# cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc -# fi +RCDIR=./crawl/server/rcs-0.29/ +INPROGRESSDIR=./crawl/server/rcs-0.29/running +TTYRECDIR=./crawl/server/rcs-0.29/ttyrecs/$1 +DEFAULT_RC=./crawl/server/init-0.29.txt +PLAYERNAME=$1 + +mkdir -p $RCDIR +mkdir -p $INPROGRESSDIR +mkdir -p $TTYRECDIR + +if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then + cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc +fi + +RCDIR=./crawl/server/rcs-0.30/ +INPROGRESSDIR=./crawl/server/rcs-0.30/running +TTYRECDIR=./crawl/server/rcs-0.30/ttyrecs/$1 +DEFAULT_RC=./crawl/server/init-0.30.txt +PLAYERNAME=$1 + +mkdir -p $RCDIR +mkdir -p $INPROGRESSDIR +mkdir -p $TTYRECDIR + +if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then + cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc +fi + +RCDIR=./crawl/server/rcs-0.31/ +INPROGRESSDIR=./crawl/server/rcs-0.31/running +TTYRECDIR=./crawl/server/rcs-0.31/ttyrecs/$1 +DEFAULT_RC=./crawl/server/init-0.31.txt +PLAYERNAME=$1 + +mkdir -p $RCDIR +mkdir -p $INPROGRESSDIR +mkdir -p $TTYRECDIR + +if [ ! -f ${RCDIR}/${PLAYERNAME}.rc ]; then + cp ${DEFAULT_RC} ${RCDIR}/${PLAYERNAME}.rc +fi RCDIR=./crawl/server/rcs-0.32/ INPROGRESSDIR=./crawl/server/rcs-0.32/running From b449106148bbbc3dd05151a59ea0ee415697795b Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Wed, 12 Mar 2025 19:10:43 -0400 Subject: [PATCH 27/29] Test stuck between years --- dcss-scenario-builder/tests/test_wizmode.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcss-scenario-builder/tests/test_wizmode.rs b/dcss-scenario-builder/tests/test_wizmode.rs index f913543..53e44d1 100644 --- a/dcss-scenario-builder/tests/test_wizmode.rs +++ b/dcss-scenario-builder/tests/test_wizmode.rs @@ -42,7 +42,7 @@ fn verify_wizmode() -> Result<(), Error> { && message.as_object().unwrap().contains_key("wizard") && message["wizard"].as_u64().unwrap() == 1 { - // webtile.quit_game()?; + webtile.quit_game()?; webtile.disconnect().expect("Failed"); return Ok(()); } From e35fe4bf0049098d57c62ed5a9cdd57376064926 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Wed, 12 Mar 2025 20:03:08 -0400 Subject: [PATCH 28/29] No "source" on GH Action --- Justfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Justfile b/Justfile index 219c121..1ec069b 100644 --- a/Justfile +++ b/Justfile @@ -77,14 +77,14 @@ setup-python: rm -rf ./dcss-api-python/pyo3 mkdir ./dcss-api-python/pyo3 python -m venv ./dcss-api-python/pyo3 - source ./dcss-api-python/pyo3/bin/activate && cd ./dcss-api-python/ && pip install maturin patchelf pytest - source ./dcss-api-python/pyo3/bin/activate && cd ./dcss-api-python/ && maturin develop -r + . ./dcss-api-python/pyo3/bin/activate && cd ./dcss-api-python/ && pip install maturin patchelf pytest + . ./dcss-api-python/pyo3/bin/activate && cd ./dcss-api-python/ && maturin develop -r test-python: - source ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.29 pytest ./dcss-api-python/tests - source ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.30 pytest ./dcss-api-python/tests - source ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.31 pytest ./dcss-api-python/tests - source ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.32 pytest ./dcss-api-python/tests + . ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.29 pytest ./dcss-api-python/tests + . ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.30 pytest ./dcss-api-python/tests + . ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.31 pytest ./dcss-api-python/tests + . ./dcss-api-python/pyo3/bin/activate && GAME_ID=dcss-0.32 pytest ./dcss-api-python/tests cargo-update: cd ./dcss-api && cargo update From 1caf36cad909f48f5d8779da9783092c924b6478 Mon Sep 17 00:00:00 2001 From: Eric Fecteau Date: Thu, 13 Mar 2025 16:22:03 -0400 Subject: [PATCH 29/29] Fix warning --- .github/workflows/build-and-test.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 39d31b2..ff4479a 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -16,13 +16,10 @@ jobs: uses: actions/checkout@v4 - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: rustfmt - default: true + uses: dtolnay/rust-toolchain@stable - - uses: extractions/setup-just@v2 + - name: Install Just + uses: extractions/setup-just@v2 - name: Install dependencies run: |