Skip to content

Commit 4d2e7b7

Browse files
authored
Merge pull request #117 from lch24/dev
docker
2 parents 64045ba + 6e5458e commit 4d2e7b7

25 files changed

Lines changed: 1956 additions & 82 deletions

.dockerignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# ── IDE / editor ──────────────────────────────────────────────────────
2+
.vs/
3+
.vscode/
4+
.idea/
5+
*.suo
6+
*.user
7+
8+
# ── THUAI8 legacy (not used in THUAI9) ────────────────────────────────
9+
/Dockerfile/
10+
/shell/
11+
12+
# ── CAPI pre-compiled libs (Windows, useless in Linux containers) ─────
13+
/CAPI/cpp/lib/
14+
/CAPI/cpp/grpc/
15+
/CAPI/cpp/x64/
16+
/CAPI/cpp/out/
17+
/CAPI/cpp/build/
18+
19+
# ── .NET build outputs ────────────────────────────────────────────────
20+
**/[Bb]in/
21+
**/[Oo]bj/
22+
23+
# ── Native build artifacts ────────────────────────────────────────────
24+
*.ilk
25+
*.pdb
26+
*.VC.db
27+
*.opendb
28+
*.Iscache
29+
*.lscache
30+
*.cache
31+
32+
# ── Playback / runtime artifacts ──────────────────────────────────────
33+
*.thuaipb
34+
mygame.thuaipb
35+
36+
# ── Git ───────────────────────────────────────────────────────────────
37+
.git/

.github/workflows/deploy.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: deploy
2+
on:
3+
push:
4+
branches: [main]
5+
jobs:
6+
build:
7+
runs-on: windows-latest
8+
steps:
9+
- uses: actions/checkout@v6
10+
- name: Setup .NET Core
11+
uses: actions/setup-dotnet@v5
12+
with:
13+
dotnet-version: 8.0.x
14+
# FIXME: .github/preProcess/AvaloniaEnvConfig.csx not yet ported from THUAI8
15+
# - name: Setup dotnet-script
16+
# run: dotnet tool install --global dotnet-script
17+
# - name: Pre-Process
18+
# run: dotnet script .github/preProcess/AvaloniaEnvConfig.csx
19+
- name: Install Workloads
20+
run: dotnet workload install maui-windows
21+
- name: Create Folders
22+
run: |
23+
mkdir D:\a\installer
24+
mkdir D:\a\publish
25+
- name: Copy THUAI9
26+
run: Copy-Item -recurse D:\a\THUAI9\THUAI9\ D:\a\mirror\
27+
- name: Remove directories not needed
28+
run: |
29+
Remove-Item -recurse -force D:\a\mirror\.git
30+
Remove-Item -recurse D:\a\mirror\.github
31+
Remove-Item -recurse D:\a\mirror\installer
32+
Remove-Item -recurse D:\a\mirror\interface
33+
Remove-Item -recurse D:\a\mirror\logic
34+
Remove-Item -recurse D:\a\mirror\resource
35+
Remove-Item -recurse D:\a\mirror\LICENSE
36+
Remove-Item -recurse D:\a\mirror\.clang-format
37+
Remove-Item -recurse D:\a\mirror\.editorconfig
38+
Remove-Item -recurse D:\a\mirror\.gitattributes
39+
Remove-Item -recurse D:\a\mirror\.gitignore
40+
Remove-Item -recurse D:\a\mirror\renovate.json
41+
Remove-Item -recurse D:\a\mirror\CODE_OF_CONDUCT.md
42+
Remove-Item -recurse D:\a\mirror\CONTRIBUTING.md
43+
Remove-Item -recurse D:\a\mirror\README.md
44+
Remove-Item -recurse D:\a\mirror\SECURITY.md
45+
- name: Build Server
46+
run: |
47+
mkdir D:\a\mirror\logic
48+
dotnet build "./logic/Server/Server.csproj" -o "D:\a\mirror\logic\Server" -p:WindowsAppSDKSelfContained=true -c Release
49+
- name: Build installer
50+
run: dotnet publish "./installer/installer.csproj" -o "D:\a\publish" -f net8.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true
51+
- name: Build debug_interface
52+
run: dotnet publish interface/AvaloniaUI/THUAI9_Avalonia.csproj -r win-x64 -c Release -o "D:\a\mirror\logic\Client"
53+
- name: Create tar.gz archive
54+
run: |
55+
cd D:\a
56+
tar -czf THUAI9.tar.gz -C mirror .
57+
- name: package tar.gz
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: THUAI9.tar.gz
61+
path: D:\a\THUAI9.tar.gz
62+
- name: package installer
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: installer
66+
path: D:\a\publish\
67+
env:
68+
INSTALLER_COS_SECRET_ID: ${{ secrets.INSTALLER_COS_SECRET_ID }}
69+
INSTALLER_COS_SECRET_KEY: ${{ secrets.INSTALLER_COS_SECRET_KEY }}

.github/workflows/docker-base.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: docker-base
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
paths:
7+
- dependency/Dockerfile/Dockerfile_base
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
publish-base:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v6
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Log in to Docker Hub
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ secrets.DOCKER_USERNAME }}
27+
password: ${{ secrets.DOCKER_PASSWORD }}
28+
29+
- name: Build and push base image
30+
run: |
31+
docker build \
32+
-f dependency/Dockerfile/Dockerfile_base \
33+
-t "${{ secrets.DOCKER_USERNAME }}/thuai9_base:base" \
34+
.
35+
docker push "${{ secrets.DOCKER_USERNAME }}/thuai9_base:base"

