From 83faa10d5bd54631b9faf2b6c42eb297e0738dad Mon Sep 17 00:00:00 2001 From: liy94 Date: Tue, 28 May 2024 10:54:58 -0500 Subject: [PATCH 1/4] Add ARM builds to GitHub Actions workflow --- .github/workflows/dotnet.yml | 93 ++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 90e6869..c25a8a4 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -2,57 +2,58 @@ name: .NET on: push: - branches: [ '**' ] + branches: ["**"] pull_request: - branches: [ '**' ] + branches: ["**"] jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest, windows-latest ] + os: [ubuntu-latest, windows-latest] + platform: [x64, arm] steps: - - uses: actions/checkout@v3 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 6.x - 7.x - 8.x - - name: Restore dependencies - working-directory: ./Src/CommandLine - run: dotnet restore CommandLine.sln - - name: Build - working-directory: ./Src/CommandLine - run: dotnet build CommandLine.sln /p:Configuration=Release /p:Platform=x64 - - name: Pack Nuget Package - if: ${{ matrix.os == 'ubuntu-latest' && github.ref_name == 'master' }} - working-directory: ./Src/CommandLine - run: dotnet pack CommandLine.csproj -c Release -p:PackageVersion="1.0.${{ github.run_number }}" /p:Platform=x64 - - name: Publish Nuget Package - if: ${{ matrix.os == 'ubuntu-latest' && github.ref_name == 'master' }} - working-directory: ./nupkg - run: dotnet nuget push VUISIS.Formula.x64.1.0.${{ github.run_number }}.nupkg --api-key ${{ secrets.BUILD_SECRET }} --source https://api.nuget.org/v3/index.json --skip-duplicate - - name: Copy to Liblibz3 MacOS - if: ${{ matrix.os == 'macOS-latest' }} - run: cp ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/x64/net6.0/runtimes/osx-x64/native/libz3.dylib ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/x64/net6.0/runtimes/osx-x64/native/liblibz3.dylib - - name: Test Ubuntu - if: ${{ matrix.os == 'ubuntu-latest' }} - working-directory: ./Src/Tests - run: | - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/Linux/x64/net6.0/runtimes/linux-x64/native - dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=x64 - - name: Test MacOS - if: ${{ matrix.os == 'macOS-latest' }} - working-directory: ./Src/Tests - run: | - export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/x64/net6.0/runtimes/osx-x64/native - dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=x64 - - name: Test Windows - if: ${{ matrix.os == 'windows-latest' }} - working-directory: ./Src/Tests - run: | - set PATH="%PATH%;${GITHUB_WORKSPACE}\Src\CommandLine\bin\Release\Windows\x64\net6.0\runtimes\win-x64\native" - dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=x64 + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.x + 7.x + 8.x + - name: Restore dependencies + working-directory: ./Src/CommandLine + run: dotnet restore CommandLine.sln + - name: Build + working-directory: ./Src/CommandLine + run: dotnet build CommandLine.sln /p:Configuration=Release /p:Platform=${{ matrix.platform }} + - name: Pack Nuget Package + if: ${{ matrix.os == 'ubuntu-latest' && github.ref_name == 'master' }} + working-directory: ./Src/CommandLine + run: dotnet pack CommandLine.csproj -c Release -p:PackageVersion="1.0.${{ github.run_number }}" /p:Platform=${{ matrix.platform }} + - name: Publish Nuget Package + if: ${{ matrix.os == 'ubuntu-latest' && github.ref_name == 'master' }} + working-directory: ./nupkg + run: dotnet nuget push VUISIS.Formula.${{ matrix.platform }}.1.0.${{ github.run_number }}.nupkg --api-key ${{ secrets.BUILD_SECRET }} --source https://api.nuget.org/v3/index.json --skip-duplicate + - name: Copy to Liblibz3 MacOS + if: ${{ matrix.os == 'macOS-latest' }} + run: cp ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/${{ matrix.platform }}/net6.0/runtimes/osx-${{ matrix.platform }}/native/libz3.dylib ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/${{ matrix.platform }}/net6.0/runtimes/osx-${{ matrix.platform }}/native/liblibz3.dylib + - name: Test Ubuntu + if: ${{ matrix.os == 'ubuntu-latest' }} + working-directory: ./Src/Tests + run: | + export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/Linux/${{ matrix.platform }}/net6.0/runtimes/linux-${{ matrix.platform }}/native + dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=${{ matrix.platform }} + - name: Test MacOS + if: ${{ matrix.os == 'macOS-latest' }} + working-directory: ./Src/Tests + run: | + export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/${{ matrix.platform }}/net6.0/runtimes/osx-${{ matrix.platform }}/native + dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=${{ matrix.platform }} + - name: Test Windows + if: ${{ matrix.os == 'windows-latest' }} + working-directory: ./Src/Tests + run: | + set PATH="%PATH%;${GITHUB_WORKSPACE}\Src\CommandLine\bin\Release\Windows\${{ matrix.platform }}\net6.0\runtimes\win-${{ matrix.platform }}\native" + dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=${{ matrix.platform }} From 459a5275d6990202cfb6b221b992bd7597e5cd59 Mon Sep 17 00:00:00 2001 From: liy94 Date: Wed, 29 May 2024 12:17:59 -0500 Subject: [PATCH 2/4] add macos-latest to os --- .github/workflows/dotnet.yml | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c25a8a4..0bbf9a9 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -11,8 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest] - platform: [x64, arm] + os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v3 - name: Setup .NET @@ -27,33 +26,41 @@ jobs: run: dotnet restore CommandLine.sln - name: Build working-directory: ./Src/CommandLine - run: dotnet build CommandLine.sln /p:Configuration=Release /p:Platform=${{ matrix.platform }} - - name: Pack Nuget Package + run: dotnet build CommandLine.sln /p:Configuration=Release /p:Platform=x64 + - name: Pack Nuget Package (ubuntu) if: ${{ matrix.os == 'ubuntu-latest' && github.ref_name == 'master' }} working-directory: ./Src/CommandLine - run: dotnet pack CommandLine.csproj -c Release -p:PackageVersion="1.0.${{ github.run_number }}" /p:Platform=${{ matrix.platform }} - - name: Publish Nuget Package + run: dotnet pack CommandLine.csproj -c Release -p:PackageVersion="1.0.${{ github.run_number }}" /p:Platform=x64 + - name: Pack Nuget Package (macOS) + if: matrix.os == 'macOS-latest' && github.ref_name == 'master' + working-directory: ./Src/CommandLine + run: dotnet pack CommandLine.csproj -c Release -p:PackageVersion="1.0.${{ github.run_number }}" /p:Platform=ARM64 + - name: Publish Nuget Package (ubuntu) if: ${{ matrix.os == 'ubuntu-latest' && github.ref_name == 'master' }} working-directory: ./nupkg - run: dotnet nuget push VUISIS.Formula.${{ matrix.platform }}.1.0.${{ github.run_number }}.nupkg --api-key ${{ secrets.BUILD_SECRET }} --source https://api.nuget.org/v3/index.json --skip-duplicate + run: dotnet nuget push VUISIS.Formula.x64.1.0.${{ github.run_number }}.nupkg --api-key ${{ secrets.BUILD_SECRET }} --source https://api.nuget.org/v3/index.json --skip-duplicate + - name: Publish Nuget Package (macOS) + if: matrix.os == 'macOS-latest' && github.ref_name == 'master' + working-directory: ./nupkg + run: dotnet nuget push VUISIS.Formula.ARM64.1.0.${{ github.run_number }}.nupkg --api-key ${{ secrets.BUILD_SECRET }} --source https://api.nuget.org/v3/index.json --skip-duplicate - name: Copy to Liblibz3 MacOS if: ${{ matrix.os == 'macOS-latest' }} - run: cp ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/${{ matrix.platform }}/net6.0/runtimes/osx-${{ matrix.platform }}/native/libz3.dylib ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/${{ matrix.platform }}/net6.0/runtimes/osx-${{ matrix.platform }}/native/liblibz3.dylib + run: cp ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/x64/net6.0/runtimes/osx-x64/native/libz3.dylib ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/x64/net6.0/runtimes/osx-x64/native/liblibz3.dylib - name: Test Ubuntu if: ${{ matrix.os == 'ubuntu-latest' }} working-directory: ./Src/Tests run: | - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/Linux/${{ matrix.platform }}/net6.0/runtimes/linux-${{ matrix.platform }}/native - dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=${{ matrix.platform }} + export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/Linux/x64/net6.0/runtimes/linux-x64/native + dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=x64 - name: Test MacOS if: ${{ matrix.os == 'macOS-latest' }} working-directory: ./Src/Tests run: | - export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/${{ matrix.platform }}/net6.0/runtimes/osx-${{ matrix.platform }}/native - dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=${{ matrix.platform }} + export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/x64/net6.0/runtimes/osx-x64/native + dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=x64 - name: Test Windows if: ${{ matrix.os == 'windows-latest' }} working-directory: ./Src/Tests run: | - set PATH="%PATH%;${GITHUB_WORKSPACE}\Src\CommandLine\bin\Release\Windows\${{ matrix.platform }}\net6.0\runtimes\win-${{ matrix.platform }}\native" - dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=${{ matrix.platform }} + set PATH="%PATH%;${GITHUB_WORKSPACE}\Src\CommandLine\bin\Release\Windows\x64\net6.0\runtimes\win-x64\native" + dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=x64 From e2e7d2432d0d52a73ce3787f076f3b124283452c Mon Sep 17 00:00:00 2001 From: liy94 Date: Wed, 29 May 2024 12:24:49 -0500 Subject: [PATCH 3/4] temporarily remove macos --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 0bbf9a9..b0034a6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v3 - name: Setup .NET From 036447810405d8bc5f967b1332de87b9eac16451 Mon Sep 17 00:00:00 2001 From: liy94 Date: Wed, 29 May 2024 12:36:17 -0500 Subject: [PATCH 4/4] separate MacOS work from Ubuntu and Windows --- .github/workflows/dotnet.yml | 50 ++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b0034a6..22609f2 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -31,36 +31,52 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' && github.ref_name == 'master' }} working-directory: ./Src/CommandLine run: dotnet pack CommandLine.csproj -c Release -p:PackageVersion="1.0.${{ github.run_number }}" /p:Platform=x64 - - name: Pack Nuget Package (macOS) - if: matrix.os == 'macOS-latest' && github.ref_name == 'master' - working-directory: ./Src/CommandLine - run: dotnet pack CommandLine.csproj -c Release -p:PackageVersion="1.0.${{ github.run_number }}" /p:Platform=ARM64 - name: Publish Nuget Package (ubuntu) if: ${{ matrix.os == 'ubuntu-latest' && github.ref_name == 'master' }} working-directory: ./nupkg run: dotnet nuget push VUISIS.Formula.x64.1.0.${{ github.run_number }}.nupkg --api-key ${{ secrets.BUILD_SECRET }} --source https://api.nuget.org/v3/index.json --skip-duplicate - - name: Publish Nuget Package (macOS) - if: matrix.os == 'macOS-latest' && github.ref_name == 'master' - working-directory: ./nupkg - run: dotnet nuget push VUISIS.Formula.ARM64.1.0.${{ github.run_number }}.nupkg --api-key ${{ secrets.BUILD_SECRET }} --source https://api.nuget.org/v3/index.json --skip-duplicate - - name: Copy to Liblibz3 MacOS - if: ${{ matrix.os == 'macOS-latest' }} - run: cp ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/x64/net6.0/runtimes/osx-x64/native/libz3.dylib ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/x64/net6.0/runtimes/osx-x64/native/liblibz3.dylib - name: Test Ubuntu if: ${{ matrix.os == 'ubuntu-latest' }} working-directory: ./Src/Tests run: | export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/Linux/x64/net6.0/runtimes/linux-x64/native dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=x64 - - name: Test MacOS - if: ${{ matrix.os == 'macOS-latest' }} - working-directory: ./Src/Tests - run: | - export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/x64/net6.0/runtimes/osx-x64/native - dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=x64 - name: Test Windows if: ${{ matrix.os == 'windows-latest' }} working-directory: ./Src/Tests run: | set PATH="%PATH%;${GITHUB_WORKSPACE}\Src\CommandLine\bin\Release\Windows\x64\net6.0\runtimes\win-x64\native" dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=x64 + + build-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.x + 7.x + 8.x + - name: Restore dependencies + working-directory: ./Src/CommandLine + run: dotnet restore CommandLine.sln + - name: Build + working-directory: ./Src/CommandLine + run: dotnet build CommandLine.sln /p:Configuration=Release /p:Platform=ARM64 + - name: Pack Nuget Package (macOS) + if: github.ref_name == 'master' + working-directory: ./Src/CommandLine + run: dotnet pack CommandLine.csproj -c Release -p:PackageVersion="1.0.${{ github.run_number }}" /p:Platform=ARM64 + - name: Publish Nuget Package (macOS) + if: github.ref_name == 'master' + working-directory: ./nupkg + run: dotnet nuget push VUISIS.Formula.ARM64.1.0.${{ github.run_number }}.nupkg --api-key ${{ secrets.BUILD_SECRET }} --source https://api.nuget.org/v3/index.json --skip-duplicate + - name: Copy to Liblibz3 MacOS + run: cp ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/ARM64/net6.0/runtimes/osx-ARM64/native/libz3.dylib ${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/ARM64/net6.0/runtimes/osx-ARM64/native/liblibz3.dylib + - name: Test MacOS + working-directory: ./Src/Tests + run: | + export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/Src/CommandLine/bin/Release/MacOS/ARM64/net6.0/runtimes/osx-ARM64/native + dotnet test Tests.csproj --logger "console;verbosity=detailed" /p:Configuration=Release /p:Platform=ARM64