-
-
Notifications
You must be signed in to change notification settings - Fork 421
154 lines (144 loc) · 6.81 KB
/
sdl2.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
name: SDL2
on:
push:
branches-ignore:
- "ci/**"
- "develop/**"
- "main"
paths:
- build/submodules/SDL
- "build/cmake/*"
- build/nuke/Native/Core.cs
- build/nuke/Native/SDL2.cs
- build/nuke/Native/SilkDroid.cs
- build/nuke/Build.Support.cs
- .github/workflows/sdl2.yml
jobs:
Build:
if: github.repository == 'dotnet/Silk.NET'
strategy:
fail-fast: false
matrix:
env:
- os: ubuntu-22.04
name: Linux
nuke_invoke: ./build.sh
- os: windows-latest # runner is not setup for android yet
name: Windows
nuke_invoke: ./build.cmd BuildLibSilkDroid
- os: macos-14
name: Darwin
nuke_invoke: ./build.sh
name: ${{ matrix.env.name }} Build
runs-on: ${{ matrix.env.os }}
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.PUSHABLE_GITHUB_TOKEN }}
- name: Checkout submodules, configure git
run: |
git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive build/submodules/SDL
git config --local user.email "[email protected]"
git config --local user.name "The Silk.NET Automaton"
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
if: runner.os == 'Windows'
with:
dotnet-version: 6.0.x
env:
DOTNET_INSTALL_DIR: ~/.dotnet
- name: Setup PowerShell Core
continue-on-error: true
if: runner.os == 'Windows'
run: dotnet tool install --global PowerShell
- name: Setup Java JDK 21
uses: actions/[email protected]
if: runner.os == 'Windows'
with:
java-version: 21
distribution: "temurin"
- name: Set PATH
if: runner.os == 'Windows'
id: set_path
run: |
echo "cur_path=$env:PATH\n" >> $env:GITHUB_OUTPUT
- name: Setup Android Environment
uses: android-actions/setup-android@v3
if: runner.os == 'Windows'
env:
PATH: "${{ env.DOTNET_ROOT }};${{ env.DOTNET_ROOT }}\\tools;${{ steps.set_path.outputs.cur_path }}"
- name: Install Android Platforms
if: runner.os == 'Windows'
run: |
sdkmanager --install "build-tools;32.0.0"
sdkmanager --install "platform-tools"
sdkmanager --install "platforms;android-31"
sdkmanager --install "platforms;android-33"
sdkmanager --install "platforms;android-34"
sdkmanager --install "ndk-bundle"
- name: Setup Java JDK 11
uses: actions/[email protected]
if: runner.os == 'Windows'
with:
java-version: 11
distribution: "temurin"
# Install CMake
- uses: lukka/get-cmake@latest
if: runner.os != 'Linux'
- name: Build SDL2
if: runner.os == 'Linux'
uses: Beyley/run-as-1804@239b211a2ca687388b6251d6dab22cb90ac0391d
with:
command: |
# We need to adjust APT sources for multiarch. Use the ones corresponding to
# Ubuntu 18.04 with appropriate `arch` values. ports.ubuntu.com is required
# for armhf and arm64.
tee /etc/apt/sources.list << EOF
deb [arch=amd64] http://archive.ubuntu.com/ubuntu bionic main multiverse restricted universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu bionic-backports main multiverse restricted universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe
deb [arch=arm64,armhf] http://ports.ubuntu.com bionic main multiverse restricted universe
deb [arch=arm64,armhf] http://ports.ubuntu.com bionic-backports main multiverse restricted universe
deb [arch=arm64,armhf] http://ports.ubuntu.com bionic-security main multiverse restricted universe
deb [arch=arm64,armhf] http://ports.ubuntu.com bionic-updates main multiverse restricted universe
deb [arch=amd64] http://security.ubuntu.com/ubuntu bionic main multiverse restricted universe
deb [arch=amd64] http://security.ubuntu.com/ubuntu bionic-backports main multiverse restricted universe
deb [arch=amd64] http://security.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
deb [arch=amd64] http://security.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe
EOF
dpkg --add-architecture arm64
dpkg --add-architecture armhf
apt update
apt install -y gcc gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf
apt install -y g++ g++-aarch64-linux-gnu g++-arm-linux-gnueabihf
apt install -y automake build-essential curl git libtool pkg-config python3 wget
for arch in amd64 arm64 armhf; do
apt install -y libasound2-dev:$arch libpulse-dev:$arch libaudio-dev:$arch
apt install -y libsndio-dev:$arch libsamplerate0-dev:$arch libx11-dev:$arch libxext-dev:$arch
apt install -y libxrandr-dev:$arch libxcursor-dev:$arch libxfixes-dev:$arch libxi-dev:$arch
apt install -y libxss-dev:$arch libwayland-dev:$arch libxkbcommon-dev:$arch libdrm-dev:$arch
apt install -y libgbm-dev:$arch libgl1-mesa-dev:$arch libgles2-mesa-dev:$arch libegl1-mesa-dev:$arch
apt install -y libdbus-1-dev:$arch libibus-1.0-dev:$arch libudev-dev:$arch
done
# This package isn't multiarch-compatible in 22.04, so we prioritize amd64 for this.
apt install -y libjack-dev
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
chmod +x ./dotnet-install.sh
./dotnet-install.sh --version 7.0.203
./dotnet-install.sh --version 6.0.408
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools
# export the pushable token to the env of the docker container
export PUSHABLE_GITHUB_TOKEN=${{ secrets.PUSHABLE_GITHUB_TOKEN }}
# mark workspace as safe
git config --global --add safe.directory /github/workspace
git config --global --add safe.directory /github/workspace/build/submodules/SDL
${{ matrix.env.nuke_invoke }} SDL2
env:
PUSHABLE_GITHUB_TOKEN: ${{ secrets.PUSHABLE_GITHUB_TOKEN }}
- name: Build SDL2
if: runner.os != 'Linux'
run: ${{ matrix.env.nuke_invoke }} SDL2 ${{ runner.os == 'Windows' && format('{0} {1}', '--native true --android-home-value', env.ANDROID_HOME) || '' }}
env:
PUSHABLE_GITHUB_TOKEN: ${{ secrets.PUSHABLE_GITHUB_TOKEN }}