Skip to content

Commit 9cc4f55

Browse files
committed
Fixes #2426 Build on GitHub Actions instead of AppVeyor
1 parent 0f8f775 commit 9cc4f55

File tree

55 files changed

+1564
-1574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1564
-1574
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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="999${{ 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: define env variables
88+
run: |
89+
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"
90+
nuget sources add -name bddhelper -source https://ci.appveyor.com/nuget/ospsuite-bddhelper
91+
nuget sources add -name utility -source https://ci.appveyor.com/nuget/ospsuite-utility
92+
nuget sources add -name serializer -source https://ci.appveyor.com/nuget/ospsuite-serializer
93+
nuget sources add -name databinding -source https://ci.appveyor.com/nuget/ospsuite-databinding
94+
nuget sources add -name texreporting -source https://ci.appveyor.com/nuget/ospsuite-texreporting
95+
nuget sources add -name databinding-devexpress -source https://ci.appveyor.com/nuget/ospsuite-databinding-devexpress
96+
echo "APP_VERSION=${{needs.get-version.outputs.APP_VERSION}}" >> $GITHUB_ENV
97+
echo "BUILD_ID=${{needs.get-version.outputs.BUILD_ID}}" >> $GITHUB_ENV
98+
99+
- name: Build Debug and Release
100+
run: msbuild OSPSuite.Core.sln /p:Version=${{env.APP_VERSION}}
101+
102+
- name : Test
103+
run: dotnet test .\tests\**\bin\Debug\net472\OSPSuite*Tests.dll -v normal --no-build --logger:"html;LogFileName=../../../testLog_Windows.html"
104+
105+
- name: Pack the project
106+
run: dotnet pack .\OSPSuite.Core.sln --no-build --no-restore -o ./ -p:PackageVersion=${{env.APP_VERSION}} --configuration=Debug --include-symbols --no-build
107+
108+
- name: Push nupkg as artifact
109+
# if it is a push to a branch
110+
if: github.event_name == 'push' && github.ref_name != github.event.repository.default_branch
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: OSPSuite.Core
114+
path: ./*.nupkg
115+
116+
- name: Push test log as artifact
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: testLog_Windows
120+
path: ./**/testLog*.html
121+
122+
- name: Publish to GitHub registry
123+
# if it is a merge to default branch
124+
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
125+
run: dotnet nuget push ./*.nupkg --source https://nuget.pkg.github.com/${{github.repository_owner}}/index.json --api-key ${{ secrets.GITHUB_TOKEN }}

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.

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: 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.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>

src/OSPSuite.Infrastructure.Autofac/OSPSuite.Infrastructure.Autofac.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
5-
<Version>1.0.0</Version>
6-
<PackageVersion>1.0.0</PackageVersion>
7-
<AssemblyVersion>1.0.0</AssemblyVersion>
8-
<FileVersion>1.0.0</FileVersion>
9-
<InformationalVersion>1.0.0.0</InformationalVersion>
105
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
116
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
127
<PackageProjectUrl>https://github.com/Open-Systems-Pharmacology/OSPSuite.Core</PackageProjectUrl>

src/OSPSuite.Infrastructure.Castle/OSPSuite.Infrastructure.Castle.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
5-
<Version>1.0.0</Version>
6-
<PackageVersion>1.0.0</PackageVersion>
7-
<AssemblyVersion>1.0.0</AssemblyVersion>
8-
<FileVersion>1.0.0</FileVersion>
9-
<InformationalVersion>1.0.0.0</InformationalVersion>
105
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
116
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
127
<PackageProjectUrl>https://github.com/Open-Systems-Pharmacology/OSPSuite.Core</PackageProjectUrl>

src/OSPSuite.Infrastructure.Export/OSPSuite.Infrastructure.Export.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
5-
<Version>1.0.0</Version>
6-
<PackageVersion>1.0.0</PackageVersion>
7-
<AssemblyVersion>1.0.0</AssemblyVersion>
8-
<FileVersion>1.0.0</FileVersion>
9-
<InformationalVersion>1.0.0.0</InformationalVersion>
105
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
116
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
127
<PackageProjectUrl>https://github.com/Open-Systems-Pharmacology/OSPSuite.Core</PackageProjectUrl>

0 commit comments

Comments
 (0)