mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-09-09 03:01:41 -04:00
build linux native library
This commit is contained in:
287
.github/workflows/build.yml
vendored
287
.github/workflows/build.yml
vendored
@@ -8,143 +8,186 @@ on:
|
||||
- 'README.md'
|
||||
- '.github/ISSUE_TEMPLATE/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build on dotnet using ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
- name: Build project
|
||||
run: dotnet build -c Release -f net6.0
|
||||
- name: Test project
|
||||
run: dotnet test -c Release -f net6.0
|
||||
publish:
|
||||
name: Build Release Package
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
- name: Download Repo
|
||||
uses: actions/checkout@v2
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- id: get-tag
|
||||
name: Get Target Raylib Version
|
||||
uses: mavrosxristoforos/get-xml-info@1.0
|
||||
with:
|
||||
xml-file: "./Raylib-cs/Raylib-cs.csproj"
|
||||
xpath: "//TargetRaylibTag"
|
||||
- name: check raylib version
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
echo "version=$(sed -n 's/.*<TargetRaylibTag>\(.*\)<\/TargetRaylibTag>.*/\1/p' Raylib-cs/Raylib-cs.csproj)">> ${GITHUB_OUTPUT}
|
||||
|
||||
- name: echo tag
|
||||
run: echo ${{ steps.get-tag.outputs.info }}
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare
|
||||
steps:
|
||||
- name: setup dependencies
|
||||
run: |
|
||||
sudo apt install \
|
||||
libasound2-dev \
|
||||
libx11-dev \
|
||||
libxrandr-dev \
|
||||
libxi-dev \
|
||||
libgl1-mesa-dev \
|
||||
libglu1-mesa-dev \
|
||||
libxcursor-dev \
|
||||
libxinerama-dev
|
||||
|
||||
- name: Download win-x64 Raylib Release
|
||||
uses: robinraju/release-downloader@v1.3
|
||||
with:
|
||||
repository: "raysan5/raylib"
|
||||
tag: ${{ steps.get-tag.outputs.info }}
|
||||
fileName: "raylib-${{steps.get-tag.outputs.info}}_win64_msvc16.zip"
|
||||
- name: build raylib
|
||||
env:
|
||||
version: ${{ needs.prepare.outputs.version }}
|
||||
run: |
|
||||
curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/${version}.zip
|
||||
unzip -qq raylib.zip
|
||||
cmake -S raylib-${version} \
|
||||
-B build \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D BUILD_SHARED_LIBS=ON \
|
||||
-D BUILD_EXAMPLES=OFF
|
||||
cmake --build build --config Release
|
||||
|
||||
- name: extract win-x64
|
||||
uses: montudor/action-zip@v1
|
||||
with:
|
||||
args: unzip -qq raylib-${{steps.get-tag.outputs.info}}_win64_msvc16.zip -d raylib-win64
|
||||
# jobs:
|
||||
# build:
|
||||
# name: Build on dotnet using ${{ matrix.os }}
|
||||
# runs-on: ${{ matrix.os }}
|
||||
# strategy:
|
||||
# matrix:
|
||||
# os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - name: Setup dotnet
|
||||
# uses: actions/setup-dotnet@v1
|
||||
# with:
|
||||
# dotnet-version: 6.0.x
|
||||
# - name: Build project
|
||||
# run: dotnet build -c Release -f net6.0
|
||||
# - name: Test project
|
||||
# run: dotnet test -c Release -f net6.0
|
||||
# publish:
|
||||
# name: Build Release Package
|
||||
# runs-on: ubuntu-latest
|
||||
# needs: build
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - name: Setup dotnet
|
||||
# uses: actions/setup-dotnet@v1
|
||||
# with:
|
||||
# dotnet-version: 6.0.x
|
||||
# - name: Download Repo
|
||||
# uses: actions/checkout@v2
|
||||
|
||||
- name: copy win-x64
|
||||
uses: canastro/copy-file-action@master
|
||||
with:
|
||||
source: "raylib-win64/raylib-${{steps.get-tag.outputs.info}}_win64_msvc16/lib/raylib.dll"
|
||||
target: "Raylib-cs/runtimes/win-x64/native/raylib.dll"
|
||||
|
||||
- name: Download win-x86 Raylib Release
|
||||
uses: robinraju/release-downloader@v1.3
|
||||
with:
|
||||
repository: "raysan5/raylib"
|
||||
tag: ${{ steps.get-tag.outputs.info }}
|
||||
fileName: "raylib-${{steps.get-tag.outputs.info}}_win32_msvc16.zip"
|
||||
# - id: get-tag
|
||||
# name: Get Target Raylib Version
|
||||
# uses: mavrosxristoforos/get-xml-info@1.0
|
||||
# with:
|
||||
# xml-file: './Raylib-cs/Raylib-cs.csproj'
|
||||
# xpath: '//TargetRaylibTag'
|
||||
|
||||
- name: extract win-x86
|
||||
uses: montudor/action-zip@v1
|
||||
with:
|
||||
args: unzip -qq raylib-${{steps.get-tag.outputs.info}}_win32_msvc16.zip -d raylib-win86
|
||||
# - name: echo tag
|
||||
# run: echo ${{ steps.get-tag.outputs.info }}
|
||||
|
||||
- name: copy win-x86
|
||||
uses: canastro/copy-file-action@master
|
||||
with:
|
||||
source: "raylib-win86/raylib-${{steps.get-tag.outputs.info}}_win32_msvc16/lib/raylib.dll"
|
||||
target: "Raylib-cs/runtimes/win-x86/native/raylib.dll"
|
||||
|
||||
- name: Download linux-x64 Raylib Release
|
||||
uses: robinraju/release-downloader@v1.3
|
||||
with:
|
||||
repository: "raysan5/raylib"
|
||||
tag: ${{ steps.get-tag.outputs.info }}
|
||||
fileName: "raylib-${{steps.get-tag.outputs.info}}_linux_amd64.tar.gz"
|
||||
# - name: Download win-x64 Raylib Release
|
||||
# uses: robinraju/release-downloader@v1.3
|
||||
# with:
|
||||
# repository: 'raysan5/raylib'
|
||||
# tag: ${{ steps.get-tag.outputs.info }}
|
||||
# fileName: 'raylib-${{steps.get-tag.outputs.info}}_win64_msvc16.zip'
|
||||
|
||||
- name: extract linux-x64
|
||||
run: mkdir -p raylib-linux64 && tar -xvf raylib-${{steps.get-tag.outputs.info}}_linux_amd64.tar.gz -C raylib-linux64
|
||||
# - name: extract win-x64
|
||||
# uses: montudor/action-zip@v1
|
||||
# with:
|
||||
# args: unzip -qq raylib-${{steps.get-tag.outputs.info}}_win64_msvc16.zip -d raylib-win64
|
||||
|
||||
- name: copy linux-x64
|
||||
uses: canastro/copy-file-action@master
|
||||
with:
|
||||
source: "raylib-linux64/raylib-${{steps.get-tag.outputs.info}}_linux_amd64/lib/libraylib.so.${{steps.get-tag.outputs.info}}"
|
||||
target: "Raylib-cs/runtimes/linux-x64/native/libraylib.so"
|
||||
# - name: copy win-x64
|
||||
# uses: canastro/copy-file-action@master
|
||||
# with:
|
||||
# source: 'raylib-win64/raylib-${{steps.get-tag.outputs.info}}_win64_msvc16/lib/raylib.dll'
|
||||
# target: 'Raylib-cs/runtimes/win-x64/native/raylib.dll'
|
||||
|
||||
- name: Download osx-x64 Raylib Release
|
||||
uses: robinraju/release-downloader@v1.3
|
||||
with:
|
||||
repository: "raysan5/raylib"
|
||||
tag: ${{ steps.get-tag.outputs.info }}
|
||||
fileName: "raylib-${{steps.get-tag.outputs.info}}_macos.tar.gz"
|
||||
# - name: Download win-x86 Raylib Release
|
||||
# uses: robinraju/release-downloader@v1.3
|
||||
# with:
|
||||
# repository: 'raysan5/raylib'
|
||||
# tag: ${{ steps.get-tag.outputs.info }}
|
||||
# fileName: 'raylib-${{steps.get-tag.outputs.info}}_win32_msvc16.zip'
|
||||
|
||||
- name: extract osx-x64
|
||||
run: mkdir -p raylib-osx64 && tar -xvf raylib-${{steps.get-tag.outputs.info}}_macos.tar.gz -C raylib-osx64
|
||||
# - name: extract win-x86
|
||||
# uses: montudor/action-zip@v1
|
||||
# with:
|
||||
# args: unzip -qq raylib-${{steps.get-tag.outputs.info}}_win32_msvc16.zip -d raylib-win86
|
||||
|
||||
- name: copy osx-x64
|
||||
uses: canastro/copy-file-action@master
|
||||
with:
|
||||
source: "raylib-osx64/raylib-${{steps.get-tag.outputs.info}}_macos/lib/libraylib.dylib"
|
||||
target: "Raylib-cs/runtimes/osx-x64/native/libraylib.dylib"
|
||||
|
||||
- name: copy osx-arm64
|
||||
uses: canastro/copy-file-action@master
|
||||
with:
|
||||
source: "raylib-osx64/raylib-${{steps.get-tag.outputs.info}}_macos/lib/libraylib.dylib"
|
||||
target: "Raylib-cs/runtimes/osx-arm64/native/libraylib.dylib"
|
||||
|
||||
- id: get-nuget-version
|
||||
name: Get NuGet Package Version
|
||||
uses: mavrosxristoforos/get-xml-info@1.0
|
||||
with:
|
||||
xml-file: "./Raylib-cs/Raylib-cs.csproj"
|
||||
xpath: "//PackageVersion"
|
||||
# - name: copy win-x86
|
||||
# uses: canastro/copy-file-action@master
|
||||
# with:
|
||||
# source: 'raylib-win86/raylib-${{steps.get-tag.outputs.info}}_win32_msvc16/lib/raylib.dll'
|
||||
# target: 'Raylib-cs/runtimes/win-x86/native/raylib.dll'
|
||||
|
||||
- name: Create NuGet Package
|
||||
run: dotnet pack -c Release Raylib-cs
|
||||
# - name: Download linux-x64 Raylib Release
|
||||
# uses: robinraju/release-downloader@v1.3
|
||||
# with:
|
||||
# repository: 'raysan5/raylib'
|
||||
# tag: ${{ steps.get-tag.outputs.info }}
|
||||
# fileName: 'raylib-${{steps.get-tag.outputs.info}}_linux_amd64.tar.gz'
|
||||
|
||||
- name: Upload NuGet Package As Artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg
|
||||
path: Raylib-cs/bin/Release/Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg
|
||||
# - name: extract linux-x64
|
||||
# run: mkdir -p raylib-linux64 && tar -xvf raylib-${{steps.get-tag.outputs.info}}_linux_amd64.tar.gz -C raylib-linux64
|
||||
|
||||
- name: Upload NuGet Package As Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: Raylib-cs/bin/Release/Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg
|
||||
|
||||
- name: Publish to NuGet
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: dotnet nuget push Raylib-cs/bin/Release/Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg --api-key ${{secrets.NUGET_API_KEY}}
|
||||
# - name: copy linux-x64
|
||||
# uses: canastro/copy-file-action@master
|
||||
# with:
|
||||
# source: 'raylib-linux64/raylib-${{steps.get-tag.outputs.info}}_linux_amd64/lib/libraylib.so.${{steps.get-tag.outputs.info}}'
|
||||
# target: 'Raylib-cs/runtimes/linux-x64/native/libraylib.so'
|
||||
|
||||
# - name: Download osx-x64 Raylib Release
|
||||
# uses: robinraju/release-downloader@v1.3
|
||||
# with:
|
||||
# repository: 'raysan5/raylib'
|
||||
# tag: ${{ steps.get-tag.outputs.info }}
|
||||
# fileName: 'raylib-${{steps.get-tag.outputs.info}}_macos.tar.gz'
|
||||
|
||||
# - name: extract osx-x64
|
||||
# run: mkdir -p raylib-osx64 && tar -xvf raylib-${{steps.get-tag.outputs.info}}_macos.tar.gz -C raylib-osx64
|
||||
|
||||
# - name: copy osx-x64
|
||||
# uses: canastro/copy-file-action@master
|
||||
# with:
|
||||
# source: 'raylib-osx64/raylib-${{steps.get-tag.outputs.info}}_macos/lib/libraylib.dylib'
|
||||
# target: 'Raylib-cs/runtimes/osx-x64/native/libraylib.dylib'
|
||||
|
||||
# - name: copy osx-arm64
|
||||
# uses: canastro/copy-file-action@master
|
||||
# with:
|
||||
# source: 'raylib-osx64/raylib-${{steps.get-tag.outputs.info}}_macos/lib/libraylib.dylib'
|
||||
# target: 'Raylib-cs/runtimes/osx-arm64/native/libraylib.dylib'
|
||||
|
||||
# - id: get-nuget-version
|
||||
# name: Get NuGet Package Version
|
||||
# uses: mavrosxristoforos/get-xml-info@1.0
|
||||
# with:
|
||||
# xml-file: './Raylib-cs/Raylib-cs.csproj'
|
||||
# xpath: '//PackageVersion'
|
||||
|
||||
# - name: Create NuGet Package
|
||||
# run: dotnet pack -c Release Raylib-cs
|
||||
|
||||
# - name: Upload NuGet Package As Artifact
|
||||
# uses: actions/upload-artifact@v2
|
||||
# with:
|
||||
# name: Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg
|
||||
# path: Raylib-cs/bin/Release/Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg
|
||||
|
||||
# - name: Upload NuGet Package As Release
|
||||
# uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
# with:
|
||||
# files: Raylib-cs/bin/Release/Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg
|
||||
|
||||
# - name: Publish to NuGet
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
# run: dotnet nuget push Raylib-cs/bin/Release/Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg --api-key ${{secrets.NUGET_API_KEY}}
|
||||
|
Reference in New Issue
Block a user