diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6420262 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,66 @@ +# Primary workflow for building, testing, and deploying the Toontown Classic OTP server packages +name: Toontown Classic OTP CI +on: + # Release a new static anytime a release change is published to the repository + push: + branches: + - '*' # matches every branch that doesn't contain a '/' + - '*/*' # matches every branch containing a single '/' + - '**' # matches every branch + - '!gh-pages' # excludes gh-pages + + # Create a latest image and deploy changes to Github Pages on a version publish + release: + types: [published] + + # Allow manual deployments from Github's UI/API + workflow_dispatch: + +# Define workflow constants as environment variables +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + # Publishes the download server Docker images to all supported repositories + push_to_registries: + name: Push Docker Images + + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Define the job's permissions + permissions: + packages: write + contents: read + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out the release branch of the repository under $GITHUB_WORKSPACE + - name: Check out the repo + uses: actions/checkout@v2 + + # Authenticate with the Github packages registry prior to staticing/pushing + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata about this job execution and pack it into the various outgoing Docker images + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Deploy our created Docker images to the supported registries + - name: build and push Docker images + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6acfdb4..9322890 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,7 @@ databases/ # Other resources/ + +# Allow contents of .github +!.github/ +!.github/**/*.yml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d394168 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM python:2.7.18 + +# Copy server and resource directories into Docker image +COPY . /server +WORKDIR /server + +# Install our pip dependencies +RUN pip install -r requirements.txt + +# Expose our networking ports +EXPOSE 6667 +EXPOSE 7100 + +# Start the OTP application +ENTRYPOINT ["python"] +CMD ["-m", "realtime"] \ No newline at end of file diff --git a/linux/start_otp.sh b/linux/start_otp.sh index 5c49154..60972ab 100644 --- a/linux/start_otp.sh +++ b/linux/start_otp.sh @@ -1,3 +1,3 @@ #!/bin/sh cd .. -/usr/bin/python2 -m realtime.main +/usr/bin/python2 -m realtime diff --git a/linux/start_otp_screen.sh b/linux/start_otp_screen.sh index 18e118f..1dfa231 100644 --- a/linux/start_otp_screen.sh +++ b/linux/start_otp_screen.sh @@ -1,4 +1,4 @@ #!/bin/sh cd .. -screen python -m realtime.main --no-clientagent --no-stateserver --no-database -screen python -m realtime.main --no-messagedirector +screen python -m realtime --no-clientagent --no-stateserver --no-database +screen python -m realtime --no-messagedirector diff --git a/realtime/main.py b/realtime/__main__.py similarity index 100% rename from realtime/main.py rename to realtime/__main__.py diff --git a/requirements.txt b/requirements.txt index 1eaf39f..220c567 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ semidbm simplejson pyyaml pytoml +panda3d \ No newline at end of file diff --git a/win32/start_otp.bat b/win32/start_otp.bat index 467cc4d..a8dc952 100644 --- a/win32/start_otp.bat +++ b/win32/start_otp.bat @@ -1,19 +1,8 @@ @echo off - -rem Choose correct python command to execute the OTP -rem ppythona -h >nul 2>&1 && ( -rem set PYTHON_CMD=ppythona -rem ) || ( -rem set PYTHON_CMD=ppython -rem ) - -rem A Temporary Solution as you HAVE to use a 64 bit Panda with the current database. -set PYTHON_CMD=C:\Panda3D-1.11.0-x64-astron\python\ppython.exe - +title Toontown Classic - OTP cd ../ -rem Start the OTP using the PYTHON_CMD variable :main -%PYTHON_CMD% -m realtime.main +python -m realtime pause -goto :main +goto :main \ No newline at end of file