1- # .github/workflows/build.yml
2-
31name : Build Sierra Chart Study DLL
42
53on :
64 push :
75 branches : [ "main" ]
8- pull_request :
9- branches : [ "main" ]
6+ tags :
7+ - " v* " # e.g. v1.0.0
108
119env :
1210 PROJECT_NAME : scsf_StrategyOptimizer
@@ -27,35 +25,49 @@ jobs:
2725 with :
2826 arch : x64
2927
30- - name : Set up Build Flags
31- id : build_flags
32- shell : bash
33- run : |
34- if [ "${{ matrix.configuration }}" == "Debug" ]; then
35- echo "COMPILER_FLAGS=/LD /std:c++17 /EHa /Zc:wchar_t /Z7 /Od /GS /W3 /RTC1 /Zc:inline /D _WINDOWS /D _USRDLL /D _WINDLL /Gd /Gy /GR- /GF /fp:precise /MTd /WX- /nologo" >> $GITHUB_ENV
36- echo "LINKER_FLAGS=Gdi32.lib User32.lib Shell32.lib /DLL /DYNAMICBASE /DEBUG /INCREMENTAL:NO /OPT:REF /MACHINE:X64" >> $GITHUB_ENV
37- elif [ "${{ matrix.configuration }}" == "Release" ]; then
38- echo "COMPILER_FLAGS=/LD /std:c++17 /EHa /Zc:wchar_t /GS /GL /W3 /O2 /Zc:inline /D NDEBUG /D _WINDOWS /D _USRDLL /D _WINDLL /Oy /Gd /Gy /Oi /GR- /GF /Ot /fp:precise /MT /WX- /nologo" >> $GITHUB_ENV
39- echo "LINKER_FLAGS=Gdi32.lib User32.lib Shell32.lib /DLL /DYNAMICBASE /INCREMENTAL:NO /OPT:REF /OPT:ICF /MACHINE:X64" >> $GITHUB_ENV
40- fi
41-
4228 - name : Build ${{ matrix.configuration }}
4329 shell : pwsh
4430 run : |
45- $CPP_FILES = (Get-ChildItem -Path ./StrategyOptimizer -Filter *.cpp).FullName
31+ $CPP_FILES = @(
32+ "StrategyOptimizer.cpp",
33+ "ResultAnalyzer.cpp",
34+ "ReplayManager.cpp",
35+ "OnChartLogging.cpp",
36+ "Logging.cpp",
37+ "ConfigManager.cpp",
38+ "StrategyOptimizerHelpers.cpp",
39+ "CombinationGenerator.cpp"
40+ ) | ForEach-Object { Join-Path "StrategyOptimizer" $_ }
41+
4642 $OUTPUT_DIR = "build\${{ matrix.configuration }}"
47- $OUTPUT_DLL = "$OUTPUT_DIR\${{ env.PROJECT_NAME }}.dll"
4843 New-Item -ItemType Directory -Force -Path $OUTPUT_DIR | Out-Null
44+ $OUTPUT_DLL = "$OUTPUT_DIR\${{ env.PROJECT_NAME }}.dll"
4945
50- # Split the flag strings into arrays of individual arguments
51- $CompilerArgs = $env:COMPILER_FLAGS.Split(' ')
52- $LinkerArgs = $env:LINKER_FLAGS.Split(' ')
53-
54- # Execute the build command
55- cl.exe $CompilerArgs $CPP_FILES /link $LinkerArgs /OUT:"$OUTPUT_DLL"
46+ if ("${{ matrix.configuration }}" -eq "Debug") {
47+ cl /JMC /MP /analyze- /Zc:wchar_t /Z7 /Od /GS /W3 /RTC1 /Zc:inline /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /Gd /Gy /GR- /GF /fp:precise /MTd /std:c++17 /LD /EHa /WX- /diagnostics:classic /nologo $CPP_FILES /link Gdi32.lib User32.lib Shell32.lib /DLL /DYNAMICBASE /DEBUG /INCREMENTAL:NO /OPT:REF /MACHINE:X64 /OUT:$OUTPUT_DLL
48+ }
49+ elseif ("${{ matrix.configuration }}" -eq "Release") {
50+ cl /Zc:wchar_t /GS /GL /W3 /O2 /Zc:inline /D NDEBUG /D _WINDOWS /D _USRDLL /D _WINDLL /Oy /Gd /Gy /Oi /GR- /GF /Ot /fp:precise /MT /std:c++17 /LD /EHa /WX- /nologo $CPP_FILES /link Gdi32.lib User32.lib Shell32.lib /DLL /DYNAMICBASE /INCREMENTAL:NO /OPT:REF /OPT:ICF /MACHINE:X64 /OUT:$OUTPUT_DLL
51+ }
5652
5753 - name : Upload Artifact
5854 uses : actions/upload-artifact@v4
5955 with :
6056 name : ${{ env.PROJECT_NAME }}-${{ matrix.configuration }}
61- path : build/${{ matrix.configuration }}/${{ env.PROJECT_NAME }}.dll
57+ path : build/${{ matrix.configuration }}/${{ env.PROJECT_NAME }}.dll
58+
59+ release :
60+ runs-on : ubuntu-latest
61+ needs : build
62+ steps :
63+ - name : Download all artifacts
64+ uses : actions/download-artifact@v4
65+ with :
66+ path : dist
67+
68+ - name : Create GitHub Release
69+ uses : softprops/action-gh-release@v2
70+ with :
71+ files : dist/**/*
72+ env :
73+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments