Test against libmdf-1.0.28 #4
Workflow file for this run
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: Millistream.Streaming CD | |
on: | |
push: | |
tags: | |
- 'v*' | |
- '!v*-datatypes' | |
jobs: | |
Build: | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
os: [macOS-latest, ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup the .NET 8 SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Build on macOS/Linux | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
dotnet build Source/Millistream.Streaming/Millistream.Streaming.csproj -c Release -f netstandard1.4 | |
dotnet build Tests/Millistream.Streaming.UnitTests/Millistream.Streaming.UnitTests.csproj -c Release -f net8.0 | |
dotnet build Tests/Millistream.Streaming.IntegrationTests/Millistream.Streaming.IntegrationTests.csproj -c Release -f net8.0 | |
- name: Get Version From Tag | |
id: version | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: bash | |
run: | | |
version=${GITHUB_REF/refs\/tags\//} # = e.g. v2.0.1 | |
parts=(${version//./ }) # Replace '.' with ' ' | |
major=${parts[0]#*v} # Remove the "v" prefix | |
minor=${parts[1]} | |
patch=${parts[2]} | |
echo ::set-output name=version::$major.$minor.$patch | |
- name: Build on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: bash | |
run: | | |
version=${{ steps.version.outputs.version }} | |
dotnet build Source/Millistream.Streaming/Millistream.Streaming.csproj -c Release -p:Version=$version -p:ContinuousIntegrationBuild=true | |
dotnet build Tests/Millistream.Streaming.UnitTests/Millistream.Streaming.UnitTests.csproj -c Release -p:Version=$version | |
dotnet build Tests/Millistream.Streaming.IntegrationTests/Millistream.Streaming.IntegrationTests.csproj -c Release -p:Version=$version | |
- name: Run Unit Tests on macOS/Linux | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
dotnet test Tests/Millistream.Streaming.UnitTests/Millistream.Streaming.UnitTests.csproj -c Release -f net8.0 --no-build --no-restore | |
- name: Run Unit Tests on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
dotnet test Tests/Millistream.Streaming.UnitTests/Millistream.Streaming.UnitTests.csproj -c Release --no-build --no-restore | |
- name: Download and Install libmdf on macOS | |
if: ${{ matrix.os == 'macOS-latest' }} | |
run: | | |
wget https://packages.millistream.com/source/libmdf-1.0.28.tar.gz | |
tar -zxf libmdf-1.0.28.tar.gz | |
cd libmdf-1.0.28 | |
./configure --prefix=/usr/local | |
make | |
make install | |
- name: Download and Install libmdf on Linux | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
wget https://packages.millistream.com/source/libmdf-1.0.28.tar.gz | |
tar -zxf libmdf-1.0.28.tar.gz | |
cd libmdf-1.0.28 | |
./configure --prefix=/usr | |
make | |
sudo make install | |
- name: Download and Install libmdf on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: pwsh | |
run: | | |
(new-object System.Net.WebClient).DownloadFile('https://packages.millistream.com/Windows/libmdf-1.0.28.exe','libmdf-1.0.28.exe') | |
.\libmdf-1.0.28.exe /S | |
# Wait for the DLL to appear in C:\Windows\System32 | |
while (-not (Test-Path -Path "C:\Windows\System32\libmdf-0.dll")) { | |
Write-Host "libmdf not found. Waiting..." | |
Start-Sleep -Seconds 1 | |
} | |
- name: Set Credentials | |
shell: pwsh | |
env: | |
HOSTNAME: ${{ secrets.HOSTNAME }} | |
USERNAME: ${{ secrets.USERNAME }} | |
PASSWORD: ${{ secrets.PASSWORD }} | |
run: | | |
[xml]$doc = Get-Content Tests/Millistream.Streaming.IntegrationTests/TestSettings.runsettings | |
$doc.RunSettings.TestRunParameters.ChildNodes.Item(0).value = "$env:HOSTNAME" | |
$doc.RunSettings.TestRunParameters.ChildNodes.Item(1).value = "$env:USERNAME" | |
$doc.RunSettings.TestRunParameters.ChildNodes.Item(2).value = "$env:PASSWORD" | |
$doc.Save("UpdatedTestSettings.runsettings") | |
- name: Run Integration Tests on macOS/Linux | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
dotnet test Tests/Millistream.Streaming.IntegrationTests/Millistream.Streaming.IntegrationTests.csproj -c Release -f net8.0 --no-build --no-restore -s UpdatedTestSettings.runsettings | |
- name: Run Integration Tests on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
dotnet test Tests/Millistream.Streaming.IntegrationTests/Millistream.Streaming.IntegrationTests.csproj -c Release --no-build --no-restore -s UpdatedTestSettings.runsettings | |
- name: Remove the .runsettings file | |
shell: pwsh | |
run: Remove-Item UpdatedTestSettings.runsettings | |
- name: Pack | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: bash | |
run: | | |
dotnet pack Source/Millistream.Streaming/Millistream.Streaming.csproj -c Release /property:PackageVersion=${{ steps.version.outputs.version }} --no-build --no-restore --output packages | |
- name: Create a GitHub Release | |
id: create_release | |
if: ${{ matrix.os == 'windows-latest' }} | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Version ${{ steps.version.outputs.version }} | |
draft: true | |
prerelease: false | |
- name: Upload the Release Asset | |
if: ${{ matrix.os == 'windows-latest' }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: packages/Millistream.Streaming.${{ steps.version.outputs.version }}.nupkg | |
asset_name: Millistream.Streaming.${{ steps.version.outputs.version }}.nupkg | |
asset_content_type: application/zip | |
- name: Upload Artifact | |
if: ${{ matrix.os == 'windows-latest' }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Millistream.Streaming | |
path: packages | |
if-no-files-found: error |