merge build actions

This commit is contained in:
Kevin Pfeifer 2024-05-15 10:58:22 +00:00
parent 03cea20777
commit aa668eb0cb
2 changed files with 102 additions and 143 deletions

View File

@ -1,95 +0,0 @@
name: cross compile linux
on:
workflow_dispatch:
inputs: {}
# schedule:
# - cron: '0 0 * * *'
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- { name: linux-arm64, container: arm64v8/ubuntu }
- { name: linux-arm, container: arm32v7/ubuntu }
steps:
-
uses: actions/checkout@v4
with:
repository: 'libsdl-org/SDL'
ref: 'main'
-
uses: actions/checkout@v4
with:
path: 'SDL3-CS'
-
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Run build process with Docker
uses: addnab/docker-run-action@v3
with:
image: ${{ matrix.platform.container }}
options: -v ${{ github.workspace }}:/workspace
run: |
apt update -y -qq
apt install -y \
gcc \
g++ \
cmake \
ninja-build \
wayland-scanner++ \
wayland-protocols \
pkg-config \
libasound2-dev \
libdbus-1-dev \
libegl1-mesa-dev \
libgl1-mesa-dev \
libgles2-mesa-dev \
libglu1-mesa-dev \
libibus-1.0-dev \
libpulse-dev \
libsndio-dev \
libudev-dev \
libwayland-dev \
libx11-dev \
libxcursor-dev \
libxext-dev \
libxi-dev \
libxinerama-dev \
libxkbcommon-dev \
libxrandr-dev \
libxss-dev \
libxt-dev \
libxv-dev \
libxxf86vm-dev \
libdrm-dev \
libgbm-dev \
libpulse-dev
cd /workspace
cmake -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON
cmake --build build/ --config Release
cmake --install build/ --prefix install_output --config Release
mkdir -p SDL3-CS/native/${{ matrix.platform.name }}
cp install_output/lib/libSDL3.so SDL3-CS/native/${{ matrix.platform.name }}/libSDL3.so
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update ${{ matrix.platform.name }} SDL binaries
title: Update ${{ matrix.platform.name }} SDL binaries
body: This PR has been auto-generated to update the ${{ matrix.platform.name }} SDL binaries.
branch: update-${{ matrix.platform.name }}-binaries
path: 'SDL3-CS'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'

View File

