Build Nightly 12.2 #125
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Changing the workflow name will reset the run number | |
| name: Build Nightly 12.1 | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 2 * * *' | |
| env: | |
| MAJOR: 12 | |
| MINOR: 1 | |
| RUN: ${{ github.run_number }} | |
| TARGET_FRAMEWORK: net8 | |
| jobs: | |
| get-latest-commit-timespan: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| LATEST_COMMIT_TIMESPAN: ${{ steps.get-latest-commit-timespan.outputs.LATEST_COMMIT_TIMESPAN}} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get the previous commit timespan | |
| id: get-latest-commit-timespan | |
| shell: bash | |
| run: | | |
| commit=$(git log origin/develop -1 --format="%at") | |
| echo $commit | |
| now=$(date +%s) | |
| echo $now | |
| timespan=$[now - commit] | |
| echo "Timespan: ${timespan}" | |
| echo "LATEST_COMMIT_TIMESPAN=${timespan}" >> $GITHUB_ENV | |
| echo "LATEST_COMMIT_TIMESPAN=${timespan}" >> $GITHUB_OUTPUT | |
| build-nightly: | |
| needs: get-latest-commit-timespan | |
| if: needs.get-latest-commit-timespan.outputs.LATEST_COMMIT_TIMESPAN < 86400 | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - name: Restore dependencies | |
| run: | | |
| 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" | |
| nuget restore | |
| - name: define env variables | |
| run: | | |
| echo "APP_VERSION=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.RUN }}" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| - name: Build | |
| run: | | |
| dotnet build InstallationValidator.sln /p:Version=${{env.APP_VERSION}} | |
| - name: Test | |
| run: dotnet test .\tests\**\bin\Debug\net472\InstallationValidator*Tests.dll --filter “TestCategory!=Reporting” --no-build -v normal --logger:"html;LogFileName=../testLog_Windows.html" | |
| - name: Create Setup | |
| run: | | |
| rake "create_setup[${{env.APP_VERSION}}, Debug]" | |
| - name: Push test log as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: testLog_Windows | |
| path: ./testLog*.html | |
| - name: Push nightly installer as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Installation Validator Installer ${{env.APP_VERSION}} | |
| path: setup\deploy\*.msi | |
| cleanup-job: | |
| needs: get-latest-commit-timespan | |
| if: needs.get-latest-commit-timespan.outputs.LATEST_COMMIT_TIMESPAN >= 86400 | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: write | |
| steps: | |
| - name: Cancel workflow run | |
| run: | | |
| curl -L \ | |
| -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel" |