Skip to content

Commit

Permalink
Add library build, test, package and StringEnum tests to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
hach-que committed Oct 31, 2024
1 parent 9e5023a commit 8edfde2
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 303 deletions.
194 changes: 193 additions & 1 deletion .github/workflows/uet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,30 @@ jobs:
UET/Redpoint.Logging.Mac.Native/runtimes/osx-x64/libLogging.x64.dylib
UET/Redpoint.Logging.Mac/bin/Redpoint.Logging.Mac.Native.*.nupkg
test-stringenum-trimmed:
name: "Test StringEnum Trimmed"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build and Test
shell: pwsh
run: |
sudo apt-get update
sudo apt-get install -y clang zlib1g-dev dotnet-sdk-8.0
dotnet publish /p:TargetFramework=net8.0 -c Release -r linux-x64 UET/Redpoint.StringEnum.TrimTests/Redpoint.StringEnum.TrimTests.csproj
if ($LastExitCode -ne 0) {
Write-Host "dotnet build (Redpoint.StringEnum.TrimTests.csproj) failed with exit code $LastExitCode"
exit $LastExitCode
}
UET/Redpoint.StringEnum.TrimTests/bin/Release/net8.0/linux-x64/publish/Redpoint.StringEnum.TrimTests
if ($LastExitCode -ne 0) {
Write-Host "Redpoint.StringEnum.TrimTests failed with exit code $LastExitCode"
exit $LastExitCode
}
pass-1-win:
name: "Build Windows Pass 1"
runs-on: windows-latest
Expand Down Expand Up @@ -440,4 +464,172 @@ jobs:
UET/Redpoint.Uefs.Daemon/bin/Release/net8.0/osx-arm64/publish/uefs-daemon
UET/uet.shim/bin/Release/net8.0/osx-arm64/publish/uet
UET/uet/bin/Release/net8.0/osx-arm64/publish/uet
libs-win:
name: "Build and Test Libraries on Windows"
runs-on: windows-latest
needs:
- timestamp
- prereq-autodiscovery
- prereq-mac-logging
env:
UET_PACKAGE_VERSION: ${{ needs.timestamp.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache .NET SDK
id: cache-sdk
uses: actions/cache@v4
with:
key: dotnet-sdk-windows-${{ env.UET_FRAMEWORK_TARGET }}
restore-keys: dotnet-sdk-windows-${{ env.UET_FRAMEWORK_TARGET }}
path: .dotnet-${{ env.UET_FRAMEWORK_TARGET }}
- if: ${{ steps.cache-sdk.outputs.cache-hit != 'true' }}
name: Download .NET SDK
shell: pwsh
run: |
if (!(Test-Path .dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet\dotnet-extracted)) {
if (Test-Path ".dotnet-${env:UET_FRAMEWORK_TARGET}") {
Remove-Item -Recurse -Force ".dotnet-${env:UET_FRAMEWORK_TARGET}"
}
Write-Host "Setting up .NET SDK..."
New-Item -ItemType Directory ".dotnet-${env:UET_FRAMEWORK_TARGET}" | Out-Null
curl.exe -L -o ".dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet.zip" "${env:UET_DOTNET_WIN_DL}"
if ($LastExitCode -ne 0) {
exit $LastExitCode
}
Expand-Archive -Path ".dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet.zip" -DestinationPath ".dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet" -Force | Out-Null
Set-Content -Path .dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet\dotnet-extracted -Value "done"
}
- name: Add .NET SDK to PATH
shell: pwsh
run: |
Add-Content -Path "${env:GITHUB_PATH}" -Value ".dotnet-${env:UET_FRAMEWORK_TARGET}\dotnet"
- name: Download AutoDiscovery
uses: actions/download-artifact@v4
with:
name: autodiscovery-nupkg
path: UET/Redpoint.AutoDiscovery/bin/Release/
merge-multiple: true
- name: Download Mac Logging
uses: actions/download-artifact@v4
with:
name: mac-logging-nupkg
path: UET/
merge-multiple: true
- name: Build and Test Libraries on Windows
shell: pwsh
run: |
dotnet build -c Release "/p:PackageVersion=${env:UET_PACKAGE_VERSION}" UET/UET.sln
if ($LastExitCode -ne 0) {
Write-Host "dotnet build (UET.sln) failed with exit code $LastExitCode"
exit $LastExitCode
}
foreach ($Item in (Get-ChildItem UET -Filter *.Tests)) {
if (Test-Path "$($Item.FullName)/$($Item.Name).csproj") {
Write-Host "============ STARTING: $($Item.Name) ============"
dotnet test --logger:"console" --logger:"trx;LogFilePath=$((Get-Location).Path)\TestResults\$($Item.Name).test-result.trx" "$($Item.FullName)/bin/Release/net8.0/$($Item.Name).dll"
if ($LastExitCode -ne 0) {
Write-Host "============ FAILED: $($Item.Name) ============"
exit $LastExitCode
}
Write-Host "============ PASSED: $($Item.Name) ============"
}
}
- name: Report Test Results
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Windows Test Results
path: TestResults/*.test-result.trx
reporter: dotnet-trx
- name: Upload Packages
uses: actions/upload-artifact@v4
with:
name: libs-win
if-no-files-found: error
path: |
**/*.nupkg
libs-mac:
name: "Build and Test Libraries on macOS"
runs-on: macos-latest
needs:
- timestamp
- prereq-autodiscovery
- prereq-mac-logging
env:
UET_PACKAGE_VERSION: ${{ needs.timestamp.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache .NET SDK
id: cache-sdk
uses: actions/cache@v4
with:
key: dotnet-sdk-windows-${{ env.UET_FRAMEWORK_TARGET }}
restore-keys: dotnet-sdk-windows-${{ env.UET_FRAMEWORK_TARGET }}
path: .dotnet-${{ env.UET_FRAMEWORK_TARGET }}
- if: ${{ steps.cache-sdk.outputs.cache-hit != 'true' }}
name: Download .NET SDK
shell: pwsh
run: |
if (!(Test-Path .dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet/dotnet-extracted)) {
if (Test-Path ".dotnet-${env:UET_FRAMEWORK_TARGET}") {
Remove-Item -Recurse -Force ".dotnet-${env:UET_FRAMEWORK_TARGET}"
}
Write-Host "Setting up .NET SDK..."
New-Item -ItemType Directory ".dotnet-${env:UET_FRAMEWORK_TARGET}" | Out-Null
curl -L -o ".dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet.tar.gz" "${env:UET_DOTNET_MAC_DL}"
if ($LastExitCode -ne 0) {
exit $LastExitCode
}
New-Item -ItemType Directory ".dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet" | Out-Null
Push-Location ".dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet"
try {
tar -xvf "../dotnet.tar.gz"
} finally {
Pop-Location
}
Set-Content -Path .dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet/dotnet-extracted -Value "done"
}
- name: Add .NET SDK to PATH
shell: pwsh
run: |
Add-Content -Path "${env:GITHUB_PATH}" -Value ".dotnet-${env:UET_FRAMEWORK_TARGET}/dotnet"
- name: Download AutoDiscovery
uses: actions/download-artifact@v4
with:
name: autodiscovery-nupkg
path: UET/Redpoint.AutoDiscovery/bin/Release/
merge-multiple: true
- name: Download Mac Logging
uses: actions/download-artifact@v4
with:
name: mac-logging-nupkg
path: UET/
merge-multiple: true
- name: Build and Test Libraries on macOS
run: |
set -e
echo "Package version: $UET_PACKAGE_VERSION"
dotnet build -c Release /p:PackageVersion=$UET_PACKAGE_VERSION UET/UET.sln
for TEST_PATH in $(find UET -type d -name "*.Tests"); do
TEST_NAME=${TEST_PATH:4}
if [ -e "$TEST_PATH/$TEST_NAME.csproj" ]; then
echo "============ STARTING: $TEST_NAME ============"
dotnet test --logger:"console" --logger:"trx;LogFilePath=$(pwd)/TestResults/$TEST_NAME.test-result.trx" "$TEST_PATH/bin/Release/net8.0/$TEST_NAME.dll"
echo "============ PASSED: $TEST_NAME ============"
fi
done
- name: Report Test Results
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: macOS Test Results
path: TestResults/*.test-result.trx
reporter: dotnet-trx
66 changes: 0 additions & 66 deletions Build/.platform-autodiscovery.gitlab-ci.yml

This file was deleted.

16 changes: 0 additions & 16 deletions Build/.platform-maclogging.gitlab-ci.yml

This file was deleted.

20 changes: 0 additions & 20 deletions Build/.stringenum.gitlab-ci.yml

This file was deleted.

36 changes: 0 additions & 36 deletions Build/.uefs-client.gitlab-ci.yml

This file was deleted.

34 changes: 0 additions & 34 deletions Build/.uefs-daemon.gitlab-ci.yml

This file was deleted.

Loading

0 comments on commit 8edfde2

Please sign in to comment.