Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
jhett12321 committed Jan 10, 2022
2 parents ad005d1 + ae878b0 commit ee657af
Show file tree
Hide file tree
Showing 95 changed files with 14,572 additions and 308 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NWN_VERSION=8193.34
NWNX_VERSION=790a54b
117 changes: 97 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,21 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Check Line Endings
uses: erclu/check-crlf@v1
with:
path: NWN.Anvil

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100

- name: Build
run: dotnet build --configuration Release /warnaserror
run: dotnet build --configuration Release

- name: Prepare Outputs
id: vars
Expand All @@ -64,10 +68,61 @@ jobs:
run: |
! grep "<Issue TypeId=" results.xml
test:
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100

- name: Build
run: dotnet build --configuration Release

- name: Run Tests
run: docker-compose --env-file ../../../.env up
working-directory: NWN.Anvil.Tests/bin/Release/

- name: Install NUnit
run: |
nuget install NUnit.Console -Version 3.12.0
- name: Fetch transform code
run: |
wget https://raw.githubusercontent.com/nunit/nunit-transforms/master/nunit3-junit/nunit3-junit.xslt
shell: bash

- name: Transform NUnit3 to JUnit
run: |
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform;
$xslt.Load("nunit3-junit.xslt");
$xslt.Transform("NWN.Anvil.Tests/bin/Release/results/NWN.Anvil.Tests/TestResult.xml", "TestResult.junit.xml");
shell: pwsh

- name: Upload Event File
uses: actions/upload-artifact@v2
if: always()
with:
name: Event File
path: ${{ github.event_path }}

- name: Upload Results
uses: actions/upload-artifact@v2
if: always()
with:
name: Test Results
path: TestResult.junit.xml

build:
runs-on: ubuntu-20.04
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: compile
needs: [compile, test]
outputs:
version: ${{ steps.vars.outputs.version }}
tag: ${{ steps.vars.outputs.tag }}
Expand All @@ -79,6 +134,7 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
Expand All @@ -102,29 +158,46 @@ jobs:
META=`echo $DESCRIBE | awk '{split($0,a,"-"); print a[2]}'`
BUILD=`echo $DESCRIBE | awk '{split($0,a,"-"); print a[3]}'`
COMMIT=`echo $DESCRIBE | awk '{split($0,a,"-"); print a[4]}'`
echo "::set-output name=version::$(echo ${VERSION}-${META}.${BUILD}.${COMMIT:1} | sed 's/^v//')"
echo "::set-output name=version::$(echo ${VERSION}-${META}.${BUILD}.r${COMMIT:1} | sed 's/^v//')"
fi
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=image_repository::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')"
- name: Build Release Binaries
id: build
run: |
dotnet build --configuration Release -p:Version=${{ steps.vars.outputs.version }} -o output
dotnet build --configuration Release -p:Version=${{ steps.vars.outputs.version }}
echo "::set-output name=created::$(echo date -u +'%Y-%m-%dT%H:%M:%SZ')"
- name: Upload NuGet Artifacts
uses: actions/upload-artifact@v2
with:
name: nuget-binaries
path: output/
name: NuGet Packages
path: |
NWN.Anvil/bin/Release/*.nupkg
NWN.Anvil/bin/Release/*.snupkg
NWN.Anvil.TestRunner/bin/Release/NWN.Anvil.TestRunner/*.nupkg
NWN.Anvil.TestRunner/bin/Release/NWN.Anvil.TestRunner/*.snupkg
if-no-files-found: error

- name: Upload Build Artifacts
- name: Upload Build Artifacts (Anvil)
uses: actions/upload-artifact@v2
with:
name: binaries
path: NWN.Anvil.zip
name: Binaries
path: |
NWN.Anvil/bin/Release/
!NWN.Anvil/bin/Release/*.nupkg
!NWN.Anvil/bin/Release/*.snupkg
if-no-files-found: error

- name: Upload Build Artifacts (Test Runner)
uses: actions/upload-artifact@v2
with:
name: Binaries (Test Runner)
path: |
NWN.Anvil.TestRunner/bin/Release/
!NWN.Anvil.TestRunner/bin/Release/NWN.Anvil.TestRunner/*.nupkg
!NWN.Anvil.TestRunner/bin/Release/NWN.Anvil.TestRunner/*.snupkg
if-no-files-found: error

release:
Expand All @@ -135,7 +208,12 @@ jobs:
- name: Download Release Artifacts
uses: actions/download-artifact@v2
with:
name: binaries
name: Binaries
path: binaries

- name: Zip Binaries
run: zip -r ../NWN.Anvil.zip ./*
working-directory: binaries

- name: Create Release
id: create_release
Expand Down Expand Up @@ -172,14 +250,14 @@ jobs:
- name: Download Release Artifacts
uses: actions/download-artifact@v2
with:
name: nuget-binaries
path: output
name: NuGet Packages
path: binaries

- name: NuGet Publish
run: dotnet nuget push output/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json
run: dotnet nuget push 'binaries/**/*.nupkg' --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json

- name: GitHub Publish
run: dotnet nuget push output/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/nwn-dotnet/index.json
run: dotnet nuget push 'binaries/**/*.nupkg' --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/nwn-dotnet/index.json

docker:
runs-on: ubuntu-20.04
Expand All @@ -188,15 +266,14 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Download Release Artifacts
uses: actions/download-artifact@v2
with:
name: nuget-binaries
path: output

- name: Remove NuGet packages
run: rm output/*nupkg
name: Binaries
path: binaries

- name: Login to DockerHub
uses: docker/login-action@v1
Expand All @@ -218,7 +295,7 @@ jobs:
context: ./
file: ./dockerfile
push: true
build-args: BINARY_PATH=/output
build-args: BINARY_PATH=/binaries
labels: |
org.opencontainers.image.title=Anvil
org.opencontainers.image.description=Anvil is a C# library that attempts to wrap Neverwinter Script with C# niceties and contexts, instead of a collection of functions. This image contains a NWNX server configured to use Anvil.
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish Test Results

on:
workflow_run:
workflows: ['Continuous Integration']
types:
- completed

jobs:
test-results:
name: Test Results
runs-on: ubuntu-20.04
if: github.event.workflow_run.conclusion != 'skipped'

steps:
- name: Download and Extract Artifacts
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
mkdir -p artifacts && cd artifacts
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
do
IFS=$'\t' read name url <<< "$artifact"
gh api $url > "$name.zip"
unzip -d "$name" "$name.zip"
done
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1.25
with:
check_name: "Test Results"
comment_title: "Test Results"
report_individual_runs: true
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/Test Results/**/*.xml"
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "NWN.Anvil.TestRunner/src/lib/nunit"]
path = NWN.Anvil.TestRunner/src/lib/nunit
url = https://github.com/nwn-dotnet/nunit.git
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,43 @@ 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.34.1
https://github.com/nwn-dotnet/Anvil/compare/v8193.34.0...v8193.34.1

### Added
- NwPlayer: `IsConnected` boolean added. Should be checked when enumerating `NwModule.Players`
- NwPlayer: Added `DMPossessCreature` and `UnpossessCreature` for controlling player creature.
- NwPlayer: `ForceExamine` now supports creatures, placeables, items and doors.
- Implemented `NWN.Anvil.TestRunner` for running automated tests.
- NwPlayer: Added `Get/SetPersonalVisibilityOverride` methods for customizing object visibility per player.
- NwGameObject: Added `VisibilityOverride` property for customizing object visibility globally.
- Creature Events: Added `OnCreatureCheckProficiencies` event.
- Added `Local/Campaign/PersistentVariableEnum<T>` object variable type for user enum types. The underlying type must be an integer.
- NwGameObject: Added `Clone` method for cloning non-creature and item objects.
- NwDoor: Added `Create` method for creating doors from ResRefs.
- NwEncounter: Added `Create` method for creating encounters from ResRefs.
- NwSound: Added `Create` method for creating sound objects from ResRefs.
- NwTrigger: Added `Create` method for creating triggers from ResRefs.
- NWN.Anvil.TestRunner: Added generator for generating ResRef constants from the standard creator palette.

### Package Updates
- NWN.Core: 8193.34.0 -> 8193.34.1

### Changed
- `NwCreature.WalkRateCap` and `NwCreature.AlwaysWalk` properties are no-longer persistent. Additionally, the services and functions are not hooked until the associated property is used for the first time.
- `NwObject.ObjectId` is now public.

### Deprecated
- N/A

### Removed
- N/A

### Fixed
- `AnvilCore.Reload()` now uses the scheduler service to schedule the reload. This should fix some edge cases where async methods would hold a reference preventing unload.
- Fixed an issue where the `SchedulerService` would throw an exception if the server was shutdown/reloaded during a schedule callback.
- Fixed a rare crash when subscribed to effect events.

## 8193.34.0
https://github.com/nwn-dotnet/Anvil/compare/v8193.33.5...v8193.34.0

Expand Down
Loading

0 comments on commit ee657af

Please sign in to comment.