-
Notifications
You must be signed in to change notification settings - Fork 45
180 lines (147 loc) · 6.06 KB
/
build_win.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Build - win
on:
release:
types: [created]
pull_request:
types: [opened, synchronize, reopened]
paths-ignore:
- "tools/**"
- "docs/**"
- ".vscode/**"
- ".devcontainer/**"
- ".github/**"
- "!.github/workflows/build_win.yml"
- "**.md"
jobs:
build-win-x64:
concurrency:
group: build-win-x64-${{ github.head_ref }}-${{ matrix.build_type }}
cancel-in-progress: true
runs-on: windows-latest
env:
PYTHONIOENCODING: utf-8
strategy:
matrix:
build_type: [debug, release]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
submodules: false
- name: Trust working directory
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Initialize and update submodules except docs/
shell: bash
run: |
# Retrieve all submodule paths, excluding `docs/`.
submodules=$(git config --file .gitmodules --get-regexp path | awk '$2 != "docs" { print $2 }')
git submodule init
for submodule in $submodules; do
echo "Initializing submodule: $submodule"
git submodule update --init --recursive "$submodule"
done
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/setup-go@v5
with:
go-version: "stable"
cache: false
- name: Install tools and dependencies
run: |
pip3 install --use-pep517 python-dotenv jinja2
go install golang.org/dl/go1.20.12@latest && go1.20.12 download
go env -w GOFLAGS="-buildvcs=false"
rustup default nightly
cargo install --force cbindgen
- name: Get Python executable path
run: |
$pythonPath = python -c "import sys; print(sys.executable)"
Write-Output "Python executable path: $pythonPath"
$pythonDir = Split-Path $pythonPath
Write-Output "Python directory path: $pythonDir"
echo "PYTHON3_PATH=$pythonDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- name: Use Python path
run: |
Write-Output "The Python directory is located at: $env:PYTHON3_PATH"
shell: pwsh
- name: Build
run: |
$ENV:PATH += ";$PWD/core/ten_gn"
tgn gen win x64 ${{ matrix.build_type }} -- vs_version=2022 log_level=1 enable_serialized_actions=true ten_enable_serialized_rust_action=true ten_rust_enable_gen_cargo_config=false ten_enable_cargo_clean=true ten_enable_python_binding=false ten_enable_go_binding=false ten_enable_nodejs_binding=false ten_enable_rust_incremental_build=false ten_manager_enable_frontend=false ten_enable_integration_tests_prebuilt=false
tgn build win x64 ${{ matrix.build_type }}
- name: Upload ten_packages
uses: actions/upload-artifact@v4
with:
name: ten_packages-win-${{ matrix.build_type }}-x64
path: |
out/win/x64/app/default_app_cpp
out/win/x64/ten_packages/system/ten_runtime
out/win/x64/ten_packages/extension/default_extension_cpp
- name: Package assets
if: startsWith(github.ref, 'refs/tags/')
shell: pwsh
working-directory: out/win/x64
run: |
Write-Host "Current directory: $(Get-Location)"
Compress-Archive -Path ./ten_manager/bin/tman/* -DestinationPath ./tman-win-${{ matrix.build_type }}-x64.zip -CompressionLevel Optimal
Compress-Archive -Path ./app/default_app_cpp/*, ./ten_packages/system/ten_runtime/*, ./ten_packages/extension/default_extension_cpp/* -DestinationPath ./ten_packages-win-${{ matrix.build_type }}-x64.zip -CompressionLevel Optimal
- name: Publish to release assets
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
out/win/x64/tman-win-${{ matrix.build_type }}-x64.zip
out/win/x64/ten_packages-win-${{ matrix.build_type }}-x64.zip
- name: Run Tests (ten_utils_unit_test)
env:
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
chmod +x out/win/x64/tests/standalone/ten_utils_unit_test
out/win/x64/tests/standalone/ten_utils_unit_test
- name: Run Tests (ten_runtime_unit_test)
env:
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
chmod +x out/win/x64/tests/standalone/ten_runtime_unit_test
out/win/x64/tests/standalone/ten_runtime_unit_test
- name: Run Tests (ten_runtime_smoke_test)
env:
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
chmod +x out/win/x64/tests/standalone/ten_runtime_smoke_test
out/win/x64/tests/standalone/ten_runtime_smoke_test
- name: Run Tests (ten_rust standalone tests)
run: |
cd out/win/x64/tests/standalone/ten_rust
chmod +x unit_test
chmod +x integration_test
./unit_test || { echo "ten_rust unit test failed"; exit 1; }
./integration_test || { echo "ten_rust integration test failed"; exit 1; }
- name: Run Tests (ten_manager standalone tests)
run: |
cd out/win/x64/tests/standalone/ten_manager
chmod +x unit_test
./unit_test || { echo "ten_manager unit test failed"; exit 1; }
- name: Install Python dependencies via script
run: |
python .github/tools/setup_pytest_dependencies.py
- name: Run Tests (ten_manager pytest tests)
run: |
cd out/win/x64/
pytest -s tests/ten_manager/
- name: Run Tests (ten_runtime pytest tests)
env:
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
$ENV:PATH += ";$PWD/core/ten_gn"
cd out/win/x64/
pytest -s tests/ten_runtime/integration/
# continue-on-error: true
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3