Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
jhett12321 committed May 25, 2023
2 parents 947b09a + 1c0769b commit 46e5424
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 9 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,14 @@ jobs:
- name: Build
run: dotnet build --configuration Release

- name: Load Environment Variables
id: env_vars
uses: falti/dotenv-action@v0.2.7

- name: Run Tests
run: docker-compose --env-file ../../../.env up
run: |
docker-compose build --build-arg NWNX_VERSION=${{ steps.env_vars.outputs.nwnx_version }} --build-arg BINARY_PATH=NWN.Anvil/bin/Release/net7.0
docker-compose up
working-directory: NWN.Anvil.Tests/bin/Release/

- name: Install NUnit
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## 8193.35.1
https://github.com/nwn-dotnet/Anvil/compare/v8193.35.0...v8193.35.1

### Fixed
- (Docker) Fixed an issue with libssl dependency.

## 8193.35.0
https://github.com/nwn-dotnet/Anvil/compare/v8193.34.28...v8193.35.0

Expand Down
5 changes: 3 additions & 2 deletions NWN.Anvil.Tests/src/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
version: '3'
services:
anvil:
image: "nwnxee/unified:${NWNX_VERSION}"
build:
context: ${PWD-.}/../../../
dockerfile: ${PWD-.}/../../../dockerfile
env_file:
- ${PWD-.}/config/nwserver.env
volumes:
- ${PWD-.}/../../../NWN.Anvil/bin/Release/net7.0:/nwn/anvil
- ${PWD-.}/NWN.Anvil.Tests:/nwn/run/anvil/Plugins/NWN.Anvil.Tests
- ${PWD-.}/../../../NWN.Anvil.TestRunner/bin/Release/NWN.Anvil.TestRunner:/nwn/run/anvil/Plugins/NWN.Anvil.TestRunner
- ${PWD-.}/results:/nwn/run/anvil/PluginData/NWN.Anvil.TestRunner
20 changes: 20 additions & 0 deletions NWN.Anvil.Tests/src/main/System/HttpClientTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Net.Http;
using NUnit.Framework;

namespace Anvil.Tests.System
{
[TestFixture(Category = "TestRunner")]
public sealed class HttpClientTests
{
[Test]
[TestCase("http://github.com")]
[TestCase("https://github.com")]
public void InvokeHttpRequestIsSuccessful(string uri)
{
using HttpClient httpClient = new HttpClient();
HttpResponseMessage response = httpClient.Send(new HttpRequestMessage(HttpMethod.Get, uri));

Assert.That(response.IsSuccessStatusCode, Is.True, $"'{uri}' return a non-success code: {response.StatusCode}");
}
}
}
68 changes: 62 additions & 6 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
# Configure nwserver to run with nwnx
# Load nwnx image to import nwserver + nwnx plugins
ARG NWNX_VERSION
FROM nwnxee/unified:${NWNX_VERSION}
FROM nwnxee/unified:${NWNX_VERSION} as nwnx

# Remove incompatible plugins
RUN rm -rf /nwn/nwnx/NWNX_Ruby.so \
/nwn/nwnx/NWNX_SpellChecker.so \
/nwn/nwnx/NWNX_Redis.so

FROM ubuntu:20.04

COPY --from=nwnx /nwn /nwn

RUN apt-get update \
&& apt-get --no-install-recommends -y install ca-certificates wget \
&& wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
&& apt-get update \
&& apt-get --no-install-recommends -y install libc6 libstdc++6 \
hunspell \
default-libmysqlclient-dev \
libmariadb3 \
libpq5 \
libsqlite3-0 \
luajit libluajit-5.1-2 \
inotify-tools \
patch \
unzip \
dotnet-runtime-7.0 \
dotnet-apphost-pack-7.0 \
&& rm -rf /var/cache/apt /var/lib/apt/lists/*

# Copy Anvil Binaries
ARG BINARY_PATH
COPY ${BINARY_PATH} /nwn/anvil/

Expand All @@ -11,11 +41,37 @@ ENV ANVIL_IMAGE=1
# Set which kill signal to exit upon
STOPSIGNAL SIGINT

# Enable and configure DotNET plugins + dependencies
# Patch run-server.sh with our modifications
COPY ./scripts/run-server.patch /nwn
RUN patch /nwn/run-server.sh < /nwn/run-server.patch

# User Data
VOLUME /nwn/home

# Configure nwserver to run with nwnx
ENV NWNX_CORE_LOAD_PATH=/nwn/nwnx/
ENV NWN_LD_PRELOAD="/nwn/nwnx/NWNX_Core.so"

# Configure nwnx to run with anvil
ENV NWNX_DOTNET_SKIP=n
ENV NWNX_SWIG_DOTNET_SKIP=n
ENV NWNX_DOTNET_ASSEMBLY=/nwn/anvil/NWN.Anvil

# Patch run-server.sh with our modifications
COPY ./scripts/run-server.patch /nwn
RUN patch /nwn/run-server.sh < /nwn/run-server.patch
# Use NWNX_ServerLogRedirector as default log manager
ENV NWNX_SERVERLOGREDIRECTOR_SKIP=n
ENV NWN_TAIL_LOGS=n
ENV NWNX_CORE_LOG_LEVEL=6
ENV NWNX_SERVERLOGREDIRECTOR_LOG_LEVEL=6

# Disable all other plugins by default.
ENV NWNX_CORE_SKIP_ALL=y

# Entrypoint & Executable
EXPOSE ${NWN_PORT:-5121}/udp

RUN chmod +x /nwn/data/bin/linux-amd64/nwserver
RUN chmod +x /nwn/run-server.sh
ENV NWN_EXTRA_ARGS="-userdirectory /nwn/run"

WORKDIR /nwn/data/bin/linux-amd64
ENTRYPOINT ["/bin/bash", "/nwn/run-server.sh"]

0 comments on commit 46e5424

Please sign in to comment.