Skip to content

[MTGOSDK/API] Client: Fix client ready check #70

[MTGOSDK/API] Client: Fix client ready check

[MTGOSDK/API] Client: Fix client ready check #70

Workflow file for this run

name: Test
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize]
paths:
- '.github/workflows/test.yml'
- '**/*.cs'
- '**/*.sln'
- '**/*.csproj'
- '**/*.props'
- '**/*.targets'
- '**/packages.lock.json'
workflow_dispatch:
concurrency:
group: ci-${{ github.workflow }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
test:
runs-on: windows-latest
name: "Run SDK Tests"
steps:
# Creates a dev drive using ReFS.
#
# This step creates a 10GB VHDX file, mounts it, initializes the disk,
# creates a partition, and formats the volume using ReFS. The drive letter
# is stored in the DEV_DRIVE environment variable for later use.
- name: Create dev drive using ReFS
run: |
$VHD_PATH = "${{ github.workspace }}/dev.vhdx"
$Volume = New-VHD -Path $VHD_PATH -SizeBytes 10GB -Fixed |
Mount-VHD -Passthru |
Initialize-Disk -Passthru |
New-Partition -AssignDriveLetter -UseMaximumSize |
Format-Volume -FileSystem ReFS -Confirm:$false -Force
Write-Output "WORKSPACE=$($Volume.DriveLetter):/workspace" >> $env:GITHUB_ENV
# Checks out the repository to the dev drive.
#
# This is a patch of the actions/checkout action to allow for `path` to
# point to another drive. By default, this is restricted to paths relative
# to the $GITHUB_WORKSPACE directory, which is slower than a ReFS VHDX.
- name: Checkout latest repository commit
uses: Qonfused/checkout@4.2.2
with:
path: ${{ env.WORKSPACE }}
show-progress: false
fetch-depth: 0 # Disable shallow clone for Nerdbank.GitVersioning
# Setup the .NET environment
- name: Install .NET Core
uses: actions/setup-dotnet@v4
# Setup NuGet environment
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Restore NuGet Cache
id: nuget-cache
uses: actions/cache@v4
with:
path: ${{ env.WORKSPACE }}/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore NuGet packages
if: steps.nuget-cache.outputs.cache-hit != 'true'
run: |
nuget restore `
-Verbosity quiet `
-NonInteractive -UseLockFile `
-OutputDirectory "${{ env.WORKSPACE }}/packages"
working-directory: ${{ env.WORKSPACE }}
# Build the SDK
- name: Build SDK Solution
run: dotnet build
working-directory: ${{ env.WORKSPACE }}
# Create .env file for integration tests
- name: Create .env file
run: |
echo "USERNAME=${{ secrets.USERNAME }}" > .env
echo "PASSWORD=${{ secrets.PASSWORD }}" >> .env
working-directory: ${{ env.WORKSPACE }}
# Run the test suite
- name: Run tests
run: dotnet test --no-build -clp:NoSummary
working-directory: ${{ env.WORKSPACE }}
# Show the Diver logs for debugging test failures or crashes
- if: ${{ failure() }}
shell: pwsh
run: Get-Content $env:LOCALAPPDATA\MTGOSDK\Logs\* -Tail 1000