@@ -5,7 +5,8 @@ name: Lean Python Unit Tests
55# Lean unit test class that exercises Python code. We build this repo's
66# Python.Runtime.dll, build Lean against its NuGet QuantConnect.pythonnet
77# reference, drop the freshly built DLL over Lean's test output, and run only
8- # the test classes whose sources reference the Python interop layer.
8+ # the test classes whose sources reference the Python interop layer,
9+ # mirroring Lean's own .github/workflows/gh-actions.yml unit test job.
910
1011on :
1112 push :
@@ -19,8 +20,10 @@ concurrency:
1920
2021jobs :
2122 lean-python-unit-tests :
22- runs-on : ubuntu-24.04
23- timeout-minutes : 360
23+ runs-on : self-hosted
24+ container :
25+ image : quantconnect/lean:foundation
26+ options : --cpus 12 --memory 12g
2427 steps :
2528 - name : Checkout pythonnet
2629 uses : actions/checkout@v4
@@ -33,41 +36,19 @@ jobs:
3336 repository : QuantConnect/Lean
3437 path : Lean
3538
36- - name : Liberate disk space
37- uses : jlumbroso/free-disk-space@main
38- with :
39- tool-cache : true
40- large-packages : false
41- docker-images : false
42- swap-storage : false
43-
44- - name : Define docker helper
45- run : |
46- echo 'runInContainer() { docker exec test-container "$@"; }' > $HOME/ci_functions.sh
47- echo "BASH_ENV=$HOME/ci_functions.sh" >> $GITHUB_ENV
48-
49- - name : Start container
50- run : |
51- docker run -d \
52- --workdir /__w/pythonnet/pythonnet \
53- -v /home/runner/work:/__w \
54- --name test-container \
55- quantconnect/lean:foundation \
56- tail -f /dev/null
57-
5839 - name : Build Python.Runtime.dll
5940 run : |
60- runInContainer dotnet build pythonnet/src/runtime/Python.Runtime.csproj \
41+ dotnet build pythonnet/src/runtime/Python.Runtime.csproj \
6142 -c Release /v:quiet /p:WarningLevel=1
6243
6344 - name : Build Lean
6445 run : |
65- runInContainer dotnet build /p:Configuration=Release /v:quiet /p:WarningLevel=1 \
46+ dotnet build /p:Configuration=Release /v:quiet /p:WarningLevel=1 \
6647 Lean/QuantConnect.Lean.sln
6748
6849 - name : Inject freshly built Python.Runtime.dll into Lean test output
6950 run : |
70- runInContainer cp pythonnet/pythonnet/runtime/Python.Runtime.dll \
51+ cp pythonnet/pythonnet/runtime/Python.Runtime.dll \
7152 Lean/Tests/bin/Release/Python.Runtime.dll
7253
7354 - name : Generate Python unit test filter
10586
10687 - name : Run Lean Python unit tests
10788 run : |
108- runInContainer dotnet test Lean/Tests/bin/Release/QuantConnect.Tests.dll \
89+ dotnet test Lean/Tests/bin/Release/QuantConnect.Tests.dll \
10990 --blame-hang-timeout 300seconds --blame-crash \
11091 --settings lean-python-unit-tests.runsettings
0 commit comments