Skip to content

Fix builds on macOS #62

Fix builds on macOS

Fix builds on macOS #62

Workflow file for this run

name: "Build, Test and Pack"
on:
push:
branches: [ master ]
# Trigger on release tags
tags: [ 'v[0-9]+*' ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: Event File
path: ${{ github.event_path }}
build-and-test:
name: "Build and Test"
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-12]
runs-on: ${{ matrix.os }}
steps:
- name: Install MacPorts
if: ${{ matrix.os == 'macos-12' }}
uses: melusina-org/setup-macports@v1
- name: Install icu4c on macOS
if: ${{ matrix.os == 'macos-12' }}
run: |
sudo port -v install icu
echo "DYLD_FALLBACK_LIBRARY_PATH=$HOME/lib:/usr/local/lib:/usr/lib:/opt/local/lib" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: '0'
- name: Install .NET Core
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build --configuration Release source/icu.net.sln
- name: Test on .NET 8.0
run: dotnet test -p:TargetFramework=net8.0 --configuration Release --no-build source/icu.net.sln -- NUnit.TestOutputXml=TestResults
- name: Test on .NET Framework 4.6.1 (Windows only)
if: ${{ matrix.os == 'windows-latest' }}
run: dotnet test -p:TargetFramework=net461 --configuration Release --no-build source/icu.net.sln -- NUnit.TestOutputXml=TestResults
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: Test Results (${{matrix.os}})
path: "**/TestResults/*.xml"
- name: Pack
run: dotnet pack --configuration Release --no-build --include-symbols source/icu.net.sln
- name: Upload Artifacts
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: icu-dotnet-nugetpackage
path: |
output/*.nupkg
output/*.snupkg
if: matrix.os == 'ubuntu-latest'
publish-nuget:
name: "Publish NuGet package"
runs-on: ubuntu-latest
needs: build-and-test
if: github.event_name == 'push'
steps:
- name: Download Artifacts
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
path: artifacts
- name: Publish to Nuget
run: dotnet nuget push artifacts/**/*.*nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.SILLSDEV_PUBLISH_NUGET_ORG}} --skip-duplicate