.github/workflows/docker-ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: docker-ci
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
docker-build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v6
16+
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
20+
- name: Set base image (local)
21+
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/dev'
22+
run: echo "BASE_IMAGE=thuai9_base:base" >> $GITHUB_ENV
23+
24+
- name: Build base image (local)
25+
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/dev'
26+
run: |
27+
docker build \
28+
-f dependency/Dockerfile/Dockerfile_base \
29+
-t thuai9_base:base \
30+
.
31+
32+
- name: Set base image (registry)
33+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
34+
run: echo "BASE_IMAGE=${{ secrets.DOCKER_USERNAME }}/thuai9_base:base" >> $GITHUB_ENV
35+
36+
- name: Log in to Docker Hub
37+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
38+
uses: docker/login-action@v3
39+
with:
40+
username: ${{ secrets.DOCKER_USERNAME }}
41+
password: ${{ secrets.DOCKER_PASSWORD }}
42+
43+
- name: Pull base image
44+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
45+
run: docker pull "${{ secrets.DOCKER_USERNAME }}/thuai9_base:base"
46+
47+
- name: Build server image
48+
run: |
49+
docker build \
50+
-f dependency/Dockerfile/Dockerfile_run_server \
51+
-t thuai9_server_ci \
52+
.
53+
54+
- name: Build Python client image
55+
run: |
56+
docker build \
57+
--build-arg BASE_IMAGE="${{ env.BASE_IMAGE }}" \
58+
-f dependency/Dockerfile/Dockerfile_run_client \
59+
-t thuai9_client_ci \
60+
.
61+
62+
- name: Build C++ client image
63+
run: |
64+
docker build \
65+
--build-arg BASE_IMAGE="${{ env.BASE_IMAGE }}" \
66+
-f dependency/Dockerfile/Dockerfile_cpp \
67+
-t thuai9_cpp_ci \
68+
.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: docker-release
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
publish-images:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v6
16+
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
20+
- name: Log in to Docker Hub
21+
uses: docker/login-action@v3
22+
with:
23+
username: ${{ secrets.DOCKER_USERNAME }}
24+
password: ${{ secrets.DOCKER_PASSWORD }}
25+
26+
- name: Pull base image
27+
run: docker pull "${{ secrets.DOCKER_USERNAME }}/thuai9_base:base"
28+
29+
- name: Build and push server image
30+
run: |
31+
docker build \
32+
-f dependency/Dockerfile/Dockerfile_run_server \
33+
-t "${{ secrets.DOCKER_USERNAME }}/thuai9_run_server:latest" \
34+
.
35+
docker push "${{ secrets.DOCKER_USERNAME }}/thuai9_run_server:latest"
36+
37+
- name: Build and push Python client image
38+
run: |
39+
docker build \
40+
--build-arg BASE_IMAGE="${{ secrets.DOCKER_USERNAME }}/thuai9_base:base" \
41+
-f dependency/Dockerfile/Dockerfile_run_client \
42+
-t "${{ secrets.DOCKER_USERNAME }}/thuai9_run_client:latest" \
43+
.
44+
docker push "${{ secrets.DOCKER_USERNAME }}/thuai9_run_client:latest"
45+
46+
- name: Build and push C++ client image
47+
run: |
48+
docker build \
49+
--build-arg BASE_IMAGE="${{ secrets.DOCKER_USERNAME }}/thuai9_base:base" \
50+
-f dependency/Dockerfile/Dockerfile_cpp \
51+
-t "${{ secrets.DOCKER_USERNAME }}/thuai9_cpp:latest" \
52+
.
53+
docker push "${{ secrets.DOCKER_USERNAME }}/thuai9_cpp:latest"

.github/workflows/format.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
source: "."
1515
extensions: "c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx,i,ixx,ipp,i++"
1616
clangFormatVersion: 14
17-
exclude: "./CAPI/cpp/grpc/include ./CAPI/cpp/proto ./CAPI/cpp/tclap/include/tclap ./dependency/proto ./CAPI/cpp/spdlog/include/spdlog ./CAPI/cpp/fmt ./CAPI/cpp/out"
17+
exclude: "./CAPI/cpp/grpc/include ./CAPI/cpp/proto ./dependency/proto ./CAPI/cpp/spdlog/include/spdlog ./CAPI/cpp/fmt ./CAPI/cpp/out"
1818
inplace: False
1919

2020
dotnet-format-checking:
@@ -40,3 +40,7 @@ jobs:
4040
run: |
4141
dotnet restore "./playback/playback.sln"
4242
dotnet format "./playback/playback.sln" --severity error --no-restore --verify-no-changes
43+
44+
- name: Check Interface (Unity)
45+
run: |
46+
dotnet format whitespace "./interface/Unity/Assets/Scripts/" --folder --verify-no-changes

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ logs/
2424
*.pdb
2525
*.VC.db
2626
*.VC.VC.opendb
27+
*.Iscache
28+
*.lscache
29+
*.cache
30+
*.claude
2731

2832
# Playback / runtime artifacts
2933
*.thuaipb

0 commit comments

Comments
 (0)