Skip to content

Catching exceptions for codecs #104

Catching exceptions for codecs

Catching exceptions for codecs #104

Workflow file for this run

name: CI Build
on:
push:
branches:
- master
paths-ignore:
- README.md
jobs:
version:
runs-on: windows-latest
outputs:
release-version: ${{ steps.get-version.outputs.RELEASE_VERSION }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Version extraction
id: get-version
run: |
$xml1 = [xml](Get-Content -Path Platform/fo-dicom/fo-dicom.Codecs.csproj)
$version1 = $xml1.Project.PropertyGroup.Version;
echo "RELEASE_VERSION=$version1" >> $env:GITHUB_OUTPUT
shell: pwsh
build_win_x64:
runs-on: windows-2019
needs: version
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup msbuild
uses: microsoft/setup-msbuild@v2
- name: Compile libijg8 libraries
run: msbuild Native/Windows64/build_ALL/libijg8.x64.vcxproj /p:Configuration=Release /p:Platform=x64
- name: Compile libijg12 libraries
run: msbuild Native/Windows64/build_ALL/libijg12.x64.vcxproj /p:Configuration=Release /p:Platform=x64
- name: Compile libijg16 libraries
run: msbuild Native/Windows64/build_ALL/libijg16.x64.vcxproj /p:Configuration=Release /p:Platform=x64
- name: Compile windows x64 library
run: msbuild Native/Windows64/build_ALL/Dicom.Native.vcxproj /p:Configuration=Release /p:Platform=x64
- name: Publish windows x64 artifacts
uses: actions/upload-artifact@v4
with:
name: lib-win-x64
path: Native/Windows64/build_ALL/bin/x64/Release/Dicom.Native
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Prepare SN Key
run: |
echo "${{ secrets.STRONG_NAME_KEY }}" >Platform/fo-dicom/fo-dicom.Codecs.snk.base64
certutil -decode Platform/fo-dicom/fo-dicom.Codecs.snk.base64 Platform/fo-dicom/fo-dicom.Codecs.snk
- name: Run unit tests
run: dotnet test Tests/Unit/UnitTests.csproj --logger:trx
build_linux_x64:
runs-on: ubuntu-20.04
needs: build_win_x64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Compile linux x64 library
run: |
cd Native/POSIX64/
cmake ./CMakeLists.txt
make
- name: Publish linux x64 artifacts
uses: actions/upload-artifact@v4
with:
name: lib-linux-x64
path: Native/POSIX64/lib-linux-x64
- name: Prepare SN key
run: echo ${{ secrets.STRONG_NAME_KEY }} | base64 --decode >Platform/fo-dicom/fo-dicom.Codecs.snk
- name: Publish managed library
run: dotnet publish Platform/fo-dicom/fo-dicom.Codecs.csproj --configuration Release
- name: Publish managed artifacts
uses: actions/upload-artifact@v4
with:
name: lib-managed
path: Platform/fo-dicom/bin/Release/netstandard2.0
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Run unit tests
run: dotnet test Tests/Unit/*.csproj --logger:trx
build_linux_arm64:
runs-on: ubuntu-20.04
needs: build_win_x64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Compile linux arm64 library
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
cd Native/POSIX64/
cmake -DARCH_FLAG:STRING=arm64 ./CMakeLists.txt
make
- name: Publish linux arm64 artifacts
uses: actions/upload-artifact@v4
with:
name: lib-linux-arm64
path: Native/POSIX64/lib-linux-arm64
build_osx_x64:
runs-on: macos-12
needs: build_win_x64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Compile osx x64 library
run: |
cd Native/POSIX64/
cmake ./CMakeLists.txt
make
- name: Publish osx x64 artifacts
uses: actions/upload-artifact@v4
with:
name: lib-osx-x64
path: Native/POSIX64/lib-osx-x64
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Prepare SN key
run: echo ${{ secrets.STRONG_NAME_KEY }} | base64 --decode >Platform/fo-dicom/fo-dicom.Codecs.snk
- name: Run unit tests
run: dotnet test Tests/Unit/*.csproj --logger:trx
build_osx_arm64:
runs-on: macos-12
needs: build_win_x64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Compile osx arm64 library
run: |
cd Native/POSIX64/
cmake -DARCH_FLAG:STRING=arm64 ./CMakeLists.txt
make
- name: Publish osx arm64 artifacts
uses: actions/upload-artifact@v4
with:
name: lib-osx-arm64
path: Native/POSIX64/lib-osx-arm64
acceptance:
runs-on: windows-latest
needs:
- version
- build_win_x64
- build_linux_x64
- build_linux_arm64
- build_osx_x64
- build_osx_arm64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: bin
pattern: lib-win-x64
- name: Prepare SN Key
run: |
echo "${{ secrets.STRONG_NAME_KEY }}" >Platform/fo-dicom/fo-dicom.Codecs.snk.base64
certutil -decode Platform/fo-dicom/fo-dicom.Codecs.snk.base64 Platform/fo-dicom/fo-dicom.Codecs.snk
- name: Run acceptance tests
run: |
echo "Running Acceptance Test for version ${{ needs.version.outputs.release-version }}..."
dotnet test Tests/Acceptance/AcceptanceTests.csproj --logger:trx
- name: Compress results
run: Compress-Archive Tests/Acceptance/bin/debug/net8.0/out ./AcceptanceTestResults.zip
shell: pwsh
- name: Archive files
uses: actions/upload-artifact@v4
with:
name: test
path: ./AcceptanceTestResults.zip
nuget:
runs-on: windows-latest
needs:
- version
- acceptance
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: bin
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Prepare NuGet package
run: nuget pack Setup/fo-dicom.Codecs.nuspec -Version ${{ needs.version.outputs.release-version }}
- name: Publish NuGet package
run: nuget push "fo-dicom.Codecs.*.nupkg" -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_API_KEY }}
release:
runs-on: ubuntu-latest
needs:
- version
- acceptance
- nuget
if: (!contains(needs.version.outputs.release-version, '-'))
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: bin
pattern: test
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.version.outputs.release-version }}
release_name: Release ${{ needs.version.outputs.release-version }}
draft: false
prerelease: false
- name: Upload Release Asset
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${{ needs.version.outputs.release-version }} bin/test/AcceptanceTestResults.zip