-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #310 from eesast/dev
v1.0.0
- Loading branch information
Showing
2,337 changed files
with
577,174 additions
and
550 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
############################################################################### | ||
# Set default behavior to automatically normalize line endings. | ||
############################################################################### | ||
* text=auto | ||
|
||
############################################################################### | ||
# behavior for image files | ||
# image files are treated as binary by default. | ||
############################################################################### | ||
*.jpg binary | ||
*.png binary | ||
*.gif binary | ||
*.bmp binary | ||
*.ico binary | ||
*.jpeg binary | ||
*.jfif binary | ||
|
||
############################################################################### | ||
# diff behavior for common document formats | ||
# Convert binary document formats to text before diffing them. | ||
############################################################################### | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain | ||
|
||
############################################################################### | ||
# Force Windows cmd and batch scripts to always use crlf line endings so that if | ||
# a repo is accessed in Windows via a file share from Unix, the scripts will | ||
# work. | ||
############################################################################### | ||
*.cmd text eol=crlf | ||
*.bat text eol=crlf | ||
|
||
############################################################################### | ||
# Force bash scripts to always use lf line endings so that if a repo is accessed | ||
# in Unix via a file share from Windows, the scripts will work. | ||
############################################################################### | ||
*.sh text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [TCL606] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||
# patreon: # Replace with a single Patreon username | ||
# open_collective: # Replace with a single Open Collective username | ||
# ko_fi: # Replace with a single Ko-fi username | ||
# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
# liberapay: # Replace with a single Liberapay username | ||
# issuehunt: # Replace with a single IssueHunt username | ||
# otechie: # Replace with a single Otechie username | ||
# lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry | ||
# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
using System.Text.Json; | ||
|
||
Dictionary<string, string> MD5Data = new Dictionary<string, string>(); | ||
|
||
public string ConvertAbsToRel(string basePath, string fullPath) | ||
{ | ||
if (fullPath.StartsWith(basePath)) | ||
{ | ||
fullPath = fullPath.Replace(basePath, "."); | ||
} | ||
return fullPath; | ||
} | ||
|
||
public string GetFileMd5Hash(string strFileFullPath) | ||
{ | ||
var fst = new FileStream(strFileFullPath, FileMode.Open, FileAccess.Read); | ||
byte[] data = System.Security.Cryptography.MD5.Create().ComputeHash(fst); | ||
|
||
StringBuilder sBuilder = new StringBuilder(); | ||
|
||
for (int i = 0; i < data.Length; i++) | ||
{ | ||
sBuilder.Append(data[i].ToString("x2")); | ||
} | ||
|
||
fst.Close(); | ||
return sBuilder.ToString().ToLower(); | ||
} | ||
|
||
public static bool IsUserFile(string filename) | ||
{ | ||
if (filename.Contains("git") || filename.Contains("bin") || filename.Contains("obj")) | ||
return true; | ||
if (filename.EndsWith("sh") || filename.EndsWith("cmd")) | ||
return true; | ||
if (filename.EndsWith("gz")) | ||
return true; | ||
if (filename.Contains("AI.cpp") || filename.Contains("AI.py")) | ||
return true; | ||
if (filename.Contains("hash.json")) | ||
return true; | ||
if (filename.EndsWith("log")) | ||
return true; | ||
return false; | ||
} | ||
|
||
public void SaveMD5Data() | ||
{ | ||
FileStream fs = new FileStream(@"/home/runner/work/THUAI7/hash.json", FileMode.OpenOrCreate, FileAccess.ReadWrite); | ||
StreamWriter sw = new StreamWriter(fs); | ||
fs.SetLength(0); | ||
var exp1 = from i in MD5Data | ||
select new KeyValuePair<string, string>(i.Key.Replace(Path.DirectorySeparatorChar, '/'), i.Value); | ||
sw.Write(JsonSerializer.Serialize(exp1.ToDictionary<string, string>())); | ||
sw.Flush(); | ||
sw.Dispose(); | ||
fs.Dispose(); | ||
} | ||
|
||
public void ScanDir(string dir) | ||
{ | ||
var d = new DirectoryInfo(dir); | ||
foreach (var file in d.GetFiles()) | ||
{ | ||
var relFile = ConvertAbsToRel(@"/home/runner/work/THUAI7/", file.FullName); | ||
// 用户自己的文件不会被计入更新hash数据中 | ||
if (IsUserFile(relFile)) | ||
continue; | ||
var hash = GetFileMd5Hash(file.FullName); | ||
if (MD5Data.Keys.Contains(relFile)) | ||
{ | ||
if (MD5Data[relFile] != hash) | ||
{ | ||
MD5Data[relFile] = hash; | ||
} | ||
} | ||
else | ||
{ | ||
MD5Data.Add(relFile, hash); | ||
} | ||
} | ||
foreach (var d1 in d.GetDirectories()) { ScanDir(d1.FullName); } | ||
} | ||
|
||
ScanDir(@"/home/runner/work/THUAI7/"); | ||
SaveMD5Data(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Xml; | ||
|
||
string path = @"D:\a\THUAI7\"; | ||
Visit(new DirectoryInfo(path)); | ||
|
||
void Visit(DirectoryInfo root) | ||
{ | ||
foreach (var file in root.EnumerateFiles()) | ||
{ | ||
if (file.Name.EndsWith("csproj")) | ||
{ | ||
ChangeFile(file.FullName); | ||
} | ||
} | ||
foreach (var dir in root.EnumerateDirectories()) | ||
{ | ||
Visit(dir); | ||
} | ||
} | ||
|
||
void ChangeFile(string path) | ||
{ | ||
var document = new XmlDocument(); | ||
document.Load(path); | ||
var es = document.GetElementsByTagName("TargetFrameworks"); | ||
if (es.Count == 2) | ||
{ | ||
var i0 = es[0]; | ||
var i1 = es[1]; | ||
var text = i1.InnerText; | ||
i0.InnerText = text.Split(';')[1]; | ||
i0.ParentNode.RemoveChild(i1); | ||
} | ||
document.Save(path); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,57 @@ | ||
name: build | ||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: [dev, main, master] | ||
pull_request: | ||
branches: [dev, main, master] | ||
jobs: | ||
dotnet-build: | ||
dotnet-build-logic: | ||
if: true | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v3 | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 6.0.x | ||
|
||
dotnet-version: 8.0.x | ||
- name: Setup dotnet-script | ||
run: dotnet tool install --global dotnet-script | ||
- name: Pre-Process1 | ||
run: dotnet script .github/preProcess/MauiEnvConfig.csx | ||
- name: Install Workloads | ||
run: dotnet workload install maui-windows | ||
- name: Build Proto | ||
run: dotnet build "./dependency/proto/Protos.csproj" -c Release | ||
- name: Build Logic | ||
run: dotnet build "./logic/logic.sln" -c Release | ||
|
||
dotnet-build-install: | ||
if: true | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
- name: Setup dotnet-script | ||
run: dotnet tool install --global dotnet-script | ||
- name: Pre-Process1 | ||
run: dotnet script .github/preProcess/MauiEnvConfig.csx | ||
- name: Install Workloads | ||
run: dotnet workload install maui-windows | ||
- name: Build Installer | ||
run: dotnet build "./installer/installer.sln" -c Release | ||
|
||
dotnet-build-launcher: | ||
if: true | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Build Launcher | ||
run: dotnet build "./launcher/launcher.sln" -c Release | ||
|
||
- name: Build Playback | ||
run: dotnet build "./playback/playback.sln" -c Release | ||
run: dotnet build "./launcher/launcher.sln" -c Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: "docker" | ||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
upload_docker_images: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Log in to DockerHub | ||
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
#- name: Build base docker image | ||
# run: docker build -t ${{ secrets.DOCKER_USERNAME }}/thuai7_base:base -f ./dependency/Dockerfile/Dockerfile_base . | ||
#- name: Push base image to DockerHub | ||
# run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_base:base | ||
|
||
|
||
- name: Build cpp_compile docker image | ||
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/thuai7_cpp:latest -f ./dependency/Dockerfile/Dockerfile_cpp . | ||
- name: Push cpp_compile image to DockerHub | ||
run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_cpp:latest | ||
|
||
- name: Build run_server docker image | ||
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/thuai7_run_server:latest -f ./dependency/Dockerfile/Dockerfile_run_server . | ||
- name: Push run_server image to DockerHub | ||
run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_run_server:latest | ||
|
||
- name: Build run_client docker image | ||
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/thuai7_run_client:latest -f ./dependency/Dockerfile/Dockerfile_run_client . | ||
- name: Push run_client image to DockerHub | ||
run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_run_client:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,75 @@ | ||
name: format | ||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: [dev, main, master] | ||
pull_request: | ||
branches: [dev, main, master] | ||
jobs: | ||
clang-format-checking: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- uses: DoozyX/[email protected] | ||
with: | ||
source: '.' | ||
extensions: 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx,i,ixx,ipp,i++' | ||
clangFormatVersion: 14 | ||
exclude: './players' | ||
inplace: False | ||
dotnet-format-checking: | ||
|
||
dotnet-format-checking-logic: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v3 | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 6.0.x | ||
dotnet-version: 8.0.x | ||
|
||
- name: Check Logic | ||
run: | | ||
dotnet restore "./logic/logic.sln" | ||
dotnet format "./logic/logic.sln" --severity error --no-restore --verify-no-changes | ||
dotnet-format-checking-installer: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Check Installer | ||
run: | | ||
dotnet restore "./installer/installer.sln" | ||
dotnet format "./installer/installer.sln" --severity error --no-restore --verify-no-changes | ||
dotnet-format-checking-launcher: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Check Launcher | ||
run: | | ||
dotnet restore "./launcher/launcher.sln" | ||
dotnet format "./launcher/launcher.sln" --severity error --no-restore --verify-no-changes | ||
- name: Check Playback | ||
dotnet-format-checking-interface: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Check Interface | ||
run: | | ||
dotnet restore "./playback/playback.sln" | ||
dotnet format "./playback/playback.sln" --severity error --no-restore --verify-no-changes | ||
dotnet format whitespace "./interface/interface_live/Assets/Scripts/" --folder --verify-no-changes | ||
dotnet format whitespace "./interface/interface_playback/Assets/Scripts/" --folder --verify-no-changes | ||
dotnet format whitespace "./interface/interface_local/Assets/Scripts/" --folder --verify-no-changes |
Oops, something went wrong.