Merge pull request #440 from SMI/dependabot/nuget/Microsoft.Extension… #1096
This file contains 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
name: Build, test and package | |
on: push | |
env: | |
MSSQL_SA_PASSWORD: "YourStrong!Passw0rd" | |
ACCEPT_EULA: "Y" | |
MSSQL_PID: "developer" | |
jobs: | |
package: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout RdmpDicom source | |
uses: actions/checkout@v4 | |
- name: Checkout RDMP source | |
uses: actions/checkout@v4 | |
with: | |
repository: HicServices/RDMP | |
ref: develop | |
path: RDMP | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Get version | |
id: version | |
shell: cmd | |
run: | | |
for /f tokens^=1^,2^ delims^=^" %%i in (SharedAssemblyInfo.cs) do @if "%%i"=="[assembly: AssemblyVersion(" echo version=%%j>> %GITHUB_OUTPUT% | |
perl -ne "print """rdmpversion=""".$1."""\n""" if /version>(.+)</i" RDMP\directory.build.props >>%GITHUB_OUTPUT% | |
- name: Install MS SQL 2019 | |
uses: crazy-max/ghaction-chocolatey@v3 | |
with: | |
args: install -ry sqllocaldb wget | |
- name: Build | |
run: dotnet build -c Release --nologo | |
- name: Set up database | |
run: | | |
SqlLocalDB.exe create MSSQLLocalDB -s | |
sqlcmd -l 180 -S "(localdb)\MSSQLLocalDB" -Q "SELECT @@VERSION;" | |
dotnet run --project RDMP\Tools\rdmp\rdmp.csproj -c Release -- install --createdatabasetimeout 180 "(localdb)\MSSQLLocalDB" TEST_ | |
- name: Package | |
shell: bash | |
run: | | |
dotnet test -c Release | |
wget https://raw.githubusercontent.com/SMI/DicomTypeTranslation/main/Templates/CT.it | |
dotnet publish Rdmp.Dicom/Rdmp.Dicom.csproj -o p/main -c Release --self-contained false -nologo | |
dotnet publish Rdmp.Dicom.UI/Rdmp.Dicom.UI.csproj -o p/windows -c Release --self-contained false -nologo | |
cat > plugin.nuspec <<EOP | |
<?xml version="1.0" encoding="utf-8"?> | |
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> | |
<metadata> | |
<id>Rdmp.Dicom</id> | |
<version>${{ steps.version.outputs.version }}</version> | |
<authors>Health Informatics Service, University of Dundee</authors> | |
<description>Imaging plugin for Research Data Management Platform </description> | |
<dependencies> | |
<dependency id="HIC.RDMP.Plugin" version="${{ steps.version.outputs.rdmpversion }}" /> | |
</dependencies> | |
</metadata> | |
</package> | |
EOP | |
rm -f p/windows/windows.dll | |
rm -f p/windows/ja-JP/Terminal.Gui.resources.dll | |
rm -f p/windows/fr-FR/Terminal.Gui.resources.dll | |
rm -f p/windows/pt-PT/Terminal.Gui.resources.dll | |
rm -f p/main/main.dll | |
rm -f p/main/ja-JP/Terminal.Gui.resources.dll | |
rm -f p/main/fr-FR/Terminal.Gui.resources.dll | |
rm -f p/main/pt-PT/Terminal.Gui.resources.dll | |
7z a -tzip Rdmp.Dicom.${{ steps.version.outputs.version }}.rdmp plugin.nuspec p | |
dotnet pack Rdmp.Dicom/Rdmp.Dicom.csproj -c Release -p:Version=${{ steps.version.outputs.version }} -p:SymbolPackageFormat=snupkg --include-source --include-symbols -o . | |
cp Rdmp.Dicom.${{ steps.version.outputs.version }}.rdmp Rdmp.Dicom.${{ steps.version.outputs.version }}.nupkg | |
cat > testcmd.yaml <<-EOC | |
Commands: | |
- listsupportedcommands | |
- describe CreateNewImagingDatasetSuite | |
- NewObject ConnectionStringKeyword MicrosoftSqlServer TrustServerCertificate yes | |
- NewObject ConnectionStringKeyword MicrosoftSqlServer Encrypt yes | |
- createnewexternaldatabaseserver LiveLoggingServer_ID "DatabaseType:MicrosoftSqlServer:Name:ImagingTest:Server=(localdb)\MSSQLLocalDB;Integrated Security=true;Encrypt=yes;TrustServerCertificate=true" | |
- CreateNewImagingDatasetSuite "DatabaseType:MicrosoftSqlServer:Name:ImagingTest:Server=(localdb)\MSSQLLocalDB;Integrated Security=true;Encrypt=yes;TrustServerCertificate=true" ./data DicomFileCollectionSource CT_ CT.it false true | |
- AddTag Catalogue:CT_ImageTable StudyDate null | |
- AddTag Catalogue:CT_*Table SeriesDate null | |
- AddTag Catalogue:CT_*Table SeriesDate null | |
- AddTag Catalogue:CT_*Table SeriesDate null | |
- CreateNewImagingDatasetSuite "DatabaseType:MicrosoftSqlServer:Name:ImagingTest2:Server=(localdb)\MSSQLLocalDB;Integrated Security=true;Encrypt=yes;TrustServerCertificate=true" ./data DicomFileCollectionSource CT_ CT.it false true | |
EOC | |
- name: Test | |
shell: bash | |
run: | | |
echo "Loading plugin" | |
dotnet run --project RDMP\\Tools\\rdmp\\rdmp.csproj -c Release -- pack -p --file Rdmp.Dicom.${{ steps.version.outputs.version }}.rdmp --dir yaml | |
7z t Rdmp.Dicom.${{ steps.version.outputs.version }}.rdmp | |
echo "Running plugin test script" | |
dotnet run --project RDMP\\Tools\\rdmp\\rdmp.csproj -c Release -- -f testcmd.yaml --dir yaml | |
- name: Store created nupkg files | |
uses: actions/upload-artifact@v4 | |
with: | |
path: | | |
./*.nupkg | |
./*.rdmp | |
retention-days: 1 | |
- name: Nuget push | |
if: contains(github.ref,'refs/tags/') | |
run: dotnet nuget push HIC.Rdmp.Dicom.*.nupkg -k ${{ secrets.NUGET_KEY }} --skip-duplicate --source https://api.nuget.org/v3/index.json | |
- name: Upload release binaries | |
if: contains(github.ref,'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref }} | |
file_glob: true | |
file: 'Rdmp.Dicom.${{ steps.version.outputs.version }}.*' | |