1+ # Changing the workflow name will reset the run number
2+ name : Build Nightly 12.1
3+
4+ on :
5+ workflow_dispatch :
6+ schedule :
7+ - cron : ' 0 2 * * *'
8+
9+
10+ env :
11+ MAJOR : 12
12+ MINOR : 1
13+ RUN : ${{ github.run_number }}
14+ TARGET_FRAMEWORK : net8
15+
16+ jobs :
17+ get-latest-commit-timespan :
18+ runs-on : ubuntu-latest
19+ outputs :
20+ LATEST_COMMIT_TIMESPAN : ${{ steps.get-latest-commit-timespan.outputs.LATEST_COMMIT_TIMESPAN}}
21+ steps :
22+ - name : Checkout code
23+ uses : actions/checkout@v4
24+ with :
25+ fetch-depth : 0
26+
27+ - name : Get the previous commit timespan
28+ id : get-latest-commit-timespan
29+ shell : bash
30+ run : |
31+ commit=$(git log origin/develop -1 --format="%at")
32+ echo $commit
33+ now=$(date +%s)
34+ echo $now
35+ timespan=$[now - commit]
36+ echo "Timespan: ${timespan}"
37+ echo "LATEST_COMMIT_TIMESPAN=${timespan}" >> $GITHUB_ENV
38+ echo "LATEST_COMMIT_TIMESPAN=${timespan}" >> $GITHUB_OUTPUT
39+
40+ build-nightly :
41+ needs : get-latest-commit-timespan
42+ if : needs.get-latest-commit-timespan.outputs.LATEST_COMMIT_TIMESPAN < 86400
43+ runs-on : windows-latest
44+ steps :
45+ - name : Checkout code
46+ uses : actions/checkout@v4
47+ with :
48+ submodules : ' true'
49+
50+ - name : Add msbuild to PATH
51+ uses : microsoft/setup-msbuild@v2
52+
53+ - name : Restore dependencies
54+ run : |
55+ nuget sources add -username Open-Systems-Pharmacology -password ${{ secrets.GITHUB_TOKEN }} -name OSP-GitHub-Packages -source "https://nuget.pkg.github.com/Open-Systems-Pharmacology/index.json"
56+ nuget sources add -name bddhelper -source https://ci.appveyor.com/nuget/ospsuite-bddhelper
57+ nuget sources add -name utility -source https://ci.appveyor.com/nuget/ospsuite-utility
58+ nuget sources add -name serializer -source https://ci.appveyor.com/nuget/ospsuite-serializer
59+ nuget sources add -name databinding -source https://ci.appveyor.com/nuget/ospsuite-databinding
60+ nuget sources add -name texreporting -source https://ci.appveyor.com/nuget/ospsuite-texreporting
61+ nuget sources add -name databinding-devexpress -source https://ci.appveyor.com/nuget/ospsuite-databinding-devexpress
62+ dotnet restore
63+
64+ - name : define env variables
65+ run : |
66+ echo "APP_VERSION=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.RUN }}" | Out-File -FilePath $env:GITHUB_ENV -Append
67+
68+ - name : Build
69+ run : |
70+ rake "update_go_license[ApplicationStartup.cs, ${{ secrets.GO_DIAGRAM_KEY }}]"
71+ msbuild PKSim.sln /p:Version=${{env.APP_VERSION}}
72+
73+ - name : Test
74+ run : dotnet test .\tests\**\bin\Debug\net472\PKSim*Tests.dll -v normal --no-build --logger:"html;LogFileName=../testLog_Windows.html"
75+
76+ - name : Create Setup
77+ run : |
78+ rake "create_setup[${{env.APP_VERSION}}, Debug]"
79+ rake "create_portable_setup[${{env.APP_VERSION}}, Debug, pk-sim-portable-setup.zip]"
80+
81+ - name : Create R dependency artifact
82+ run : |
83+ pushd . &&
84+ cd src\PKSimRDependencyResolution\bin\%CONFIGURATION%\%TARGET_FRAMEWORK% &&
85+ 7z.exe" a pk-sim-r-dependencies.zip -x@excludedFiles.txt * -xr!runtimes &&
86+ popd
87+
88+ - name : Push test log as artifact
89+ uses : actions/upload-artifact@v4
90+ with :
91+ name : testLog_Windows
92+ path : ./testLog*.html
93+
94+ - name : Push nightly installer as artifact
95+ uses : actions/upload-artifact@v4
96+ with :
97+ name : PKSim Installer ${{env.APP_VERSION}}
98+ path : setup\deploy\*.msi
99+
100+ - name : Push nightly portable as artifact
101+ uses : actions/upload-artifact@v4
102+ with :
103+ name : PKSim Portable ${{env.APP_VERSION}}
104+ path : setup\PKSim ${{env.APP_VERSION}}
105+
106+ - name : Push R dependencies as artifact
107+ uses : actions/upload-artifact@v4
108+ with :
109+ name : PKSim R Dependencies
110+ path : src\PKSimRDependencyResolution\bin\Debug\${{env.TARGET_FRAMEWORK}}\pk-sim-r-dependencies.zip
0 commit comments