Compare commits
224 Commits
github/master
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| a715bce62f | |||
| 23af21e3da | |||
| f2f03a5d40 | |||
| 99e51270fd | |||
| 14e6b55cac | |||
| 135089e0e4 | |||
| 732f253c07 | |||
| d2a3709de2 | |||
| e7a99a5d66 | |||
| 7b68a673c5 | |||
| d90ffada82 | |||
| bacd91d89a | |||
| e910e19609 | |||
| cfe076363d | |||
| a407d145bb | |||
| f2e330235e | |||
| 7559ac7acf | |||
| e5493977b8 | |||
| ad13cc21a3 | |||
| 6f5d2291b5 | |||
| ba369f6707 | |||
| 115456735a | |||
| c491a5389d | |||
| 56a1cbcb28 | |||
| feabc684d9 | |||
| 4da8562bde | |||
| 09ba96d102 | |||
| d95a0408e3 | |||
| 104e0aa216 | |||
| b6c86102cc | |||
| dd2602e0d9 | |||
| f501320d95 | |||
| 5588085570 | |||
| a1c63d396c | |||
| 15baaa7266 | |||
| 43bd17173a | |||
| 0c2afb62d3 | |||
| 26bd6beac6 | |||
| 6c39222072 | |||
| fcd4f8b20c | |||
| 55de8cb969 | |||
| bd67bee7a4 | |||
| fde5ca9703 | |||
| f0b862e946 | |||
| 8bcb756112 | |||
| c7fc4be0b9 | |||
| 6d31bed772 | |||
| 8bc1d9d491 | |||
| 552bdfba4a | |||
| 6392de1cb1 | |||
| af14e6d637 | |||
| 3c784d9b40 | |||
| f8d0ccfdfb | |||
| 3dc03e086c | |||
| 712f187570 | |||
| 52540e5f5a | |||
| 9c586a49e1 | |||
| a4781c2d9c | |||
| e6d3dabe39 | |||
| 3a7900e213 | |||
| a91f4585da | |||
| 9403ffe329 | |||
| 7b2ddfced5 | |||
| e35ee9ce01 | |||
| c2b5d6bef3 | |||
| ed9c1e63a6 | |||
| ba5ca8be03 | |||
| 81600e6b1f | |||
| f9fa66ba3d | |||
| ad60f6e667 | |||
| cbe3be2684 | |||
| 51b47326f0 | |||
| d843733fd4 | |||
| 33490dd5ac | |||
| dd98d30c2f | |||
| edc6f32fbc | |||
| e10d436295 | |||
| 914e8145c5 | |||
| 15b3caedf5 | |||
| 1359da5bcd | |||
| aabc70a4a3 | |||
| 174f57bbf7 | |||
| a43260bcff | |||
| 1169f6363d | |||
| bea7e34a5e | |||
| 76ce1d6859 | |||
| 6ad3088401 | |||
| 83d08ab859 | |||
| 11fc46fde8 | |||
| 031c787803 | |||
| 557bb82e51 | |||
| 45ca62b672 | |||
| b46ab5e064 | |||
| ac211bb5e5 | |||
| a1dd697a69 | |||
| fd45121eca | |||
| 9d1d3f4b31 | |||
| b9addc2364 | |||
| 7741049686 | |||
| 9eb17b0127 | |||
| 7b095ba7da | |||
| 06d6852eaa | |||
| edbc3aa37d | |||
| 54aa546149 | |||
| 4f1720532b | |||
| 8522842f8d | |||
| 9dd1c0b591 | |||
| 87ce54814c | |||
| 148b41482f | |||
| e79cf944ed | |||
| aa9a3d50fb | |||
| f9387c605c | |||
| 3de8b7b6bc | |||
| e467736887 | |||
| 9a0106aa2a | |||
| ea5f3cb10d | |||
| eebb842d23 | |||
| e38f5a2be9 | |||
| a385717044 | |||
| 7dd4afee06 | |||
| 0ec28b7917 | |||
| 03d3734ccd | |||
| 7c3766347a | |||
| 3c4c38e59d | |||
| 9872a2e0b5 | |||
| 2dab9f4d7a | |||
| 62e1d01188 | |||
| 7b153849b0 | |||
| a58c5ab64e | |||
| d1b68e58c5 | |||
| 8871c1b744 | |||
| 10f9970427 | |||
| f48250e8d5 | |||
| 008690a244 | |||
| 09ba661c68 | |||
| 09ca4c9de1 | |||
| cfdec47c63 | |||
| dcb65299c7 | |||
| 336e5604c5 | |||
| feee084903 | |||
| 6517d67524 | |||
| b840d0e8a1 | |||
| d2d8065527 | |||
| 7fea2c8c7d | |||
| d504b26347 | |||
| 74234d9c4c | |||
| e2820cab48 | |||
| 8c03426bbe | |||
| ed053420d7 | |||
| 3e8e5d0409 | |||
| c0fe020cae | |||
| 8834be2866 | |||
| b1de708b6d | |||
| 5e3dd9a642 | |||
| b96074da4c | |||
| d3b7fe9309 | |||
| 41084146d9 | |||
| e1c721215f | |||
| 2df9b68431 | |||
| 6873b75ec2 | |||
| 8b246af86c | |||
| fdcc2bf30d | |||
| 31740739e1 | |||
| ad4686a3cf | |||
| 8aeea3cd60 | |||
| 460a1be24c | |||
| d8f5d1fa32 | |||
| ebbe5e9036 | |||
| 810a80d581 | |||
| c3408edcab | |||
| e5f59cf0c4 | |||
| f76faef334 | |||
| d382f779a0 | |||
| cfbec6c78a | |||
| 939e2579b1 | |||
| 00d72886cc | |||
| f66b672985 | |||
| 8265e7a574 | |||
| 179a45ceba | |||
| aa4498e6d1 | |||
| 5ca5351de6 | |||
| 43030882c3 | |||
| 1d5a93c866 | |||
| 7c8dde5b2b | |||
| eb1995667c | |||
| ebd834f114 | |||
| fcb6678a1c | |||
| abcbd2fa9f | |||
| 248c4e58ec | |||
| fb67fcdbc9 | |||
| 917f766829 | |||
| 6a73895afc | |||
| 6c5b03e786 | |||
| 29c9898c86 | |||
| 18cd117925 | |||
| 6a2b4a8646 | |||
| 640a82db49 | |||
| 841ef6e844 | |||
| fb2453c3ff | |||
| c88f355f1f | |||
| 2f83fad7b5 | |||
| fa838fb13c | |||
| d389bbfd77 | |||
| 1a7bf446eb | |||
| 0a254c7b09 | |||
| 306dea2a8f | |||
| 8bde726194 | |||
| 4cf44f6224 | |||
| 0f3ade5d3f | |||
| 4ace8a5e3c | |||
| bb0fafbde9 | |||
| f63226ae14 | |||
| dba7b8e281 | |||
| 688c459008 | |||
| e32d3205c0 | |||
| b24c4d13cb | |||
| 323f3a9b83 | |||
| fa341c3fcb | |||
| b1da771cee | |||
| 5015655398 | |||
| 4055b6e339 | |||
| ad5fff030f | |||
| 803000e924 | |||
| 4296be9929 |
+26
-7
@@ -1,6 +1,24 @@
|
|||||||
|
# Editor configuration, see http://editorconfig.org
|
||||||
root = true
|
root = true
|
||||||
[*]
|
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.scss]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
max_line_length = off
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.json]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.cshtml]
|
||||||
# Some CSS Resharper doesn't know how to load.
|
# Some CSS Resharper doesn't know how to load.
|
||||||
resharper_unknown_css_class_highlighting=none
|
resharper_unknown_css_class_highlighting=none
|
||||||
|
|
||||||
@@ -19,14 +37,15 @@ resharper_css_browser_compatibility_highlighting=none
|
|||||||
# Localization might not be finished.
|
# Localization might not be finished.
|
||||||
resharper_not_overridden_in_specific_culture_highlighting=suggestion
|
resharper_not_overridden_in_specific_culture_highlighting=suggestion
|
||||||
|
|
||||||
# Allow names like `IPAddress`.
|
|
||||||
resharper_inconsistent_naming_highlighting=suggestion
|
|
||||||
|
|
||||||
# Allow unused auto property get.
|
|
||||||
resharper_unused_auto_property_accessor_global_highlighting=suggestion
|
|
||||||
|
|
||||||
# Allow view render global var.
|
# Allow view render global var.
|
||||||
resharper_access_to_modified_closure_highlighting=suggestion
|
resharper_access_to_modified_closure_highlighting=suggestion
|
||||||
|
|
||||||
# Suppress id not resolved because resharper can't understand
|
# Suppress id not resolved because resharper can't understand
|
||||||
resharper_html_id_not_resolved_highlighting=suggestion
|
resharper_html_id_not_resolved_highlighting=suggestion
|
||||||
|
|
||||||
|
[*.cs]
|
||||||
|
# Allow names like `IPAddress`.
|
||||||
|
resharper_inconsistent_naming_highlighting=suggestion
|
||||||
|
|
||||||
|
# Allow unused auto property get.
|
||||||
|
resharper_unused_auto_property_accessor_global_highlighting=suggestion
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
.vs/
|
.vs/
|
||||||
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
lib
|
lib
|
||||||
*.user
|
*.user
|
||||||
@@ -16,3 +17,6 @@ appsettings.Development.json
|
|||||||
*.log
|
*.log
|
||||||
TestResults/
|
TestResults/
|
||||||
app.db*
|
app.db*
|
||||||
|
.angular/
|
||||||
|
.yarn/
|
||||||
|
*.tsbuildinfo
|
||||||
|
|||||||
+132
-112
@@ -1,130 +1,150 @@
|
|||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- lint
|
- lint
|
||||||
- test
|
- test
|
||||||
- publish
|
- publish
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- 'export DOTNET_CLI_TELEMETRY_OPTOUT=1'
|
- "export PATH=$PATH:$HOME/.dotnet/tools"
|
||||||
- 'export PATH=$PATH:$HOME/.dotnet/tools'
|
- "which jb || dotnet tool install JetBrains.ReSharper.GlobalTools --global --add-source https://nuget.aiursoft.com/v3/index.json --configfile ./nuget.config -v d"
|
||||||
- 'which jb || dotnet tool install JetBrains.ReSharper.GlobalTools --global --add-source https://nuget.aiursoft.cn/v3/index.json --configfile ./nuget.config -v d'
|
- "which reportgenerator || dotnet tool install dotnet-reportgenerator-globaltool --global --add-source https://nuget.aiursoft.com/v3/index.json --configfile ./nuget.config -v d"
|
||||||
- 'which reportgenerator || dotnet tool install dotnet-reportgenerator-globaltool --global --add-source https://nuget.aiursoft.cn/v3/index.json --configfile ./nuget.config -v d'
|
- 'echo "Hostname: $(hostname)"'
|
||||||
- 'echo "Hostname: $(hostname)"'
|
- "dotnet --info"
|
||||||
- 'dotnet --info'
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
GIT_CLONE_PATH: '$CI_BUILDS_DIR/$CI_PROJECT_NAME/$CI_PIPELINE_ID'
|
GIT_CLONE_PATH: "$CI_BUILDS_DIR/$CI_PROJECT_NAME/$CI_PIPELINE_ID"
|
||||||
|
MSBUILDDISABLENODEREUSE: "1"
|
||||||
|
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
|
||||||
|
|
||||||
restore:
|
restore:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- dotnet restore --no-cache --configfile nuget.config
|
- |
|
||||||
|
dotnet restore --no-cache --configfile nuget.config || \
|
||||||
|
(echo "Restore failed. Retrying in 10 seconds..." && sleep 10 && dotnet restore --no-cache --configfile nuget.config) || \
|
||||||
|
(echo "Restore failed again. Retrying in 20 seconds..." && sleep 20 && dotnet restore --no-cache --configfile nuget.config)
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
needs:
|
needs:
|
||||||
- restore
|
- restore
|
||||||
script:
|
script:
|
||||||
- dotnet build -maxcpucount:1 --no-self-contained
|
- dotnet build -maxcpucount:1 --no-self-contained
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
stage: lint
|
stage: lint
|
||||||
needs:
|
needs:
|
||||||
- build
|
- build
|
||||||
script:
|
script:
|
||||||
# 3 times retry because sometimes the first time will fail
|
- chmod +x ./lint.sh
|
||||||
- jb inspectcode ./*.sln --output=analyze_output.xml --build -f=xml || jb inspectcode ./*.sln --output=analyze_output.xml --build -f=xml || jb inspectcode ./*.sln --output=analyze_output.xml --build -f=xml
|
- ./lint.sh
|
||||||
# Remove the warning of UnusedAutoPropertyAccessor InconsistentNaming
|
artifacts:
|
||||||
- sed -i '/InconsistentNaming/d' analyze_output.xml
|
when: always
|
||||||
- sed -i '/AssignNullToNotNullAttribute/d' analyze_output.xml # This is because jetbrains is not smart enough to understand the nullability of C# 8.0
|
expire_in: 1 day
|
||||||
- sed -i '/UnusedAutoPropertyAccessor/d' analyze_output.xml
|
paths:
|
||||||
- grep 'WARNING' analyze_output.xml && cat analyze_output.xml && exit 1 || echo "No warning found"
|
- ./analyze_output.xml
|
||||||
artifacts:
|
|
||||||
when: always
|
|
||||||
expire_in: 1 day
|
|
||||||
paths:
|
|
||||||
- ./analyze_output.xml
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
needs:
|
needs:
|
||||||
- build
|
- build
|
||||||
coverage: '/TOTAL_COVERAGE=(\d+.\d+)/'
|
coverage: '/TOTAL_COVERAGE=(\d+.\d+)/'
|
||||||
script:
|
script:
|
||||||
- dotnet test *.sln --collect:"XPlat Code Coverage" --logger "junit;MethodFormat=Class;FailureBodyFormat=Verbose"
|
- |
|
||||||
- reportgenerator -reports:"**/coverage.cobertura.xml" -targetdir:"." -reporttypes:"cobertura"
|
dotnet test *.sln --collect:"XPlat Code Coverage" --logger "junit;MethodFormat=Class;FailureBodyFormat=Verbose" || \
|
||||||
- COVERAGE_VALUE=$(grep -oPm 1 'line-rate="\K([0-9.]+)' "./Cobertura.xml")
|
(echo "Test failed. Retrying in 10 seconds..." && sleep 10 && dotnet test *.sln --collect:"XPlat Code Coverage" --logger "junit;MethodFormat=Class;FailureBodyFormat=Verbose") || \
|
||||||
- COVERAGE_PERCENTAGE=$(echo "scale=2; $COVERAGE_VALUE * 100" | bc)
|
(echo "Test failed again. Retrying in 20 seconds..." && sleep 20 && dotnet test *.sln --collect:"XPlat Code Coverage" --logger "junit;MethodFormat=Class;FailureBodyFormat=Verbose")
|
||||||
- 'echo "TOTAL_COVERAGE=$COVERAGE_PERCENTAGE%"'
|
- reportgenerator -reports:"**/coverage.cobertura.xml" -targetdir:"." -reporttypes:"cobertura"
|
||||||
artifacts:
|
- COVERAGE_VALUE=$(grep -oPm 1 'line-rate="\K([0-9.]+)' "./Cobertura.xml")
|
||||||
when: always
|
- COVERAGE_PERCENTAGE=$(echo "scale=2; $COVERAGE_VALUE * 100" | bc)
|
||||||
expire_in: 1 day
|
- 'echo "TOTAL_COVERAGE=$COVERAGE_PERCENTAGE%"'
|
||||||
paths:
|
artifacts:
|
||||||
- ./**/TestResults.xml
|
when: always
|
||||||
- ./Cobertura.xml
|
expire_in: 1 day
|
||||||
reports:
|
paths:
|
||||||
junit:
|
- ./**/TestResults.xml
|
||||||
- ./**/TestResults.xml
|
- ./Cobertura.xml
|
||||||
coverage_report:
|
reports:
|
||||||
coverage_format: cobertura
|
junit:
|
||||||
path: ./Cobertura.xml
|
- ./**/TestResults.xml
|
||||||
|
coverage_report:
|
||||||
|
coverage_format: cobertura
|
||||||
|
path: ./Cobertura.xml
|
||||||
|
|
||||||
pack:
|
pack:
|
||||||
stage: publish
|
stage: publish
|
||||||
needs:
|
needs:
|
||||||
- lint
|
- lint
|
||||||
- test
|
- test
|
||||||
script:
|
script:
|
||||||
- dotnet build -maxcpucount:1 --configuration Release --no-self-contained *.sln
|
- dotnet build -maxcpucount:1 --configuration Release --no-self-contained *.sln
|
||||||
- dotnet pack -maxcpucount:1 --configuration Release *.sln || echo "Some packaging failed!"
|
- dotnet pack -maxcpucount:1 --configuration Release *.sln || echo "Some packaging failed!"
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- '**/*.nupkg'
|
- "**/*.nupkg"
|
||||||
|
|
||||||
upload_to_nuget:
|
deploy_local_nuget:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
environment: production
|
environment: production
|
||||||
needs:
|
needs:
|
||||||
- pack
|
- pack
|
||||||
dependencies:
|
dependencies:
|
||||||
- pack
|
- pack
|
||||||
script:
|
script:
|
||||||
- |
|
- |
|
||||||
for file in $(find . -name "*.nupkg"); do
|
for file in $(find . -name "*.nupkg"); do
|
||||||
dotnet nuget push "$file" --api-key "$NUGET_API_KEY" --source "https://api.nuget.org/v3/index.json" --skip-duplicate || exit 1;
|
dotnet nuget push "$file" --api-key "$LOCAL_NUGET_API_KEY" --source "https://nuget.aiursoft.com/v3/index.json" --skip-duplicate || exit 1;
|
||||||
done
|
done
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
upload_to_local_nuget:
|
deploy_public_nuget:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
environment: production
|
environment: production
|
||||||
needs:
|
needs:
|
||||||
- pack
|
- pack
|
||||||
dependencies:
|
- deploy_local_nuget
|
||||||
- pack
|
dependencies:
|
||||||
script:
|
- pack
|
||||||
- |
|
script:
|
||||||
for file in $(find . -name "*.nupkg"); do
|
- |
|
||||||
dotnet nuget push "$file" --api-key "$LOCAL_NUGET_API_KEY" --source "https://nuget.aiursoft.cn/v3/index.json" --skip-duplicate || exit 1;
|
for file in $(find . -name "*.nupkg"); do
|
||||||
done
|
dotnet nuget push "$file" --api-key "$NUGET_API_KEY" --source "https://api.nuget.org/v3/index.json" --skip-duplicate || exit 1;
|
||||||
only:
|
done
|
||||||
- master
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
deploy_docker:
|
deploy_docker_all:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
environment: production
|
environment: production
|
||||||
needs:
|
needs:
|
||||||
- lint
|
- lint
|
||||||
- test
|
- test
|
||||||
script:
|
script:
|
||||||
- if [ "$CI_COMMIT_REF_NAME" = "master" ]; then TAG="latest"; else TAG="$CI_COMMIT_REF_NAME"; fi
|
- if [ "$CI_COMMIT_REF_NAME" = "master" ]; then TAG="latest"; else TAG="$CI_COMMIT_REF_NAME"; fi
|
||||||
- echo building image hub.aiursoft.cn/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$TAG
|
- if [ "$CI_PROJECT_NAMESPACE" = "anduin" ]; then HUB_NAMESPACE="anduin2019"; else HUB_NAMESPACE="$CI_PROJECT_NAMESPACE"; fi
|
||||||
- docker build . -t hub.aiursoft.cn/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:latest
|
|
||||||
- docker push hub.aiursoft.cn/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:latest
|
- LOCAL_TARGET_COM="hub.aiursoft.com/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$TAG"
|
||||||
rules:
|
- LOCAL_TARGET_CN="hub.aiursoft.cn/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$TAG"
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- PUBLIC_TARGET="$HUB_NAMESPACE/$CI_PROJECT_NAME:$TAG"
|
||||||
exists:
|
|
||||||
- Dockerfile
|
- echo "$LOCAL_DOCKER_PASSWORD" | docker login hub.aiursoft.com -u "$LOCAL_DOCKER_USERNAME" --password-stdin
|
||||||
|
- echo "$CN_DOCKER_PASSWORD" | docker login hub.aiursoft.cn -u "$CN_DOCKER_USERNAME" --password-stdin
|
||||||
|
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||||
|
|
||||||
|
- docker buildx use aiur-global-builder
|
||||||
|
- echo "Building and pushing multi-arch to all registries..."
|
||||||
|
- |
|
||||||
|
docker buildx build . \
|
||||||
|
--platform linux/amd64,linux/arm64 \
|
||||||
|
-t $LOCAL_TARGET_COM \
|
||||||
|
-t $LOCAL_TARGET_CN \
|
||||||
|
-t $PUBLIC_TARGET \
|
||||||
|
--push
|
||||||
|
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||||
|
exists:
|
||||||
|
- Dockerfile
|
||||||
+38
-24
@@ -1,42 +1,56 @@
|
|||||||
ARG CSPROJ_PATH="./src/Aiursoft.ChessServer/"
|
ARG CSPROJ_PATH="./src/Aiursoft.ChessServer"
|
||||||
ARG PROJ_NAME="Aiursoft.ChessServer"
|
ARG PROJ_NAME="Aiursoft.ChessServer"
|
||||||
|
ARG FRONT_END_PATH="${CSPROJ_PATH}/wwwroot"
|
||||||
|
|
||||||
# ============================
|
# ============================
|
||||||
# Prepare NPM Environment
|
# Prepare node modules
|
||||||
FROM hub.aiursoft.cn/node:21-alpine AS npm-env
|
# ============================
|
||||||
ARG CSPROJ_PATH
|
FROM --platform=$BUILDPLATFORM hub.aiursoft.com/node:24-alpine AS npm-env
|
||||||
|
ARG FRONT_END_PATH
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# NPM Build at PGK_JSON_PATH
|
# Restore
|
||||||
RUN npm install --prefix "${CSPROJ_PATH}wwwroot" --loglevel verbose
|
COPY ${FRONT_END_PATH}/package*.json ./
|
||||||
|
RUN npm install --loglevel verbose --force
|
||||||
|
|
||||||
|
# Build (no need to build. Static files project)
|
||||||
|
# COPY ${FRONT_END_PATH}/ .
|
||||||
|
# RUN npm run build --loglevel verbose
|
||||||
|
|
||||||
# ============================
|
# ============================
|
||||||
# Prepare Building Environment
|
# Prepare .NET binaries
|
||||||
FROM hub.aiursoft.cn/mcr.microsoft.com/dotnet/sdk:9.0 AS build-env
|
# ============================
|
||||||
|
FROM --platform=$BUILDPLATFORM hub.aiursoft.com/aiursoft/internalimages/dotnet AS build-env
|
||||||
ARG CSPROJ_PATH
|
ARG CSPROJ_PATH
|
||||||
ARG PROJ_NAME
|
ARG PROJ_NAME
|
||||||
|
ARG TARGETARCH
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY --from=npm-env /src .
|
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
RUN dotnet publish ${CSPROJ_PATH}${PROJ_NAME}.csproj --configuration Release --no-self-contained --runtime linux-x64 --output /app
|
COPY . .
|
||||||
RUN cp -r ${CSPROJ_PATH}/wwwroot/* /app/wwwroot
|
RUN if [ "$TARGETARCH" = "arm64" ]; then \
|
||||||
|
RID="linux-arm64"; \
|
||||||
|
elif [ "$TARGETARCH" = "amd64" ]; then \
|
||||||
|
RID="linux-x64"; \
|
||||||
|
else \
|
||||||
|
RID="linux-$TARGETARCH"; \
|
||||||
|
fi && \
|
||||||
|
echo "Building for arch: $TARGETARCH, using .NET RID: $RID" && \
|
||||||
|
dotnet publish ${CSPROJ_PATH}/${PROJ_NAME}.csproj --configuration Release --no-self-contained --runtime $RID --output /app
|
||||||
|
|
||||||
# ============================
|
# ============================
|
||||||
# Prepare Runtime Environment
|
# Prepare runtime image
|
||||||
FROM hub.aiursoft.cn/mcr.microsoft.com/dotnet/aspnet:9.0
|
# ============================
|
||||||
|
FROM hub.aiursoft.com/aiursoft/internalimages/dotnetonlyruntime
|
||||||
ARG PROJ_NAME
|
ARG PROJ_NAME
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build-env /app .
|
COPY --from=build-env /app .
|
||||||
|
COPY --from=npm-env /src ./wwwroot
|
||||||
# Install wget and curl
|
|
||||||
RUN apt update; DEBIAN_FRONTEND=noninteractive apt install -y wget curl
|
|
||||||
|
|
||||||
# Edit appsettings.json
|
# Edit appsettings.json
|
||||||
RUN sed -i 's/DataSource=app.db/DataSource=\/data\/app.db/g' appsettings.json
|
RUN sed -i 's/DataSource=app.db/DataSource=\/data\/app.db/g' appsettings.json && \
|
||||||
RUN sed -i 's/\/tmp\/data/\/data/g' appsettings.json
|
sed -i 's/\/tmp\/data/\/data/g' appsettings.json && \
|
||||||
RUN mkdir -p /data
|
mkdir -p /data
|
||||||
|
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
@@ -48,14 +62,14 @@ ENV DLL_NAME=${PROJ_NAME}.dll
|
|||||||
#ENTRYPOINT dotnet $DLL_NAME --urls http://*:5000
|
#ENTRYPOINT dotnet $DLL_NAME --urls http://*:5000
|
||||||
ENTRYPOINT ["/bin/bash", "-c", "\
|
ENTRYPOINT ["/bin/bash", "-c", "\
|
||||||
if [ ! -f \"$VOL_SETTINGS\" ]; then \
|
if [ ! -f \"$VOL_SETTINGS\" ]; then \
|
||||||
cp $SRC_SETTINGS $VOL_SETTINGS; \
|
cp $SRC_SETTINGS $VOL_SETTINGS; \
|
||||||
fi && \
|
fi && \
|
||||||
if [ -f \"$SRC_SETTINGS\" ]; then \
|
if [ -f \"$SRC_SETTINGS\" ]; then \
|
||||||
rm $SRC_SETTINGS; \
|
rm $SRC_SETTINGS; \
|
||||||
fi && \
|
fi && \
|
||||||
ln -s $VOL_SETTINGS $SRC_SETTINGS && \
|
ln -s $VOL_SETTINGS $SRC_SETTINGS && \
|
||||||
dotnet $DLL_NAME --urls http://*:5000 \
|
dotnet $DLL_NAME --urls http://*:5000 \
|
||||||
"]
|
"]
|
||||||
|
|
||||||
HEALTHCHECK --interval=10s --timeout=3s --start-period=180s --retries=3 CMD \
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=180s --retries=3 CMD \
|
||||||
wget --quiet --tries=1 --spider http://localhost:5000/health || exit 1
|
wget --quiet --tries=1 --spider http://localhost:5000/health || exit 1
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
# ChessServer
|
# ChessServer
|
||||||
|
|
||||||
[](https://gitlab.aiursoft.cn/aiursoft/ChessServer/-/blob/master/LICENSE)
|
[](https://gitlab.aiursoft.com/aiursoft/ChessServer/-/blob/master/LICENSE)
|
||||||
[](https://gitlab.aiursoft.cn/aiursoft/ChessServer/-/pipelines)
|
[](https://gitlab.aiursoft.com/aiursoft/ChessServer/-/pipelines)
|
||||||
[](https://gitlab.aiursoft.cn/aiursoft/ChessServer/-/pipelines)
|
[](https://gitlab.aiursoft.com/aiursoft/ChessServer/-/pipelines)
|
||||||
[](https://gitlab.aiursoft.cn/aiursoft/ChessServer/-/commits/master?ref_type=heads)
|
[](https://manhours.aiursoft.com/r/gitlab.aiursoft.com/aiursoft/ChessServer.html)
|
||||||
[](https://chess.aiursoft.cn)
|
[](https://chess.aiursoft.com)
|
||||||
[](https://hub.aiursoft.cn/#!/taglist/aiursoft/chessserver)
|
[](https://hub.docker.com/r/aiursoft/chessserver)
|
||||||
|
|
||||||
ChessServer is just a simple web-based chess server. Based on WebSocket. Can be played with sharing link with friends. No sign up required.
|
ChessServer is just a simple web-based chess server. Based on WebSocket. Can be played with sharing link with friends. No sign up required.
|
||||||
|
|
||||||
@@ -13,22 +13,22 @@ ChessServer is just a simple web-based chess server. Based on WebSocket. Can be
|
|||||||
|
|
||||||
## Try
|
## Try
|
||||||
|
|
||||||
Try a running ChessServer [here](https://chess.aiursoft.cn).
|
Try a running ChessServer [here](https://chess.aiursoft.com).
|
||||||
|
|
||||||
## Run in Ubuntu
|
## Run in Ubuntu
|
||||||
|
|
||||||
The following script will install\update this app on your Ubuntu server. Supports Ubuntu 22.04.
|
The following script will install\update this app on your Ubuntu server. Supports Ubuntu 25.04.
|
||||||
|
|
||||||
On your Ubuntu server, run the following command:
|
On your Ubuntu server, run the following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -sL https://gitlab.aiursoft.cn/aiursoft/chessserver/-/raw/master/install.sh | sudo bash
|
curl -sL https://gitlab.aiursoft.com/aiursoft/chessserver/-/raw/master/install.sh | sudo bash
|
||||||
```
|
```
|
||||||
|
|
||||||
Of course it is suggested that append a custom port number to the command:
|
Of course it is suggested that append a custom port number to the command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -sL https://gitlab.aiursoft.cn/aiursoft/chessserver/-/raw/master/install.sh | sudo bash -s 8080
|
curl -sL https://gitlab.aiursoft.com/aiursoft/chessserver/-/raw/master/install.sh | sudo bash -s 8080
|
||||||
```
|
```
|
||||||
|
|
||||||
It will install the app as a systemd service, and start it automatically. Binary files will be located at `/opt/apps`. Service files will be located at `/etc/systemd/system`.
|
It will install the app as a systemd service, and start it automatically. Binary files will be located at `/opt/apps`. Service files will be located at `/etc/systemd/system`.
|
||||||
@@ -37,7 +37,7 @@ It will install the app as a systemd service, and start it automatically. Binary
|
|||||||
|
|
||||||
Requirements about how to run
|
Requirements about how to run
|
||||||
|
|
||||||
1. Install [.NET 9 SDK](http://dot.net/) and [Node.js](https://nodejs.org/).
|
1. Install [.NET 10 SDK](http://dot.net/) and [Node.js](https://nodejs.org/).
|
||||||
2. Execute `npm install` at `wwwroot` folder to install the dependencies.
|
2. Execute `npm install` at `wwwroot` folder to install the dependencies.
|
||||||
3. Execute `dotnet run` to run the app.
|
3. Execute `dotnet run` to run the app.
|
||||||
4. Use your browser to view [http://localhost:5000](http://localhost:5000).
|
4. Use your browser to view [http://localhost:5000](http://localhost:5000).
|
||||||
@@ -54,7 +54,7 @@ First, install Docker [here](https://docs.docker.com/get-docker/).
|
|||||||
Then run the following commands in a Linux shell:
|
Then run the following commands in a Linux shell:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
image=hub.aiursoft.cn/aiursoft/chessserver
|
image=aiursoft/chessserver
|
||||||
appName=chessserver
|
appName=chessserver
|
||||||
sudo docker pull $image
|
sudo docker pull $image
|
||||||
sudo docker run -d --name $appName --restart unless-stopped -p 5000:5000 -v /var/www/$appName:/data $image
|
sudo docker run -d --name $appName --restart unless-stopped -p 5000:5000 -v /var/www/$appName:/data $image
|
||||||
@@ -66,7 +66,7 @@ The docker image has the following context:
|
|||||||
|
|
||||||
| Properties | Value |
|
| Properties | Value |
|
||||||
|-------------|-------------------------------------|
|
|-------------|-------------------------------------|
|
||||||
| Image | hub.aiursoft.cn/aiursoft/chessserver|
|
| Image | aiursoft/chessserver |
|
||||||
| Ports | 5000 |
|
| Ports | 5000 |
|
||||||
| Binary path | /app |
|
| Binary path | /app |
|
||||||
| Data path | /data |
|
| Data path | /data |
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
aiur() { arg="$( cut -d ' ' -f 2- <<< "$@" )" && curl -sL https://gitlab.aiursoft.cn/aiursoft/aiurscript/-/raw/master/$1.sh | sudo bash -s $arg; }
|
aiur() { arg="$( cut -d ' ' -f 2- <<< "$@" )" && curl -sL https://gitlab.aiursoft.com/aiursoft/aiurscript/-/raw/master/$1.sh | sudo bash -s $arg; }
|
||||||
|
|
||||||
app_name="chessserver"
|
app_name="chessserver"
|
||||||
repo_path="https://gitlab.aiursoft.cn/aiursoft/chessserver"
|
repo_path="https://gitlab.aiursoft.com/aiursoft/chessserver"
|
||||||
proj_path="src/Aiursoft.ChessServer/Aiursoft.ChessServer.csproj"
|
proj_path="src/Aiursoft.ChessServer/Aiursoft.ChessServer.csproj"
|
||||||
|
|
||||||
get_dll_name()
|
get_dll_name()
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Configuration matches .gitlab-ci.yml
|
||||||
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||||
|
export PATH=$PATH:$HOME/.dotnet/tools
|
||||||
|
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
# Cleanup only if not in CI (GitLab CI sets the CI variable)
|
||||||
|
if [ -z "$CI" ]; then
|
||||||
|
trap 'rm -f analyze_output.xml' EXIT
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Checking for JetBrains ReSharper Global Tools..."
|
||||||
|
if ! command -v jb &> /dev/null; then
|
||||||
|
echo "jb not found, installing..."
|
||||||
|
dotnet tool install JetBrains.ReSharper.GlobalTools --global --add-source https://nuget.aiursoft.com/v3/index.json --configfile ./nuget.config -v d
|
||||||
|
else
|
||||||
|
echo "jb is already installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Restoring dependencies..."
|
||||||
|
dotnet restore --no-cache --configfile nuget.config || \
|
||||||
|
(echo "Restore failed. Retrying in 10 seconds..." && sleep 10 && dotnet restore --no-cache --configfile nuget.config)
|
||||||
|
|
||||||
|
echo "Running ReSharper Code Inspection..."
|
||||||
|
# 3 times retry because sometimes the first time will fail (copied from CI)
|
||||||
|
if ! jb inspectcode ./*.sln --output=analyze_output.xml --build -f=xml &> /dev/null; then
|
||||||
|
echo "First attempt failed, retrying..."
|
||||||
|
if ! jb inspectcode ./*.sln --output=analyze_output.xml --build -f=xml &> /dev/null; then
|
||||||
|
echo "Second attempt failed, retrying..."
|
||||||
|
jb inspectcode ./*.sln --output=analyze_output.xml --build -f=xml &> /dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Filtering known false positives..."
|
||||||
|
# Current filters from .gitlab-ci.yml
|
||||||
|
sed -i '/InconsistentNaming/d' analyze_output.xml
|
||||||
|
sed -i '/AssignNullToNotNullAttribute/d' analyze_output.xml
|
||||||
|
sed -i '/UnusedAutoPropertyAccessor/d' analyze_output.xml
|
||||||
|
sed -i '/DuplicateResource/d' analyze_output.xml
|
||||||
|
sed -i '/NotOverriddenInSpecificCulture/d' analyze_output.xml
|
||||||
|
|
||||||
|
# Check for warnings
|
||||||
|
# Mimic .gitlab-ci.yml logic: Fail if 'WARNING' string is found.
|
||||||
|
if grep -q 'WARNING' analyze_output.xml; then
|
||||||
|
echo -e "${RED}Linting FAILED!${NC}"
|
||||||
|
echo "Issues found:"
|
||||||
|
|
||||||
|
# Filter issues to only show those with Severity="WARNING" or "ERROR"
|
||||||
|
# Identify IssueTypes that are Warnings or Errors
|
||||||
|
# We use grep and cut to extract the IDs purely from lines with Severity="WARNING" or "ERROR"
|
||||||
|
WARNING_IDS=$(grep -E 'Severity="(WARNING|ERROR)"' analyze_output.xml | grep -o 'Id="[^"]*"' | cut -d'"' -f2)
|
||||||
|
|
||||||
|
# Check if we found any IDs (to avoid syntax errors in loop if empty, though unlikely if grep passed)
|
||||||
|
if [ ! -z "$WARNING_IDS" ]; then
|
||||||
|
for ID in $WARNING_IDS; do
|
||||||
|
# Find issues matching this TypeId
|
||||||
|
# We assume one issue per line
|
||||||
|
grep "TypeId=\"$ID\"" analyze_output.xml | while read -r line; do
|
||||||
|
# Extract attributes using grep -o (lazy parsing)
|
||||||
|
FILE=$(echo "$line" | grep -o 'File="[^"]*"' | cut -d'"' -f2 | sed 's/\\/\//g')
|
||||||
|
LINE=$(echo "$line" | grep -o 'Line="[^"]*"' | cut -d'"' -f2)
|
||||||
|
if [ -z "$LINE" ]; then
|
||||||
|
OFFSET=$(echo "$line" | grep -o 'Offset="[^"]*"' | cut -d'"' -f2)
|
||||||
|
if [ ! -z "$OFFSET" ]; then
|
||||||
|
LINE="Offset $OFFSET"
|
||||||
|
else
|
||||||
|
LINE="Unknown"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
MSG=$(echo "$line" | grep -o 'Message="[^"]*"' | cut -d'"' -f2)
|
||||||
|
|
||||||
|
echo "File: $FILE | Line: $LINE | Reason: $MSG"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Warning severity found in header, but no specific IssueType IDs extracted. Check XML format."
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}Linting PASSED! No warnings found.${NC}"
|
||||||
|
fi
|
||||||
+10
-7
@@ -1,16 +1,19 @@
|
|||||||
configVersion: 1
|
configVersion: 1
|
||||||
files:
|
files:
|
||||||
- name: .editorconfig
|
- name: .editorconfig
|
||||||
contentUri: https://gitlab.aiursoft.cn/aiursoft/tracer/-/raw/master/.editorconfig
|
contentUri: https://gitlab.aiursoft.com/aiursoft/template/-/raw/master/.editorconfig
|
||||||
- name: .gitignore
|
- name: .gitignore
|
||||||
contentUri: https://gitlab.aiursoft.cn/aiursoft/tracer/-/raw/master/.gitignore
|
contentUri: https://gitlab.aiursoft.com/aiursoft/template/-/raw/master/.gitignore
|
||||||
- name: .gitlab-ci.yml
|
- name: .gitlab-ci.yml
|
||||||
contentUri: https://gitlab.aiursoft.cn/aiursoft/tracer/-/raw/master/.gitlab-ci.yml
|
contentUri: https://gitlab.aiursoft.com/aiursoft/template/-/raw/master/.gitlab-ci.yml
|
||||||
|
- name: lint.sh
|
||||||
|
contentUri: https://gitlab.aiursoft.com/aiursoft/template/-/raw/master/lint.sh
|
||||||
- name: LICENSE
|
- name: LICENSE
|
||||||
contentUri: https://gitlab.aiursoft.cn/aiursoft/tracer/-/raw/master/LICENSE
|
contentUri: https://gitlab.aiursoft.com/aiursoft/template/-/raw/master/LICENSE
|
||||||
- name: CODE_OF_CONDUCT.md
|
- name: CODE_OF_CONDUCT.md
|
||||||
contentUri: https://gitlab.aiursoft.cn/aiursoft/tracer/-/raw/master/CODE_OF_CONDUCT.md
|
contentUri: https://gitlab.aiursoft.com/aiursoft/template/-/raw/master/CODE_OF_CONDUCT.md
|
||||||
- name: ninja.yaml
|
- name: ninja.yaml
|
||||||
contentUri: https://gitlab.aiursoft.cn/aiursoft/tracer/-/raw/master/ninja.yaml
|
contentUri: https://gitlab.aiursoft.com/aiursoft/template/-/raw/master/ninja.yaml
|
||||||
- name: nuget.config
|
- name: nuget.config
|
||||||
contentUri: https://gitlab.aiursoft.cn/aiursoft/tracer/-/raw/master/nuget.config
|
contentUri: https://gitlab.aiursoft.com/aiursoft/template/-/raw/master/nuget.config
|
||||||
|
- name: README.md
|
||||||
|
|||||||
+1
-1
@@ -2,6 +2,6 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<packageSources>
|
<packageSources>
|
||||||
<clear />
|
<clear />
|
||||||
<add key="nuget" value="https://nuget.aiursoft.cn/v3/index.json" />
|
<add key="nuget" value="https://nuget.aiursoft.com/v3/index.json" />
|
||||||
</packageSources>
|
</packageSources>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<AssemblyName>Aiursoft.ChessServer</AssemblyName>
|
<AssemblyName>Aiursoft.ChessServer</AssemblyName>
|
||||||
<RootNamespace>Aiursoft.ChessServer</RootNamespace>
|
<RootNamespace>Aiursoft.ChessServer</RootNamespace>
|
||||||
<IsTestProject>false</IsTestProject>
|
<IsTestProject>false</IsTestProject>
|
||||||
@@ -10,12 +10,12 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Aiursoft.AiurObserver.Extensions" Version="9.0.0" />
|
<PackageReference Include="Aiursoft.AiurObserver.Extensions" Version="10.0.6" />
|
||||||
<PackageReference Include="Aiursoft.AiurObserver.WebSocket.Server" Version="9.0.0" />
|
<PackageReference Include="Aiursoft.AiurObserver.WebSocket.Server" Version="10.0.8" />
|
||||||
<PackageReference Include="Aiursoft.InMemoryKvDb" Version="1.0.7" />
|
<PackageReference Include="Aiursoft.InMemoryKvDb" Version="10.0.7" />
|
||||||
<PackageReference Include="Aiursoft.Scanner" Version="9.0.1" />
|
<PackageReference Include="Aiursoft.Scanner" Version="10.0.7" />
|
||||||
<PackageReference Include="Aiursoft.WebTools" Version="9.0.0" />
|
<PackageReference Include="Aiursoft.WebTools" Version="10.0.11" />
|
||||||
<PackageReference Include="Gera.Chess" Version="1.1.1" />
|
<PackageReference Include="Gera.Chess" Version="1.2.0" />
|
||||||
<PackageReference Include="LynxChess.Lynx" Version="1.8.0" />
|
<PackageReference Include="LynxChess.Lynx" Version="1.11.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -6,7 +6,6 @@ namespace Aiursoft.ChessServer.Controllers;
|
|||||||
|
|
||||||
public class HomeController(InMemoryDatabase database) : Controller
|
public class HomeController(InMemoryDatabase database) : Controller
|
||||||
{
|
{
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
var model = new IndexViewModel
|
var model = new IndexViewModel
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<nav class="navbar fixed-top navbar-expand-md mb-3">
|
<nav class="navbar fixed-top navbar-expand-md mb-3">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a class="navbar-brand" href="https://www.aiursoft.cn">
|
<a class="navbar-brand" href="https://www.aiursoft.com">
|
||||||
Aiursoft
|
Aiursoft
|
||||||
</a>
|
</a>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="https://gitlab.aiursoft.cn/aiursoft/chessserver">
|
<a class="nav-link" href="https://gitlab.aiursoft.com/aiursoft/chessserver">
|
||||||
<i class="fab fa-gitlab"></i>
|
<i class="fab fa-gitlab"></i>
|
||||||
Source Code
|
Source Code
|
||||||
</a>
|
</a>
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
© @DateTime.UtcNow.Year - Aiursoft.ChessServer -
|
© @DateTime.UtcNow.Year - Aiursoft.ChessServer -
|
||||||
<a
|
<a
|
||||||
href="https://gitlab.aiursoft.cn/aiursoft/chessserver">
|
href="https://gitlab.aiursoft.com/aiursoft/chessserver">
|
||||||
GitLab
|
GitLab
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
registry=https://npm.aiursoft.cn
|
registry=https://npm.aiursoft.com
|
||||||
+14
-14
@@ -20,7 +20,7 @@
|
|||||||
},
|
},
|
||||||
"node_modules/@aiursoft/autodark.js": {
|
"node_modules/@aiursoft/autodark.js": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://npm.aiursoft.cn/@aiursoft/autodark.js/-/autodark.js-1.2.0.tgz",
|
"resolved": "https://npm.aiursoft.com/@aiursoft/autodark.js/-/autodark.js-1.2.0.tgz",
|
||||||
"integrity": "sha512-3EZh7AaT2ns2DGq24HMcNxAjSVSST49t/tZhR2MV0pxrwYgb+1SCk6zj9qv4TJB1bAixM0K/5nsH0YazZzfvng==",
|
"integrity": "sha512-3EZh7AaT2ns2DGq24HMcNxAjSVSST49t/tZhR2MV0pxrwYgb+1SCk6zj9qv4TJB1bAixM0K/5nsH0YazZzfvng==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
"node_modules/@chrisoakman/chessboardjs": {
|
"node_modules/@chrisoakman/chessboardjs": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://npm.aiursoft.cn/@chrisoakman/chessboardjs/-/chessboardjs-1.0.0.tgz",
|
"resolved": "https://npm.aiursoft.com/@chrisoakman/chessboardjs/-/chessboardjs-1.0.0.tgz",
|
||||||
"integrity": "sha512-JHXHoQwwc86xW3F0YIdFcEWLnPldee5mHkqwJbOTeDh5gvNmYXyBj6AkeecDkj2WtORF959yaWYlpyZHUl3LCQ==",
|
"integrity": "sha512-JHXHoQwwc86xW3F0YIdFcEWLnPldee5mHkqwJbOTeDh5gvNmYXyBj6AkeecDkj2WtORF959yaWYlpyZHUl3LCQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
},
|
},
|
||||||
"node_modules/@fortawesome/fontawesome-free": {
|
"node_modules/@fortawesome/fontawesome-free": {
|
||||||
"version": "6.6.0",
|
"version": "6.6.0",
|
||||||
"resolved": "https://npm.aiursoft.cn/@fortawesome/fontawesome-free/-/fontawesome-free-6.6.0.tgz",
|
"resolved": "https://npm.aiursoft.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.6.0.tgz",
|
||||||
"integrity": "sha512-60G28ke/sXdtS9KZCpZSHHkCbdsOGEhIUGlwq6yhY74UpTiToIh8np7A8yphhM4BWsvNFtIvLpi4co+h9Mr9Ow==",
|
"integrity": "sha512-60G28ke/sXdtS9KZCpZSHHkCbdsOGEhIUGlwq6yhY74UpTiToIh8np7A8yphhM4BWsvNFtIvLpi4co+h9Mr9Ow==",
|
||||||
"license": "(CC-BY-4.0 AND OFL-1.1 AND MIT)",
|
"license": "(CC-BY-4.0 AND OFL-1.1 AND MIT)",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
},
|
},
|
||||||
"node_modules/bootstrap": {
|
"node_modules/bootstrap": {
|
||||||
"version": "4.6.2",
|
"version": "4.6.2",
|
||||||
"resolved": "https://npm.aiursoft.cn/bootstrap/-/bootstrap-4.6.2.tgz",
|
"resolved": "https://npm.aiursoft.com/bootstrap/-/bootstrap-4.6.2.tgz",
|
||||||
"integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==",
|
"integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -67,13 +67,13 @@
|
|||||||
},
|
},
|
||||||
"node_modules/chess.js": {
|
"node_modules/chess.js": {
|
||||||
"version": "1.0.0-beta.8",
|
"version": "1.0.0-beta.8",
|
||||||
"resolved": "https://npm.aiursoft.cn/chess.js/-/chess.js-1.0.0-beta.8.tgz",
|
"resolved": "https://npm.aiursoft.com/chess.js/-/chess.js-1.0.0-beta.8.tgz",
|
||||||
"integrity": "sha512-UngzUMXmexcQaQA/UEJuJj5vatEy34awYMD5YMOp/FW3HM7lqspp7ymYs5JAmquDq0WROtURRfSffoa/vrCCyw==",
|
"integrity": "sha512-UngzUMXmexcQaQA/UEJuJj5vatEy34awYMD5YMOp/FW3HM7lqspp7ymYs5JAmquDq0WROtURRfSffoa/vrCCyw==",
|
||||||
"license": "BSD-2-Clause"
|
"license": "BSD-2-Clause"
|
||||||
},
|
},
|
||||||
"node_modules/clipboard": {
|
"node_modules/clipboard": {
|
||||||
"version": "2.0.11",
|
"version": "2.0.11",
|
||||||
"resolved": "https://npm.aiursoft.cn/clipboard/-/clipboard-2.0.11.tgz",
|
"resolved": "https://npm.aiursoft.com/clipboard/-/clipboard-2.0.11.tgz",
|
||||||
"integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
|
"integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -84,13 +84,13 @@
|
|||||||
},
|
},
|
||||||
"node_modules/delegate": {
|
"node_modules/delegate": {
|
||||||
"version": "3.2.0",
|
"version": "3.2.0",
|
||||||
"resolved": "https://npm.aiursoft.cn/delegate/-/delegate-3.2.0.tgz",
|
"resolved": "https://npm.aiursoft.com/delegate/-/delegate-3.2.0.tgz",
|
||||||
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==",
|
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/good-listener": {
|
"node_modules/good-listener": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://npm.aiursoft.cn/good-listener/-/good-listener-1.2.2.tgz",
|
"resolved": "https://npm.aiursoft.com/good-listener/-/good-listener-1.2.2.tgz",
|
||||||
"integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
|
"integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -99,13 +99,13 @@
|
|||||||
},
|
},
|
||||||
"node_modules/jquery": {
|
"node_modules/jquery": {
|
||||||
"version": "3.7.1",
|
"version": "3.7.1",
|
||||||
"resolved": "https://npm.aiursoft.cn/jquery/-/jquery-3.7.1.tgz",
|
"resolved": "https://npm.aiursoft.com/jquery/-/jquery-3.7.1.tgz",
|
||||||
"integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==",
|
"integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/jquery-validation": {
|
"node_modules/jquery-validation": {
|
||||||
"version": "1.21.0",
|
"version": "1.21.0",
|
||||||
"resolved": "https://npm.aiursoft.cn/jquery-validation/-/jquery-validation-1.21.0.tgz",
|
"resolved": "https://npm.aiursoft.com/jquery-validation/-/jquery-validation-1.21.0.tgz",
|
||||||
"integrity": "sha512-xNot0rlUIgu7duMcQ5qb6MGkGL/Z1PQaRJQoZAURW9+a/2PGOUxY36o/WyNeP2T9R6jvWB8Z9lUVvvQWI/Zs5w==",
|
"integrity": "sha512-xNot0rlUIgu7duMcQ5qb6MGkGL/Z1PQaRJQoZAURW9+a/2PGOUxY36o/WyNeP2T9R6jvWB8Z9lUVvvQWI/Zs5w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
},
|
},
|
||||||
"node_modules/jquery-validation-unobtrusive": {
|
"node_modules/jquery-validation-unobtrusive": {
|
||||||
"version": "3.2.12",
|
"version": "3.2.12",
|
||||||
"resolved": "https://npm.aiursoft.cn/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-3.2.12.tgz",
|
"resolved": "https://npm.aiursoft.com/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-3.2.12.tgz",
|
||||||
"integrity": "sha512-kPixGhVcuat7vZXngGFfSIksy4VlzZcHyRgnBIZdsfVneCU+D5sITC8T8dD/9c9K/Q+qkMlgp7ufJHz93nKSuQ==",
|
"integrity": "sha512-kPixGhVcuat7vZXngGFfSIksy4VlzZcHyRgnBIZdsfVneCU+D5sITC8T8dD/9c9K/Q+qkMlgp7ufJHz93nKSuQ==",
|
||||||
"license": "https://aka.ms/jqueryunobtrusivelicense",
|
"license": "https://aka.ms/jqueryunobtrusivelicense",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
},
|
},
|
||||||
"node_modules/popper.js": {
|
"node_modules/popper.js": {
|
||||||
"version": "1.16.1",
|
"version": "1.16.1",
|
||||||
"resolved": "https://npm.aiursoft.cn/popper.js/-/popper.js-1.16.1.tgz",
|
"resolved": "https://npm.aiursoft.com/popper.js/-/popper.js-1.16.1.tgz",
|
||||||
"integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==",
|
"integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==",
|
||||||
"deprecated": "You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1",
|
"deprecated": "You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -136,13 +136,13 @@
|
|||||||
},
|
},
|
||||||
"node_modules/select": {
|
"node_modules/select": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://npm.aiursoft.cn/select/-/select-1.1.2.tgz",
|
"resolved": "https://npm.aiursoft.com/select/-/select-1.1.2.tgz",
|
||||||
"integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA==",
|
"integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/tiny-emitter": {
|
"node_modules/tiny-emitter": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://npm.aiursoft.cn/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
|
"resolved": "https://npm.aiursoft.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
|
||||||
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==",
|
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aiursoft/autodark.js": "^1.2.0",
|
"@aiursoft/autodark.js": "^1.2.0",
|
||||||
"@chrisoakman/chessboardjs": "^1.0.0",
|
"@chrisoakman/chessboardjs": "^1.0.0",
|
||||||
"chess.js": "^1.0.0-beta.6",
|
"chess.js": "^1.0.0",
|
||||||
"clipboard": "^2.0.11",
|
"clipboard": "^2.0.11",
|
||||||
"jquery-validation": "^1.19.5",
|
"jquery-validation": "^1.19.5",
|
||||||
"jquery-validation-unobtrusive": "^3.2.12",
|
"jquery-validation-unobtrusive": "^3.2.12",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<RootNamespace>Aiursoft.ChessServer.Tests</RootNamespace>
|
<RootNamespace>Aiursoft.ChessServer.Tests</RootNamespace>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
@@ -9,15 +9,14 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.3">
|
<PackageReference Include="coverlet.collector" Version="10.0.0">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="JunitXml.TestLogger" Version="5.0.0" />
|
<PackageReference Include="JunitXml.TestLogger" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="3.7.0" />
|
<PackageReference Include="MSTest.TestAdapter" Version="4.2.2" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="3.7.0" />
|
<PackageReference Include="AngleSharp" Version="1.4.0" />
|
||||||
<PackageReference Include="AngleSharp" Version="1.2.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\Aiursoft.ChessServer\Aiursoft.ChessServer.csproj" />
|
<ProjectReference Include="..\..\src\Aiursoft.ChessServer\Aiursoft.ChessServer.csproj" />
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using Aiursoft.ChessServer.Models;
|
|||||||
using Aiursoft.CSTools.Tools;
|
using Aiursoft.CSTools.Tools;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using static Aiursoft.WebTools.Extends;
|
using static Aiursoft.WebTools.Extends;
|
||||||
// ReSharper disable StringLiteralTypo
|
// ReSharper disable StringLiteralTypo
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ public class BasicTests
|
|||||||
public async Task GetChess(string url)
|
public async Task GetChess(string url)
|
||||||
{
|
{
|
||||||
CreateChallengeForTest(12345);
|
CreateChallengeForTest(12345);
|
||||||
|
|
||||||
var response = await _http.GetAsync(_endpointUrl + url);
|
var response = await _http.GetAsync(_endpointUrl + url);
|
||||||
response.EnsureSuccessStatusCode(); // Status Code 200-299
|
response.EnsureSuccessStatusCode(); // Status Code 200-299
|
||||||
}
|
}
|
||||||
@@ -91,15 +91,15 @@ public class BasicTests
|
|||||||
public async Task MoveChess(string action)
|
public async Task MoveChess(string action)
|
||||||
{
|
{
|
||||||
CreateChallengeForTest(12345);
|
CreateChallengeForTest(12345);
|
||||||
|
|
||||||
var endPoint = _endpointUrl.Replace("http", "ws") + $"/games/12345.ws?playerId={Guid.NewGuid()}";
|
var endPoint = _endpointUrl.Replace("http", "ws") + $"/games/12345.ws?playerId={Guid.NewGuid()}";
|
||||||
var socket = await endPoint.ConnectAsWebSocketServer();
|
var socket = await endPoint.ConnectAsWebSocketServer();
|
||||||
var socketStage = new MessageStageLast<string>();
|
var socketStage = new MessageStageLast<string>();
|
||||||
socket.Subscribe(socketStage);
|
socket.Subscribe(socketStage);
|
||||||
await Task.Factory.StartNew(() => socket.Listen());
|
await Task.Factory.StartNew(() => socket.Listen());
|
||||||
|
|
||||||
await socket.Send(action);
|
await socket.Send(action);
|
||||||
|
|
||||||
var waitMaxTime = new Stopwatch();
|
var waitMaxTime = new Stopwatch();
|
||||||
waitMaxTime.Start();
|
waitMaxTime.Start();
|
||||||
while (string.IsNullOrWhiteSpace(socketStage.Stage))
|
while (string.IsNullOrWhiteSpace(socketStage.Stage))
|
||||||
@@ -109,7 +109,7 @@ public class BasicTests
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waitMaxTime.ElapsedMilliseconds > 5000)
|
if (waitMaxTime.ElapsedMilliseconds > 5000)
|
||||||
{
|
{
|
||||||
Assert.Fail("Timeout that the server did not respond.");
|
Assert.Fail("Timeout that the server did not respond.");
|
||||||
@@ -133,17 +133,17 @@ public class BasicTests
|
|||||||
var socketStage = new MessageStageLast<string>();
|
var socketStage = new MessageStageLast<string>();
|
||||||
socket.Subscribe(socketStage);
|
socket.Subscribe(socketStage);
|
||||||
await Task.Factory.StartNew(() => socket.Listen());
|
await Task.Factory.StartNew(() => socket.Listen());
|
||||||
|
|
||||||
await socket.Send(action);
|
await socket.Send(action);
|
||||||
await Task.Delay(150);
|
await Task.Delay(150);
|
||||||
|
|
||||||
// fen equal init
|
// fen equal init
|
||||||
Assert.AreEqual("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", socketStage.Stage);
|
Assert.AreEqual("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", socketStage.Stage);
|
||||||
await socket.Close();
|
await socket.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Refactor tests!
|
// TODO Refactor tests!
|
||||||
|
|
||||||
// [TestMethod]
|
// [TestMethod]
|
||||||
// [DataRow(7)]
|
// [DataRow(7)]
|
||||||
// [DataRow(8)]
|
// [DataRow(8)]
|
||||||
@@ -155,11 +155,11 @@ public class BasicTests
|
|||||||
// var socketStage = new MessageStageLast<string>();
|
// var socketStage = new MessageStageLast<string>();
|
||||||
// socket.Subscribe(socketStage);
|
// socket.Subscribe(socketStage);
|
||||||
// await Task.Factory.StartNew(() => socket.Listen());
|
// await Task.Factory.StartNew(() => socket.Listen());
|
||||||
//
|
//
|
||||||
// await socket.Send("e4");
|
// await socket.Send("e4");
|
||||||
// await Task.Delay(150);
|
// await Task.Delay(150);
|
||||||
// Assert.AreEqual("rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1", socketStage.Stage);
|
// Assert.AreEqual("rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1", socketStage.Stage);
|
||||||
//
|
//
|
||||||
// await socket.Close();
|
// await socket.Close();
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@@ -179,17 +179,17 @@ public class BasicTests
|
|||||||
// var socket2Stage = new MessageStageLast<string>();
|
// var socket2Stage = new MessageStageLast<string>();
|
||||||
// socket2.Subscribe(socket2Stage);
|
// socket2.Subscribe(socket2Stage);
|
||||||
// await Task.Factory.StartNew(() => socket2.Listen());
|
// await Task.Factory.StartNew(() => socket2.Listen());
|
||||||
//
|
//
|
||||||
// await socket1.Send("e4");
|
// await socket1.Send("e4");
|
||||||
// await Task.Delay(150);
|
// await Task.Delay(150);
|
||||||
// Assert.AreEqual("rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1", socket1Stage.Stage);
|
// Assert.AreEqual("rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1", socket1Stage.Stage);
|
||||||
// Assert.AreEqual("rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1", socket2Stage.Stage);
|
// Assert.AreEqual("rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1", socket2Stage.Stage);
|
||||||
//
|
//
|
||||||
// await socket2.Send("e5");
|
// await socket2.Send("e5");
|
||||||
// await Task.Delay(150);
|
// await Task.Delay(150);
|
||||||
// Assert.AreEqual("rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2", socket1Stage.Stage);
|
// Assert.AreEqual("rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2", socket1Stage.Stage);
|
||||||
// Assert.AreEqual("rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2", socket2Stage.Stage);
|
// Assert.AreEqual("rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2", socket2Stage.Stage);
|
||||||
//
|
//
|
||||||
// await socket1.Close();
|
// await socket1.Close();
|
||||||
//
|
//
|
||||||
// var socket3 = await (_endpointUrl.Replace("http", "ws") + $"/games/{gameId}.ws?player=w")
|
// var socket3 = await (_endpointUrl.Replace("http", "ws") + $"/games/{gameId}.ws?player=w")
|
||||||
@@ -197,14 +197,14 @@ public class BasicTests
|
|||||||
// var socket3Stage = new MessageStageLast<string>();
|
// var socket3Stage = new MessageStageLast<string>();
|
||||||
// socket3.Subscribe(socket3Stage);
|
// socket3.Subscribe(socket3Stage);
|
||||||
// await Task.Factory.StartNew(() => socket3.Listen());
|
// await Task.Factory.StartNew(() => socket3.Listen());
|
||||||
//
|
//
|
||||||
// await socket3.Send("Nf3");
|
// await socket3.Send("Nf3");
|
||||||
// await Task.Delay(150);
|
// await Task.Delay(150);
|
||||||
// Assert.AreEqual("rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2", socket1Stage.Stage);
|
// Assert.AreEqual("rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2", socket1Stage.Stage);
|
||||||
// Assert.AreEqual("rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2", socket2Stage.Stage);
|
// Assert.AreEqual("rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2", socket2Stage.Stage);
|
||||||
// Assert.AreEqual("rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2", socket3Stage.Stage);
|
// Assert.AreEqual("rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2", socket3Stage.Stage);
|
||||||
//
|
//
|
||||||
// await socket3.Close();
|
// await socket3.Close();
|
||||||
// await socket2.Close();
|
// await socket2.Close();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user