Skip to content

Allow to specify a path for the server provided assets. #153

Allow to specify a path for the server provided assets.

Allow to specify a path for the server provided assets. #153

Workflow file for this run

name: Build
on:
push:
branches-ignore:
- gh-readonly-queue/**
pull_request:
merge_group:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
include:
- os: ubuntu-latest
features-debug: "bundled_data_dir,ffmpeg,microphone"
features: "bundled_data_dir,ffmpeg,microphone"
bin: ddnet-rs
server-bin: server
- os: macOS-latest
features-debug: "bundled_data_dir,ffmpeg,microphone"
features: "bundled_data_dir,ffmpeg,microphone"
bin: ddnet-rs
server-bin: server
- os: windows-latest
# ffmpeg takes years on win
features-debug: "bundled_data_dir,microphone"
features: "bundled_data_dir,ffmpeg,microphone"
bin: ddnet-rs.exe
server-bin: server.exe
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash {0}' }}
steps:
- name: Prepare Windows (msys2)
uses: msys2/setup-msys2@v2
if: contains(matrix.os, 'windows')
with:
msystem: MINGW64
- name: Configure Windows Path for msys2
shell: powershell {0}
if: contains(matrix.os, 'windows')
run: |
$env:PATH = "${{ steps.msys2.outputs.msys2-location }}/usr/bin;" + [System.Environment]::GetEnvironmentVariable("Path", "User")
[System.Environment]::SetEnvironmentVariable("Path", $env:PATH, "User")
- name: Configure rustup for msys2
if: contains(matrix.os, 'windows')
run: |
export PATH="/c/users/$(whoami)/.cargo/bin:$PATH"
echo -e "export PATH=\"/c/users/$(whoami)/.cargo/bin:\$PATH\"\n" >> ~/.bash_profile
echo -e "export MINGW_ARCH=mingw64\n" >> ~/.bash_profile
- uses: actions/checkout@v4
with:
submodules: true
- run: |
rustup toolchain install stable --profile minimal
- name: Prepare Linux
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt update -y
sudo apt install rustc cargo gcc libwayland-dev libasound2-dev nasm -y
# for ffmpeg
sudo apt install -y clang libavcodec-dev libavformat-dev libavutil-dev libx264-dev
- name: Prepare macOS
if: contains(matrix.os, 'macOS')
run: |
brew update || true
brew install pkg-config autoconf automake || true
# for ffmpeg
brew install ffmpeg || true
- name: Prepare msys dependencies
if: contains(matrix.os, 'windows')
run: |
# important detail: mingw-w64-x86_64-libx264 is installed for the package config files!
pacman --noconfirm -S git make mingw-w64-x86_64-libx264 mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang mingw-w64-x86_64-gcc mingw-w64-x86_64-nasm mingw-w64-x86_64-opus
# self compile for now
# https://github.com/msys2/MINGW-packages/issues/8824
git clone --depth=1 https://github.com/mirror/x264 /c/x264
- name: Setup cache for x264 (Windows)
if: contains(matrix.os, 'windows')
uses: actions/cache@v4
id: x264-cache-compiled
with:
path: C:\build-x264
key: ${{ runner.os }}-buildx264-${{ hashFiles('/c/x264') }}
- name: Compile x264 (Windows)
if: contains(matrix.os, 'windows') && steps.x264-cache-compiled.outputs.cache-hit != 'true'
run: |
(
mkdir /c/build-x264
cd /c/build-x264
/c/x264/configure --enable-static
make -j$(nproc)
)
- name: Prepare msys
if: contains(matrix.os, 'windows')
run: |
rm /mingw64/lib/libx264.dll.a
cp /c/build-x264/libx264.a /mingw64/lib/libx264.a
rustup target add x86_64-pc-windows-gnu
rustup update stable
rustup set default-host x86_64-pc-windows-gnu
rustup default stable-x86_64-pc-windows-gnu
- uses: Swatinem/rust-cache@v2
- name: Build debug
# disable windows for now, since it's the slowest build
if: contains(matrix.os, 'windows') == false
run: cargo build --verbose --features ${{ matrix.features-debug }}
- name: Build release
run: cargo build --release --verbose --features ${{ matrix.features }}
- name: Build server release
run: cargo build -p server --release --verbose --features bundled_data_dir
- name: Prepare artifacts
run: |
mkdir bin-artifacts || true
mv target/release/${{ matrix.bin }} bin-artifacts
mv target/release/${{ matrix.server-bin }} bin-artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ddnet-rs-${{ matrix.os }}
path: bin-artifacts
- name: Build release with steam
run: cargo build --release --verbose --features ${{ matrix.features }},enable_steam
- name: Prepare artifacts
run: |
mkdir bin-artifacts || true
mv target/release/${{ matrix.bin }} bin-artifacts
- name: Upload Artifacts steam
uses: actions/upload-artifact@v4
with:
name: ddnet-rs-${{ matrix.os }}-steam
path: bin-artifacts