forked from ddnet/ddnet
-
Notifications
You must be signed in to change notification settings - Fork 19
162 lines (148 loc) · 6.02 KB
/
fast-build.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
162
name: Fast-Build
on:
push:
branches-ignore:
- gh-readonly-queue/**
jobs:
build-cmake:
runs-on: ${{ matrix.os }}
env:
CARGO_HTTP_MULTIPLEXING: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macOS-latest, windows-latest]
include:
- os: ubuntu-20.04
cmake-args: -G Ninja -DCMAKE_BUILD_TYPE=Release -DDISCORD=ON -DDISCORD_DYNAMIC=ON -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON
cmake-init-env: CXXFLAGS=
package-file: "*-linux_x86_64.tar.xz"
fancy: true
- os: macOS-latest
cmake-args: -G Ninja -DCMAKE_BUILD_TYPE=Release -DDISCORD=ON -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_SYSTEM_IGNORE_PATH=/usr/lib -DCMAKE_FIND_FRAMEWORK=LAST
cmake-init-env: CXXFLAGS=
package-file: "*-macos.dmg"
fancy: false
- os: windows-latest
cmake-args: -A x64 -DDISCORD=ON
cmake-init-env: CXXFLAGS= LDFLAGS=
package-file: "*-win64.zip"
fancy: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Prepare Linux
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update -y
# mount: /var/lib/grub/esp: special device /dev/disk/by-id/scsi-... does not exist.
# sudo apt-get upgrade -y
sudo apt-get install pkg-config cmake ninja-build libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev libvulkan-dev glslang-tools spirv-tools libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev libpng-dev valgrind gcovr libglew-dev -y
- name: Prepare macOS
if: contains(matrix.os, 'macOS')
run: |
brew update || true
brew install pkg-config ninja molten-vk vulkan-headers glslang spirv-tools glew googletest libpng molten-vk opusfile wavpack x264 || true
brew upgrade freetype
pip3 install --break-system-packages dmgbuild
echo /Library/Frameworks/Python.framework/Versions/3.12/bin >> $GITHUB_PATH
- name: Add rust macOS
if: contains(matrix.os, 'macOS')
run: |
rustup default stable
rustup update
rustup target add x86_64-apple-darwin aarch64-apple-darwin
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Build in release mode
env:
VERSION: ${{ secrets.VERSION }}
shell: bash
run: |
VERSION_FILE="$GITHUB_WORKSPACE/versioninfo.h"
printf '%s' "$VERSION" | base64 -d > "$VERSION_FILE"
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
export MSYS_ARG_CONV_EXCL="/FI"
POST_FLAGS="-DCMAKE_CXX_FLAGS=\"/FI$VERSION_FILE\""
ENVFLAGS=""
else
ENVFLAGS="CXXFLAGS=-include$VERSION_FILE"
POST_FLAGS=""
fi
if [[ "${{ matrix.os }}" == "macOS-latest" ]]; then
POST_FLAGS+=" -DPNG_LIBRARY=${GITHUB_WORKSPACE}/ddnet-libs/png/mac/libfat/libpng16.16.dylib"
POST_FLAGS+=" -DPNG_INCLUDEDIR=${GITHUB_WORKSPACE}/ddnet-libs/png/include"
fi
mkdir release
cd release
${{ matrix.cmake-path }}cmake -E env ${{ matrix.cmake-init-env }} $ENVFLAGS ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} $POST_FLAGS -DCMAKE_BUILD_TYPE=Release -DDOWNLOAD_GTEST=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
${{ matrix.cmake-path }}cmake --build . --config Release --target everything ${{ matrix.build-args }}
- name: Package
run: |
cd release
${{ matrix.cmake-path }}cmake --build . --config Release --target package_default ${{ matrix.build-args }}
mkdir artifacts
mv ${{ matrix.package-file }} artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ddnet-${{ matrix.os }}
path: release/artifacts
build-android:
runs-on: ubuntu-24.04
env:
CARGO_HTTP_MULTIPLEXING: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Prepare
run: |
sudo apt-get update -y
sudo apt-get install cmake ninja-build openjdk-21-jdk p7zip-full curl glslang-tools openssl
cargo install cargo-ndk
rustup target add armv7-linux-androideabi
rustup target add i686-linux-android
rustup target add aarch64-linux-android
rustup target add x86_64-linux-android
mkdir ~/Android
cd ~/Android
mkdir Sdk
cd Sdk
mkdir ndk
cd ndk
wget --quiet https://dl.google.com/android/repository/android-ndk-r26d-linux.zip
unzip android-ndk-r26d-linux.zip
rm android-ndk-r26d-linux.zip
cd ~/Android/Sdk
mkdir build-tools
cd build-tools
wget --quiet https://dl.google.com/android/repository/build-tools_r30.0.3-linux.zip
unzip build-tools_r30.0.3-linux.zip
rm build-tools_r30.0.3-linux.zip
mv android-11 30.0.3
cd ~/Android/Sdk
mkdir cmdline-tools
cd cmdline-tools
wget --quiet https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
unzip commandlinetools-linux-11076708_latest.zip
rm commandlinetools-linux-11076708_latest.zip
mv cmdline-tools latest
yes | latest/bin/sdkmanager --licenses
- name: Build
env:
TW_KEY_NAME: /home/runner/DDNet.jks
TW_KEY_ALIAS: DDNet-Key
run: |
export TW_KEY_PW="$(openssl rand -base64 32)"
keytool -genkey -v -keystore "$TW_KEY_NAME" -keyalg RSA -keysize 2048 -validity 10000 -alias "$TW_KEY_ALIAS" -storepass "$TW_KEY_PW" -dname "CN=DDNet CI, OU=DDNet, O=DDNet"
mkdir build-android
scripts/android/cmake_android.sh all DDNet org.ddnet.client Release build-android
mkdir artifacts
mv build-android/DDNet.apk artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ddnet-android
path: artifacts