-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (145 loc) · 5.19 KB
/
build-natives.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
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'
shell: bash
run: |
sudo apt-get update -qq
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'
shell: bash
run: |
sudo dpkg --print-foreign-architectures
sudo dpkg --add-architecture arm64
sudo sed -i 's/http:\/\/security.ubuntu.com\/ubuntu\//http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list
sudo sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
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 \
crossbuild-essential-arm64
- 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