Skip to content

Fix GH arch test format. #26

Fix GH arch test format.

Fix GH arch test format. #26

name: Tests
# Basics from https://learn.microsoft.com/en-us/dotnet/devops/dotnet-test-github-action
on:
push:
pull_request:
branches: [ main ]
paths:
- '**.cs'
- '**.csproj'
env:
DOTNET_VERSION: '8' # The .NET SDK version to use
jobs:
cache-fhir-packages:
runs-on: ubuntu-latest
steps:
# Try to use a cached set of packages for Unit Testing
- name: Check for a FHIR package cache
id: cache-fhir-packages-test
uses: actions/cache@v4
with:
path: ~/.fhir
key: cache-unit-test-fhir-packages-20240909
enableCrossOsArchive: true
lookup-only: true
# If there is no cache, pre-download the packages we need
- name: Install FHIR packages
if: ${{ steps.cache-fhir-packages-test.outputs.cache-hit != 'true' }}
continue-on-error: true
run: |
dotnet tool install -g firely.terminal
fhir install hl7.fhir.r2.core 1.0.2
fhir install hl7.fhir.r2.expansions 1.0.2
fhir install hl7.fhir.r3.core 3.0.2
fhir install hl7.fhir.r3.expansions 3.0.2
fhir install hl7.fhir.r4.core 4.0.1
fhir install hl7.fhir.r4.expansions 4.0.1
fhir install hl7.fhir.r4b.core 4.3.0
fhir install hl7.fhir.r4b.expansions 4.3.0
fhir install hl7.fhir.r5.core 5.0.0
fhir install hl7.fhir.r5.expansions 5.0.0
# If there is no cache, save the downloaded packages
- name: Cache FHIR packages
uses: actions/cache/save@v4
if: ${{ steps.cache-fhir-packages-test.outputs.cache-hit != 'true' }}
continue-on-error: true
with:
path: ~/.fhir
key: cache-unit-test-fhir-packages-20240909
enableCrossOsArchive: true
build-and-test:
name: build-and-test-${{matrix.os}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
# Try to use a cached set of packages for Unit Testing
- name: Restore FHIR package cache
id: cache-fhir-packages
uses: actions/cache@v4
with:
path: ~/.fhir
key: cache-unit-test-fhir-packages-20240909
enableCrossOsArchive: true
- name: Translate runner.arch to dotnet arch x86
if: runner.arch == 'X86'
run: echo "export DOTNET_ARCH=x86" >> $GITHUB_ENV
- name: Translate runner.arch to dotnet arch x64
if: runner.arch == 'X64'
run: echo "export DOTNET_ARCH=x64" >> $GITHUB_ENV
- name: Translate runner.arch to dotnet arch ARM
if: runner.arch == 'ARM'
run: echo "export DOTNET_ARCH=arm" >> $GITHUB_ENV
- name: Translate runner.arch to dotnet arch ARM64
if: runner.arch == 'ARM64'
run: echo "export DOTNET_ARCH=arm64" >> $GITHUB_ENV
- name: Install dependencies, use the dotnet arch
run: dotnet restore -a ${{env.DOTNET_ARCH}}
- name: Build
run: dotnet build --configuration Release --no-restore --framework net8.0 -a ${{env.DOTNET_ARCH}}
- name: Test
run: dotnet test --configuration Release --no-restore --framework net8.0 --verbosity normal --filter "RequiresExternalRepo!=true" -a ${{env.DOTNET_ARCH}}