Skip to content

Commit 1e261be

Browse files
authored
Fixes #2426 Build on GitHub Actions instead of AppVeyor (#2428)
* Fixes #2426 Build on GitHub Actions instead of AppVeyor * add msbuild to path * restore * windows env variables * consolidate packages * reduce number of build digits * remove appveyor from sln * coverage GHA * rename action * tokenize * using: "composite" * detailedXML * remove unused switches * use OSP workflow * ref main * coverage on a schedule
1 parent 0f8f775 commit 1e261be

59 files changed

Lines changed: 285 additions & 250 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Build and Publish
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- develop
8+
9+
env:
10+
MAJOR: 12
11+
MINOR: 1
12+
RUN: ${{ github.run_number }}
13+
14+
jobs:
15+
get-version:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
BUILD_ID: ${{ steps.get_build_id.outputs.BUILD_ID}}
19+
APP_VERSION: ${{ steps.get_app_version.outputs.APP_VERSION}}
20+
steps:
21+
- name: Get New Build Number
22+
id: get_build_id
23+
shell: bash
24+
run: |
25+
26+
# Get the build ID
27+
if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref_name }}" == "${{ github.event.repository.default_branch }}" ]]; then
28+
# Fetch the latest version from the organization NuGet package
29+
response=$(curl -s -L \
30+
-H "Accept: application/vnd.github+json" \
31+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
32+
-H "X-GitHub-Api-Version: 2022-11-28" \
33+
https://api.github.com/orgs/Open-Systems-Pharmacology/packages/nuget/OSPSuite.Core/versions)
34+
35+
# Log the raw response for debugging
36+
echo "API Response: $response"
37+
38+
# Check if the response indicates a package not found error or is not valid JSON
39+
if echo "$response" | jq -e '.message == "Package not found." or (.[0].name // empty | length == 0)' >/dev/null 2>&1; then
40+
# Set the build number to 15 if no package is found or response is invalid (since the last build was 12.1.14)
41+
new_build_id=15
42+
else
43+
latest_version=$(echo "$response" | jq -r '.[0].name // empty')
44+
45+
# Extract MAJOR, MINOR from the latest version
46+
IFS='.' read -r last_major last_minor last_build <<< "$latest_version"
47+
48+
# Compare with the current MAJOR, MINOR
49+
if [[ "$last_major" -eq "${{ env.MAJOR }}" && "$last_minor" -eq "${{ env.MINOR }}" ]]; then
50+
# Increment the last number if they match
51+
new_build_id=$((last_build + 1))
52+
else
53+
# Reset build number to 0 if the current version is different
54+
new_build_id=0
55+
fi
56+
fi
57+
58+
echo "latest build number: ${latest_version:-'None found'}"
59+
echo "new build number: ${new_build_id}"
60+
build_id="${new_build_id}"
61+
else
62+
build_id="9${{ env.RUN }}"
63+
fi
64+
65+
echo "New Build ID: ${build_id}"
66+
echo "BUILD_ID=${build_id}" >> $GITHUB_ENV
67+
echo "BUILD_ID=${build_id}" >> $GITHUB_OUTPUT
68+
69+
- name: Get App Version
70+
id: get_app_version
71+
shell: bash
72+
run: |
73+
app_version="${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.BUILD_ID }}"
74+
echo "App Version: ${app_version}"
75+
echo "APP_VERSION=${app_version}" >> $GITHUB_ENV
76+
echo "APP_VERSION=${app_version}" >> $GITHUB_OUTPUT
77+
78+
build:
79+
runs-on: windows-latest
80+
needs: get-version
81+
steps:
82+
- name: Checkout code
83+
uses: actions/checkout@v4
84+
with:
85+
submodules: 'true'
86+
87+
- name: Add msbuild to PATH
88+
uses: microsoft/setup-msbuild@v2
89+
90+
- name: Restore dependencies
91+
run: |
92+
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"
93+
nuget sources add -name bddhelper -source https://ci.appveyor.com/nuget/ospsuite-bddhelper
94+
nuget sources add -name utility -source https://ci.appveyor.com/nuget/ospsuite-utility
95+
nuget sources add -name serializer -source https://ci.appveyor.com/nuget/ospsuite-serializer
96+
nuget sources add -name databinding -source https://ci.appveyor.com/nuget/ospsuite-databinding
97+
nuget sources add -name texreporting -source https://ci.appveyor.com/nuget/ospsuite-texreporting
98+
nuget sources add -name databinding-devexpress -source https://ci.appveyor.com/nuget/ospsuite-databinding-devexpress
99+
dotnet restore
100+
101+
- name: define env variables
102+
run: |
103+
echo "APP_VERSION=${{needs.get-version.outputs.APP_VERSION}}" | Out-File -FilePath $env:GITHUB_ENV -Append
104+
echo "BUILD_ID=${{needs.get-version.outputs.BUILD_ID}}" | Out-File -FilePath $env:GITHUB_ENV -Append
105+
106+
- name: Build
107+
run: msbuild OSPSuite.Core.sln /p:Version=${{env.APP_VERSION}}
108+
109+
- name : Test
110+
run: dotnet test .\tests\**\bin\Debug\net472\OSPSuite*Tests.dll -v normal --no-build --logger:"html;LogFileName=../testLog_Windows.html"
111+
112+
- name: Pack the project
113+
run: dotnet pack .\OSPSuite.Core.sln --no-build --no-restore -o ./ -p:PackageVersion=${{env.APP_VERSION}} --configuration=Debug --include-symbols --no-build
114+
115+
- name: Push nupkg as artifact
116+
# if it is a push to a branch
117+
if: github.event_name == 'push' && github.ref_name != github.event.repository.default_branch
118+
uses: actions/upload-artifact@v4
119+
with:
120+
name: OSPSuite.Core
121+
path: ./*.nupkg
122+
123+
- name: Push test log as artifact
124+
uses: actions/upload-artifact@v4
125+
with:
126+
name: testLog_Windows
127+
path: ./testLog*.html
128+
129+
- name: Publish to GitHub registry
130+
# if it is a merge to default branch
131+
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
132+
run: dotnet nuget push ./*.nupkg --source https://nuget.pkg.github.com/${{github.repository_owner}}/index.json --api-key ${{ secrets.GITHUB_TOKEN }}

.github/workflows/coverage.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Code Coverage
2+
3+
on:
4+
schedule:
5+
- cron: '0 1 * * 4'
6+
7+
jobs:
8+
cover:
9+
runs-on: windows-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
with:
14+
submodules: 'true'
15+
16+
- name: Add msbuild to PATH
17+
uses: microsoft/setup-msbuild@v2
18+
19+
- name: Restore dependencies
20+
run: |
21+
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"
22+
nuget sources add -name bddhelper -source https://ci.appveyor.com/nuget/ospsuite-bddhelper
23+
nuget sources add -name utility -source https://ci.appveyor.com/nuget/ospsuite-utility
24+
nuget sources add -name serializer -source https://ci.appveyor.com/nuget/ospsuite-serializer
25+
nuget sources add -name databinding -source https://ci.appveyor.com/nuget/ospsuite-databinding
26+
nuget sources add -name texreporting -source https://ci.appveyor.com/nuget/ospsuite-texreporting
27+
nuget sources add -name databinding-devexpress -source https://ci.appveyor.com/nuget/ospsuite-databinding-devexpress
28+
dotnet restore
29+
30+
- name: Build
31+
run: msbuild OSPSuite.Core.sln /p:Version=12.1.999
32+
33+
34+
- name: Cover and report
35+
uses: Open-Systems-Pharmacology/Workflows/.github/actions/dotCover@main
36+
with:
37+
xml-configuration: dotcover.xml
38+
token: ${{ secrets.CODECOV_TOKEN }}

OSPSuite.Core.sln

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OSPSuite.Core", "src\OSPSui
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{25A7357D-0812-44F3-AF90-244FD752FAE2}"
99
ProjectSection(SolutionItems) = preProject
10-
appveyor-coverage.yml = appveyor-coverage.yml
11-
appveyor.yml = appveyor.yml
1210
logo.png = logo.png
1311
rakefile.rb = rakefile.rb
1412
SolutionInfo.cs = SolutionInfo.cs

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
Core functionalities of the Open Systems Pharmacology Suite.
44

55
## Code Status
6-
[![NuGet version](https://img.shields.io/nuget/v/OSPSuite.Core.svg?style=flat)](https://www.nuget.org/packages/OSPSuite.Core)
7-
[![Build status](https://ci.appveyor.com/api/projects/status/skw2giv5jxy3pvo0/branch/develop?svg=true)](https://ci.appveyor.com/project/open-systems-pharmacology-ci/ospsuite-core/branch/develop)
6+
[![Build status](https://img.shields.io/github/actions/workflow/status/Open-Systems-Pharmacology/OSPSuite.Core/build-and-publish.yml?logo=nuget&label=Build%20status)](https://github.com/Open-Systems-Pharmacology/OSPSuite.Core/actions/workflows/build-and-publish.yml)
87
[![Coverage status](https://codecov.io/gh/Open-Systems-Pharmacology/OSPSuite.Core/branch/develop/graph/badge.svg)](https://codecov.io/gh/Open-Systems-Pharmacology/OSPSuite.Core)
98

109
## Code of conduct

appveyor-coverage.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

appveyor.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

dotcover.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<CoverageParams>
3+
<TargetArguments>
4+
Tests\OSPSuite.Core.Tests\bin\Debug\net472\OSPSuite.Core.Tests.dll
5+
Tests\OSPSuite.Core.IntegrationTests\bin\Debug\net472\OSPSuite.Core.IntegrationTests.dll
6+
Tests\OSPSuite.Presentation.Tests\bin\Debug\net472\OSPSuite.Presentation.Tests.dll
7+
Tests\OSPSuite.Infrastructure.Tests\bin\Debug\net472\OSPSuite.Infrastructure.Tests.dll
8+
Tests\OSPSuite.R.Tests\bin\Debug\net472\OSPSuite.R.Tests.dll
9+
Tests\OSPSuite.UI.Tests\bin\Debug\net472\OSPSuite.UI.Tests.dll
10+
</TargetArguments>
11+
<TargetWorkingDir>./</TargetWorkingDir>
12+
13+
<ExcludeFileMasks>
14+
<Mask>src/**/*.Designer.cs</Mask>
15+
<Mask>src/OSPSuite.UI/Views/**</Mask>
16+
<Mask>src/OSPSuite.UI/Controls/**</Mask>
17+
</ExcludeFileMasks>
18+
19+
<Filters>
20+
<ExcludeFilters>
21+
<FilterEntry>
22+
<ModuleMask>FakeItEasy</ModuleMask>
23+
</FilterEntry>
24+
</ExcludeFilters>
25+
</Filters>
26+
</CoverageParams>

src/OSPSuite.Assets.Images/OSPSuite.Assets.Images.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<AssemblyName>OSPSuite.Assets.Images</AssemblyName>
6-
<Version>1.0.0</Version>
7-
<PackageVersion>1.0.0</PackageVersion>
8-
<AssemblyVersion>1.0.0</AssemblyVersion>
9-
<FileVersion>1.0.0</FileVersion>
10-
<InformationalVersion>1.0.0.0</InformationalVersion>
116
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
127
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
138
<PackageProjectUrl>https://github.com/Open-Systems-Pharmacology/OSPSuite.Core</PackageProjectUrl>

src/OSPSuite.Assets/OSPSuite.Assets.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<AssemblyName>OSPSuite.Assets</AssemblyName>
6-
<Version>1.0.0</Version>
7-
<PackageVersion>1.0.0</PackageVersion>
8-
<AssemblyVersion>1.0.0</AssemblyVersion>
9-
<FileVersion>1.0.0</FileVersion>
10-
<InformationalVersion>1.0.0.0</InformationalVersion>
116
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
127
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
138
<PackageProjectUrl>https://github.com/Open-Systems-Pharmacology/OSPSuite.Core</PackageProjectUrl>

src/OSPSuite.Core/OSPSuite.Core.csproj

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<AssemblyName>OSPSuite.Core</AssemblyName>
6-
<Version>1.0.0</Version>
7-
<PackageVersion>1.0.0</PackageVersion>
8-
<AssemblyVersion>1.0.0</AssemblyVersion>
9-
<FileVersion>1.0.0</FileVersion>
10-
<InformationalVersion>1.0.0.0</InformationalVersion>
116
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
127
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
138
<PackageProjectUrl>https://github.com/Open-Systems-Pharmacology/OSPSuite.Core</PackageProjectUrl>
@@ -43,8 +38,8 @@
4338
<PackageReference Include="MathNet.Numerics" Version="4.15.0" />
4439
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.0" />
4540
<PackageReference Include="OSPSuite.Serializer" Version="3.0.0.1" />
46-
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.68" GeneratePathProperty="true" />
47-
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.71" GeneratePathProperty="true" />
41+
<PackageReference Include="OSPSuite.FuncParser" Version="4.0.0.73" GeneratePathProperty="true" />
42+
<PackageReference Include="OSPSuite.SimModel" Version="4.0.0.75" GeneratePathProperty="true" />
4843
<PackageReference Include="OSPSuite.Utility" Version="4.1.0.6" />
4944
</ItemGroup>
5045

0 commit comments

Comments
 (0)