Init project.

This commit is contained in:
xuef
2023-11-25 08:10:53 +00:00
parent 04241a3344
commit e1aeeada35
7 changed files with 232 additions and 80 deletions
+35
View File
@@ -0,0 +1,35 @@
root = true
[*]
# Some CSS Resharper doesn't know how to load.
resharper_unknown_css_class_highlighting=none
# Some JS Resharper doesn't know how to load.
resharper_undeclared_global_variable_using_highlighting=suggesting
# Some HTML reference Resharper doesn't know how to load.
resharper_html_path_error_highlighting=none
# Allow JS global var.
resharper_use_of_implicit_global_in_function_scope_highlighting=none
# Stop suggesting IE compatibility.
resharper_css_browser_compatibility_highlighting=none
# Localization might not be finished.
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.
resharper_access_to_modified_closure_highlighting=suggestion
# Suppress id not resolved because resharper can't understand
resharper_html_id_not_resolved_highlighting=suggestion
# Allow all cllass in the same namepsace.
resharper_check_namespace_highlighting=none
+18
View File
@@ -0,0 +1,18 @@
.vs/
.idea/
*.lock.json
package-lock.json
*.user
*.min.css
*.min.js
bin/
obj/
node_modules/
Properties/
npm-debug.log
yarn.lock
bundle.js
appsettings.Production.json
appsettings.Development.json
*.log
TestResults/
+120
View File
@@ -0,0 +1,120 @@
stages:
- build
- lint
- test
- publish
- deploy
before_script:
- 'export DOTNET_CLI_TELEMETRY_OPTOUT=1'
- 'export PATH=$PATH:$HOME/.dotnet/tools'
- 'dotnet tool install JetBrains.ReSharper.GlobalTools --global || echo "JB already installed."'
- 'dotnet tool install dotnet-reportgenerator-globaltool --global || echo "DRG already installed."'
- 'cat /etc/lsb-release && uname -a && pwd && ls -ashl'
- 'echo "Hostname: $(hostname)"'
- 'echo "Uptime: $(uptime -p)"'
- 'echo "Memory: $(free -h | awk "/^Mem:/{print \$2}")"'
- 'echo "CPU Cores: $(nproc)"'
- 'echo "Available Disk Space: $(df -h --output=avail / | tail -1)"'
- 'echo "IP Address: $(hostname -I)"'
- 'dotnet --info'
restore:
stage: build
script:
- dotnet restore --no-cache --configfile nuget.config
build:
stage: build
needs:
- restore
script:
- dotnet build -maxcpucount:1 --no-self-contained
lint:
stage: lint
needs:
- build
script:
- jb inspectcode ./*.sln --output=analyze_output.xml --build
- grep 'WARNING' analyze_output.xml && cat analyze_output.xml && exit 1 || echo "No warning found"
artifacts:
when: always
expire_in: 1 day
paths:
- ./analyze_output.xml
test:
stage: test
needs:
- build
coverage: '/TOTAL_COVERAGE=(\d+.\d+)/'
script:
- dotnet test *.sln --collect:"XPlat Code Coverage" --logger "junit;MethodFormat=Class;FailureBodyFormat=Verbose"
- reportgenerator -reports:"**/coverage.cobertura.xml" -targetdir:"." -reporttypes:"cobertura"
- COVERAGE_VALUE=$(grep -oPm 1 'line-rate="\K([0-9.]+)' "./Cobertura.xml")
- COVERAGE_PERCENTAGE=$(echo "scale=2; $COVERAGE_VALUE * 100" | bc)
- 'echo "TOTAL_COVERAGE=$COVERAGE_PERCENTAGE%"'
artifacts:
when: always
expire_in: 1 day
paths:
- ./**/TestResults.xml
- ./Cobertura.xml
reports:
junit:
- ./**/TestResults.xml
coverage_report:
coverage_format: cobertura
path: ./Cobertura.xml
publish:
stage: publish
needs:
- lint
- test
script:
- dotnet publish -maxcpucount:1 --configuration Release --runtime linux-x64 --no-self-contained *.sln
pack:
stage: publish
needs:
- lint
- test
script:
- dotnet build -maxcpucount:1 --configuration Release --no-self-contained *.sln
- dotnet pack -maxcpucount:1 --configuration Release *.sln || echo "Some packaging failed!"
artifacts:
expire_in: 1 week
paths:
- '**/*.nupkg'
upload_to_nuget:
stage: deploy
environment: production
needs:
- pack
dependencies:
- pack
script:
- |
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;
done
only:
- master
upload_to_local_nuget:
stage: deploy
environment: production
needs:
- pack
dependencies:
- 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;
done
only:
- master
+14
View File
@@ -0,0 +1,14 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Aiursoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+17 -80
View File
@@ -1,92 +1,29 @@
# ChessServer
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitlab.aiursoft.cn/aiursoft/ChessServer/-/blob/master/LICENSE)
[![Pipeline stat](https://gitlab.aiursoft.cn/aiursoft/ChessServer/badges/master/pipeline.svg)](https://gitlab.aiursoft.cn/aiursoft/ChessServer/-/pipelines)
[![Test Coverage](https://gitlab.aiursoft.cn/aiursoft/ChessServer/badges/master/coverage.svg)](https://gitlab.aiursoft.cn/aiursoft/ChessServer/-/pipelines)
[![ManHours](https://manhours.aiursoft.cn/r/gitlab.aiursoft.cn/aiursoft/ChessServer.svg)](https://gitlab.aiursoft.cn/aiursoft/ChessServer/-/commits/master?ref_type=heads)
ChessServer is just a simple chess server for [Aiursoft](https://www.aiursoft.com) to test our new features.
## Getting started
## Run locally
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Requirements about how to run
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
1. [.NET 7 SDK](http://dot.net/)
2. Execute `dotnet run` to run the app
3. Use your browser to view [http://localhost:5000](http://localhost:5000)
## Add your files
## Run in Microsoft Visual Studio
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
1. Open the `.sln` file in the project path.
2. Press `F5`.
```
cd existing_repo
git remote add origin https://gitlab.aiursoft.cn/aiursoft/chessserver.git
git branch -M master
git push -uf origin master
```
## How to contribute
## Integrate with your tools
There are many ways to contribute to the project: logging bugs, submitting pull requests, reporting issues, and creating suggestions.
- [ ] [Set up project integrations](https://gitlab.aiursoft.cn/aiursoft/chessserver/-/settings/integrations)
Even if you with push rights on the repository, you should create a personal fork and create feature branches there when you need them. This keeps the main repository clean and your workflow cruft out of sight.
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
We're also interested in your feedback on the future of this project. You can submit a suggestion or feature request through the issue tracker. To make this process more effective, we're asking that these include more information to help define them more clearly.
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget" value="https://nuget.aiursoft.cn/v3/index.json" />
</packageSources>
</configuration>