Skip to content

Commit

Permalink
Add headless and gymnasium client
Browse files Browse the repository at this point in the history
- Adds remote input / output over ZeroMQ.
- Adds a gymnasium client in python/minetester subdirectory, which uses the remote input / output.
- Adds headless rendering support. Build with -DBUILD_HEADLESS=TRUE and run with --headless. Only supported on Linux.
- Somewhat unrelated, but switches the CI to use conda packages for most dependencies.
  • Loading branch information
garymm authored Feb 14, 2024
2 parents fd5597a + bbbe3f4 commit b4f270c
Show file tree
Hide file tree
Showing 71 changed files with 2,186 additions and 306 deletions.
4 changes: 4 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM ubuntu:22.04

RUN apt-get update -y && \
apt-get install -y g++ git libgl1-mesa-dev mold
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
{
"build": {
"dockerfile": "Dockerfile"
},
"runArgs": [
// Allows debuggers to disable ASLR
// "--privileged"
],
"customizations": {
"vscode": {
"extensions": [
"charliermarsh.ruff",
"llvm-vs-code-extensions.vscode-clangd",
"ms-python.python",
"ms-vscode.cmake-tools",
"vadimcn.vscode-lldb"
]
}
},
"features": {
"ghcr.io/rocker-org/devcontainer-features/miniforge:1": {}
},
"postCreateCommand": "bash -c 'mamba init && mamba env create'"
}
56 changes: 0 additions & 56 deletions .github/workflows/android.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .github/workflows/cpp_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ jobs:
source ./util/ci/common.sh
install_linux_deps $CLANG_TIDY
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'
mamba-version: "*"
channels: conda-forge,nodefaults
activate-environment: minetest
environment-file: environment.yml

- name: Run clang-tidy
shell: bash -l {0}
run: |
./util/ci/clang-tidy.sh
104 changes: 93 additions & 11 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,17 @@ jobs:
source ./util/ci/common.sh
install_linux_deps g++-7
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'
mamba-version: "*"
channels: conda-forge,nodefaults
activate-environment: minetest
environment-file: environment.yml

- name: Build
# Needed so conda environment is active
shell: bash -l {0}
run: |
./util/ci/build.sh
env:
Expand All @@ -64,7 +74,17 @@ jobs:
source ./util/ci/common.sh
install_linux_deps g++-12 libluajit-5.1-dev
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'
mamba-version: "*"
channels: conda-forge,nodefaults
activate-environment: minetest
environment-file: environment.yml

- name: Build
# Needed so conda environment is active
shell: bash -l {0}
run: |
./util/ci/build.sh
env:
Expand All @@ -85,12 +105,23 @@ jobs:
source ./util/ci/common.sh
install_linux_deps clang-7 valgrind
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'
mamba-version: "*"
channels: conda-forge,nodefaults
activate-environment: minetest
environment-file: environment.yml

- name: Build
# Needed so conda environment is active
shell: bash -l {0}
run: |
./util/ci/build.sh
env:
CC: clang-7
CXX: clang++-7
CMAKE_FLAGS: "-DENABLE_CURSES=FALSE"

- name: Unittest
run: |
Expand All @@ -110,7 +141,17 @@ jobs:
source ./util/ci/common.sh
install_linux_deps clang-14 gdb
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'
mamba-version: "*"
channels: conda-forge,nodefaults
activate-environment: minetest
environment-file: environment.yml

- name: Build
# Needed so conda environment is active
shell: bash -l {0}
run: |
./util/ci/build.sh
env:
Expand All @@ -125,6 +166,46 @@ jobs:
run: |
./util/test_multiplayer.sh
pytest:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
source ./util/ci/common.sh
install_linux_deps clang-14
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'
mamba-version: "*"
channels: conda-forge,nodefaults
activate-environment: minetest
environment-file: environment.yml

- name: Build
# Needed so conda environment is active
shell: bash -l {0}
run: |
./util/ci/build.sh
env:
CC: clang-14
CXX: clang++-14

- name: Run pytest
# Needed so conda environment is active
shell: bash -l {0}
run: |
cd python
set +o errexit
timeout --signal=KILL 5m pytest -v
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "test failed, printing minetest logs"
find artifacts/log -type f -name '*.log' -exec cat {} \;
fi
exit $exit_code
# Build with prometheus-cpp (server-only)
clang_9_prometheus:
name: "clang_9 (PROMETHEUS=1)"
Expand All @@ -136,28 +217,29 @@ jobs:
source ./util/ci/common.sh
install_linux_deps clang-9
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'
mamba-version: "*"
channels: conda-forge,nodefaults
activate-environment: minetest
environment-file: environment.yml

- name: Build prometheus-cpp
shell: bash -l {0}
run: |
./util/ci/build_prometheus_cpp.sh
- name: Build
# Needed so conda environment is active
shell: bash -l {0}
run: |
./util/ci/build.sh
env:
CC: clang-9
CXX: clang++-9
CMAKE_FLAGS: "-DENABLE_PROMETHEUS=1 -DBUILD_CLIENT=0"
CMAKE_FLAGS: "-DENABLE_PROMETHEUS=1 -DBUILD_CLIENT=0 -DENABLE_CURSES=FALSE"

- name: Test
run: |
./bin/minetestserver --run-unittests
docker:
name: "Docker image"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Build docker image
run: |
docker build . -t minetest:latest
docker run --rm minetest:latest /usr/local/bin/minetestserver --version
11 changes: 10 additions & 1 deletion .github/workflows/lua.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,18 @@ jobs:
- name: Install deps
run: |
source ./util/ci/common.sh
install_linux_deps clang-10 gdb libluajit-5.1-dev
install_linux_deps clang-10 gdb
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'
mamba-version: "*"
channels: conda-forge,nodefaults
activate-environment: minetest
environment-file: environment.yml

- name: Build
shell: bash -l {0}
run: |
./util/ci/build.sh
env:
Expand Down
44 changes: 22 additions & 22 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,37 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'
mamba-version: "*"
channels: conda-forge,nodefaults
activate-environment: minetest
environment-file: environment.yml

- name: Install deps
run: |
source ./util/ci/common.sh
install_macos_deps
- name: Build
shell: bash -l {0}
run: |
git clone https://github.com/minetest/irrlicht lib/irrlichtmt --depth 1 -b $(cat misc/irrlichtmt_tag.txt)
mkdir build
cd build
cmake .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
cmake -B build -S . \
-DCMAKE_FIND_FRAMEWORK=LAST \
-DCMAKE_INSTALL_PREFIX=../build/macos/ \
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \
-DINSTALL_DEVTEST=TRUE
cmake --build . -j$(sysctl -n hw.logicalcpu)
make install
-DCMAKE_INSTALL_PREFIX=build/macos/ \
-DRUN_IN_PLACE=FALSE \
-DENABLE_GETTEXT=TRUE \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_HEADLESS=FALSE \
-GNinja \
-DINSTALL_DEVTEST=TRUE \
-DICONV_LIBRARY="${CONDA_PREFIX}/lib/libiconv.dylib" \
-DCMAKE_INSTALL_RPATH="${CONDA_PREFIX}/lib"
cmake --build build
cmake --install build
- name: Test
run: |
./build/macos/minetest.app/Contents/MacOS/minetest --run-unittests
# Zipping the built .app preserves permissions on the contained files,
# which the GitHub artifact pipeline would otherwise strip away.
- name: CPack
run: |
cd build
cpack -G ZIP -B macos
- uses: actions/upload-artifact@v3
with:
name: minetest-macos
path: ./build/macos/*.zip
Loading

0 comments on commit b4f270c

Please sign in to comment.