@ -20,13 +20,79 @@ jobs:
- { name: win-arm64, os: windows-latest, flags: -A ARM64 } - { name: win-arm64, os: windows-latest, flags: -A ARM64 }
- { name: linux-x64, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":amd64" } - { name: linux-x64, os: ubuntu-20.04, flags: -GNinja, target_apt_arch: ":amd64" }
- { name: linux-x86, os: ubuntu-20.04, flags: -GNinja, cmake_configure_env: CFLAGS=-m32 CXXFLAGS=-m32, target_apt_arch: ":i386" } - { name: linux-x86, os: ubuntu-20.04, flags: -GNinja, cmake_configure_env: CFLAGS=-m32 CXXFLAGS=-m32, target_apt_arch: ":i386" }
- { name: linux-arm64, os: ubuntu-20.04, container: arm64v8/ubuntu }
- { name: linux-arm, os: ubuntu-20.04, container: arm32v7/ubuntu }
- { name: osx-x64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.14" } - { name: osx-x64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.14" }
# NOTE: macOS 11.0 is the first released supported by Apple Silicon. # NOTE: macOS 11.0 is the first released supported by Apple Silicon.
- { name: osx-arm64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" } - { name: osx-arm64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" }
steps: steps:
- name: Setup Linux dependencies - uses: actions/checkout@v4
if: runner.os == 'Linux' with:
repository: 'libsdl-org/SDL'
ref: 'main'
- uses: actions/checkout@v4
with:
path: 'SDL3-CS'
- name: Set up QEMU
if: contains(matrix.platform.container, 'arm')
uses: docker/setup-qemu-action@v3
- name: Build (Linux ARM)
if: contains(matrix.platform.container, 'arm')
uses: addnab/docker-run-action@v3
with:
image: ${{ matrix.platform.container }}
options: -v ${{ github.workspace }}:/workspace
run: | run: |
apt update -y -qq
apt install -y \
gcc \
g++ \
cmake \
ninja-build \
wayland-scanner++ \
wayland-protocols \
pkg-config \
libasound2-dev \
libdbus-1-dev \
libegl1-mesa-dev \
libgl1-mesa-dev \
libgles2-mesa-dev \
libglu1-mesa-dev \
libibus-1.0-dev \
libpulse-dev \
libsndio-dev \
libudev-dev \
libwayland-dev \
libx11-dev \
libxcursor-dev \
libxext-dev \
libxi-dev \
libxinerama-dev \
libxkbcommon-dev \
libxrandr-dev \
libxss-dev \
libxt-dev \
libxv-dev \
libxxf86vm-dev \
libdrm-dev \
libgbm-dev \
libpulse-dev
cd /workspace
cmake -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON
cmake --build build/ --config Release
cmake --install build/ --prefix install_output --config Release
mkdir -p SDL3-CS/native/${{ matrix.platform.name }}
cp install_output/lib/libSDL3.so SDL3-CS/native/${{ matrix.platform.name }}/libSDL3.so
- name: Build
if: runner.os == 'Linux' && !contains(matrix.platform.container, 'arm')
run: |
# Setup Linux dependencies
if [[ ${{ matrix.platform.target_apt_arch }} == :i386 ]]; then if [[ ${{ matrix.platform.target_apt_arch }} == :i386 ]]; then
sudo dpkg --add-architecture i386 sudo dpkg --add-architecture i386
fi fi
@ -72,48 +138,36 @@ jobs:
libgbm-dev${{ matrix.platform.target_apt_arch }} \ libgbm-dev${{ matrix.platform.target_apt_arch }} \
libpulse-dev${{ matrix.platform.target_apt_arch }} libpulse-dev${{ matrix.platform.target_apt_arch }}
- uses: actions/checkout@v4 # Configure CMake
with: ${{ matrix.platform.cmake_configure_env }} cmake -B build ${{ matrix.platform.flags }} -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON
repository: 'libsdl-org/SDL'
ref: 'main'
- uses: actions/checkout@v4 # Build
with: cmake --build build/ --config Release
path: 'SDL3-CS'
- name: Configure CMake if [[ ${{ runner.os }} == 'Windows' ]]; then
run: ${{ matrix.platform.cmake_configure_env }} cmake -B build ${{ matrix.platform.flags }} -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON # Install (Windows)
cmake --install build/ --prefix install_output --config Release
- name: Build # Prepare release directory (Windows)
run: cmake --build build/ --config Release mkdir -Force SDL3-CS/native/${{ matrix.platform.name }}
else
# Install
sudo cmake --install build/ --prefix install_output --config Release
- name: Install (Windows) # Prepare release directory
run: cmake --install build/ --prefix install_output --config Release mkdir -p SDL3-CS/native/${{ matrix.platform.name }}
if: runner.os == 'Windows' fi
- name: Install if [[ ${{ runner.os }} == 'Windows' ]]; then
run: sudo cmake --install build/ --prefix install_output --config Release # Prepare release (Windows)
if: runner.os != 'Windows' cp install_output/bin/SDL3.dll SDL3-CS/native/${{ matrix.platform.name }}/SDL3.dll
elif [[ ${{ runner.os }} == 'Linux' ]]; then
- name: Prepare release directory (Windows) # Prepare release (Linux)
run: mkdir -Force SDL3-CS/native/${{ matrix.platform.name }} cp install_output/lib/libSDL3.so SDL3-CS/native/${{ matrix.platform.name }}/libSDL3.so
if: runner.os == 'Windows' elif [[ ${{ runner.os }} == 'macOS' ]]; then
# Prepare release (macOS)
- name: Prepare release directory cp install_output/lib/libSDL3.dylib SDL3-CS/native/${{ matrix.platform.name }}/libSDL3.dylib
run: mkdir -p SDL3-CS/native/${{ matrix.platform.name }} fi
if: runner.os != 'Windows'
- name: Prepare release (Windows)
run: cp install_output/bin/SDL3.dll SDL3-CS/native/${{ matrix.platform.name }}/SDL3.dll
if: runner.os == 'Windows'
- name: Prepare release (Linux)
run: cp install_output/lib/libSDL3.so SDL3-CS/native/${{ matrix.platform.name }}/libSDL3.so
if: runner.os == 'Linux'
- name: Prepare release (macOS)
run: cp install_output/lib/libSDL3.dylib SDL3-CS/native/${{ matrix.platform.name }}/libSDL3.dylib
if: runner.os == 'macOS'
- name: Create pull request - name: Create pull request
uses: peter-evans/create-pull-request@v6 uses: peter-evans/create-pull-request@v6