More fix #75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Natives | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths: | |
- lib/** | |
- src/Raylib.NET.Native/** | |
- .github/workflows/build-natives.yml | |
jobs: | |
natives: | |
strategy: | |
matrix: | |
# TODO: add linx-arm64, probs needs separate runner | |
runtime: [linux-x64, linux-arm64, browser-wasm, osx-x64, osx-arm64, win-x64, win-x86, win-arm64] | |
config: [Debug, Release] | |
include: | |
- runtime: linux-x64 | |
os: ubuntu-latest | |
- runtime: linux-arm64 | |
os: ubuntu-latest | |
- runtime: browser-wasm | |
os: ubuntu-latest | |
- runtime: osx-x64 | |
os: macos-latest | |
- runtime: osx-arm64 | |
os: macos-latest | |
- runtime: win-x64 | |
os: windows-latest | |
- runtime: win-x86 | |
os: windows-latest | |
- runtime: win-arm64 | |
os: windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup Environment (x64) | |
if: matrix.os == 'ubuntu-latest' && matrix.runtime == 'linux-x64' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
gcc-multilib \ | |
libgl1-mesa-dev \ | |
libglfw3 \ | |
libglfw3-dev \ | |
libx11-dev \ | |
libxcursor-dev \ | |
libxrandr-dev \ | |
libxinerama-dev \ | |
libxi-dev \ | |
libxext-dev \ | |
libxfixes-dev \ | |
libwayland-dev \ | |
libxkbcommon-dev | |
- name: Setup Environment (arm64) | |
if: matrix.os == 'ubuntu-latest' && matrix.runtime == 'linux-arm64' | |
run: | | |
sudo dpkg --print-foreign-architectures | |
sudo dpkg --add-architecture arm64 | |
# Modify main sources.list to be explicitly amd64 | |
sudo sed -i 's/^deb /deb [arch=amd64] /g' /etc/apt/sources.list | |
# Create clean sources for arm64 | |
sudo tee /etc/apt/sources.list.d/ubuntu-ports.list << EOF | |
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe multiverse | |
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe multiverse | |
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse | |
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse | |
EOF | |
# Clear package lists and update | |
sudo rm -rf /var/lib/apt/lists/* | |
sudo apt-get clean | |
sudo apt-get update | |
sudo apt-get install -y \ | |
crossbuild-essential-arm64 \ | |
gcc-aarch64-linux-gnu \ | |
g++-aarch64-linux-gnu \ | |
libc6-dev-arm64-cross \ | |
tree | |
sudo apt-get install -y \ | |
gcc-multilib \ | |
libgl1-mesa-dev:arm64 \ | |
libglfw3:arm64 \ | |
libglfw3-dev:arm64 \ | |
libx11-dev:arm64 \ | |
libxcursor-dev:arm64 \ | |
libxrandr-dev:arm64 \ | |
libxinerama-dev:arm64 \ | |
libxi-dev:arm64 \ | |
libxext-dev:arm64 \ | |
libxfixes-dev:arm64 \ | |
libwayland-dev:arm64 \ | |
libxkbcommon-dev:arm64 | |
# List architecture include folders | |
tree /usr/include -L 2 | |
- name: Setup EMSDK | |
if: matrix.runtime == 'browser-wasm' | |
uses: mymindstorm/setup-emsdk@v14 | |
with: | |
actions-cache-folder: 'emsdk-cache' | |
- name: Build Natives | |
run: dotnet build -c ${{ matrix.config }} -r ${{ matrix.runtime }} | |
working-directory: src/Raylib.NET.Native | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: natives-${{ matrix.config }}-${{ matrix.runtime }} | |
path: src/Raylib.NET.Native/bin/${{ matrix.config }}/runtimes/** | |
if-no-files-found: error | |
upload-packages: | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
needs: | |
- natives | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Download Debug Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: natives-Debug-* | |
path: src/Raylib.NET.Native/bin/Debug/runtimes | |
merge-multiple: true | |
- name: Download Release Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: natives-Release-* | |
path: src/Raylib.NET.Native/bin/Release/runtimes | |
merge-multiple: true | |
- name: Generate NuGet Version | |
id: package-info | |
run: | | |
version="build.$(git rev-list --count HEAD)" | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Create NuGet Debug Packages | |
run: dotnet pack src/Raylib.NET.Native -c Debug --output nuget -p:SkipNatives=true -p:SkipGen=true -p:VersionSuffix=${{ steps.package-info.outputs.version }} | |
- name: Create NuGet Release Packages | |
run: dotnet pack src/Raylib.NET.Native -c Release --output nuget -p:SkipNatives=true -p:SkipGen=true -p:VersionSuffix=${{ steps.package-info.outputs.version }} | |
- name: Upload NuGet Packages As Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nuget-packages | |
path: nuget/* | |
- name: Publish NuGet Packages to GitHub Packages | |
run: dotnet nuget push nuget/*.nupkg -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ secrets.GITHUB_TOKEN }} --skip-duplicate |