Update #320
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Lib | |
on: [push, pull_request] | |
env: | |
LINK_JOBS: 16 | |
JOBS: 16 | |
MODE: release | |
XMAKE_ARGS: -v | |
ANDROID_NDK_VERSION: r27c | |
OHOS_SDK_VERSION: 5.0.0-Release | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
name: Windows (x64) | |
plat: windows | |
arch: x64 | |
- os: windows-latest | |
name: Windows (x86) | |
plat: windows | |
arch: x86 | |
- os: windows-latest | |
name: Windows (arm64) | |
plat: windows | |
arch: arm64 | |
- os: ubuntu-latest | |
name: OpenHarmony (arm64-v8a) | |
plat: harmony | |
arch: arm64-v8a | |
- os: ubuntu-latest | |
name: OpenHarmony (armeabi-v7a) | |
plat: harmony | |
arch: armeabi-v7a | |
- os: ubuntu-latest | |
name: OpenHarmony (x86_64) | |
plat: harmony | |
arch: x86_64 | |
- os: ubuntu-latest | |
name: Android (arm64-v8a) | |
plat: android | |
arch: arm64-v8a | |
- os: ubuntu-latest | |
name: Android (armeabi-v7a) | |
plat: android | |
arch: armeabi-v7a | |
- os: ubuntu-latest | |
name: Android (x86) | |
plat: android | |
arch: x86 | |
- os: ubuntu-latest | |
name: Android (x86_64) | |
plat: android | |
arch: x86_64 | |
- os: ubuntu-latest | |
name: Android (riscv64) | |
plat: android | |
arch: riscv64 | |
- os: ubuntu-latest | |
name: Linux (x64) | |
plat: linux | |
arch: x64 | |
- os: ubuntu-latest | |
name: Linux (arm64) | |
plat: linux | |
arch: arm64 | |
triplet: aarch64-linux-gnu | |
libc_arch: arm64 | |
- os: ubuntu-latest | |
name: Linux (arm32) | |
plat: linux | |
arch: arm32 | |
triplet: arm-linux-gnueabihf | |
libc_arch: armhf | |
- os: ubuntu-latest | |
name: Linux (ppc64) | |
plat: linux | |
arch: ppc64le | |
triplet: powerpc64le-linux-gnu | |
libc_arch: ppc64el | |
- os: ubuntu-latest | |
name: Linux (riscv) | |
plat: linux | |
arch: riscv64 | |
triplet: riscv64-linux-gnu | |
libc_arch: riscv64 | |
- os: ubuntu-latest | |
name: Linux (loongarch64) | |
plat: linux | |
arch: loong64 | |
libc_arch: loongarch64 | |
- os: ubuntu-latest | |
name: FreeBSD (x64) | |
plat: freebsd | |
arch: x64 | |
- os: ubuntu-latest | |
name: FreeBSD (arm64) | |
plat: freebsd | |
arch: arm64 | |
- os: macos-latest | |
name: MacOS (arm64) | |
plat: macos | |
arch: arm64 | |
- os: macos-13 | |
name: MacOS (x86) | |
plat: macos | |
arch: x64 | |
- os: macos-latest | |
name: IphoneOS | |
plat: iphoneos | |
arch: arm64 | |
name: Build ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'true' | |
- name: Install xmake | |
if: matrix.plat != 'freebsd' | |
uses: xmake-io/github-action-setup-xmake@v1 | |
with: | |
xmake-version: branch@master | |
- name: Update xmake repo | |
if: matrix.plat != 'freebsd' | |
run: xmake repo -u | |
- name: Setup OpenHarmony SDK | |
if: matrix.plat == 'harmony' | |
run: | | |
wget https://repo.huaweicloud.com/openharmony/os/${{ env.OHOS_SDK_VERSION }}/ohos-sdk-windows_linux-public.tar.gz | |
tar -zxvf ohos-sdk-windows_linux-public.tar.gz | |
unzip linux/native*.zip | |
- name: Setup Android NDK | |
if: matrix.plat == 'android' | |
run: | | |
wget https://dl.google.com/android/repository/android-ndk-${{ env.ANDROID_NDK_VERSION }}-linux.zip | |
unzip android-ndk-${{ env.ANDROID_NDK_VERSION }}-linux.zip | |
- name: Configure MacOS | |
if: matrix.plat == 'macos' | |
run: xmake f -m ${{ env.MODE }} --cxx="clang++" -yc ${{ env.XMAKE_ARGS }} | |
- name: Configure IOS | |
if: matrix.plat == 'iphoneos' | |
run: xmake f -p iphoneos -m ${{ env.MODE }} --cxx="clang++" -yc ${{ env.XMAKE_ARGS }} | |
- name: Configure OpenHarmony | |
if: matrix.plat == 'harmony' | |
run: xmake f -p harmony -a ${{ matrix.arch }} --sdk=${{ github.workspace }}/native -m ${{ env.MODE }} -yc ${{ env.XMAKE_ARGS }} | |
- name: Configure Android | |
if: matrix.plat == 'android' | |
run: xmake f -p android -a ${{ matrix.arch }} --ndk=${{ github.workspace }}/android-ndk-${{ env.ANDROID_NDK_VERSION }} -m ${{ env.MODE }} -yc ${{ env.XMAKE_ARGS }} | |
- name: Configure Linux | |
if: ${{ matrix.plat == 'linux' && matrix.arch == 'x64' }} | |
run: xmake f -a ${{ matrix.arch }} -m ${{ env.MODE }} -yc ${{ env.XMAKE_ARGS }} | |
- name: Configure Linux Cross | |
if: ${{ matrix.plat == 'linux' && matrix.arch != 'x64' && matrix.arch != 'loong64' }} | |
run: | | |
sudo apt update | |
sudo apt install gcc-multilib g++-multilib | |
sudo apt install gcc-${{ matrix.triplet }} g++-${{ matrix.triplet }} | |
sudo apt install libc6-dev-${{ matrix.libc_arch }}-cross | |
sudo sed -i 's/deb mirror/deb [arch=amd64,i386] mirror/' /etc/apt/sources.list | |
sudo grep "mirror+file" /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/ports.list | |
sudo sed -i 's/amd64,i386/${{ matrix.libc_arch }}/' /etc/apt/sources.list.d/ports.list | |
sudo sed -i 's#mirror+file:/etc/apt/apt-mirrors.txt#http://ports.ubuntu.com/ubuntu-ports/#' /etc/apt/sources.list.d/ports.list | |
sudo dpkg --add-architecture ${{ matrix.libc_arch }} | |
sudo apt-get update || true | |
DEBIAN_FRONTEND=noninteractive sudo apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install libgtk-3-dev:${{ matrix.libc_arch }} libatk-bridge2.0-dev:${{ matrix.libc_arch }} libgdk-pixbuf2.0-dev:${{ matrix.libc_arch }} libglu-dev:${{ matrix.libc_arch }} libgl1-mesa-glx:${{ matrix.libc_arch }} libx11-dev:${{ matrix.libc_arch }} libxt-dev:${{ matrix.libc_arch }} libdbus-1-dev:${{ matrix.libc_arch }} -o Dpkg::Options::="--force-overwrite" | |
xmake f -a ${{ matrix.arch }} --sdk=/usr --cross=${{ matrix.triplet }}- -m ${{ env.MODE }} -yc ${{ env.XMAKE_ARGS }} --cxxflags="-Wno-undef" --ldflags="-Wno-undef" | |
- name: Configure Linux LoongArch | |
if: ${{ matrix.plat == 'linux' && matrix.arch == 'loong64' }} | |
run: | | |
wget https://github.com/loongson/build-tools/releases/download/2024.11.01/x86_64-cross-tools-loongarch64-binutils_2.43.1-gcc_14.2.0-glibc_2.40.tar.xz | |
tar -Jxvf x86_64-cross-tools-loongarch64-binutils_2.43.1-gcc_14.2.0-glibc_2.40.tar.xz | |
xmake f -a ${{ matrix.arch }} --sdk=${{ github.workspace }}/cross-tools -m ${{ env.MODE }} -yc ${{ env.XMAKE_ARGS }} --cxxflags="-Wno-undef" --ldflags="-Wno-undef" | |
- name: Configure Windows | |
if: matrix.plat == 'windows' | |
run: xmake f --toolchain=msvc -a ${{ matrix.arch }} -m ${{ env.MODE }} -yc ${{ env.XMAKE_ARGS }} | |
- name: Build | |
if: matrix.plat != 'freebsd' | |
run: xmake -y --jobs=${{ env.JOBS }} --linkjobs=${{ env.LINK_JOBS }} ${{ env.XMAKE_ARGS }} | |
- name: Build FreeBSD (x86_64) | |
if: matrix.plat == 'freebsd' && matrix.arch == 'x64' | |
uses: cross-platform-actions/[email protected] | |
with: | |
operating_system: freebsd | |
architecture: x86-64 | |
version: '13.3' | |
memory: 8G | |
shell: bash | |
environment_variables: LINK_JOBS JOBS MODE XMAKE_ARGS | |
run: | | |
sudo pkg install -y git cmake ninja gmake gtk3 dbus | |
git clone --recursive https://github.com/xmake-io/xmake.git | |
cd ./xmake | |
/usr/bin/make --version | |
./configure --make=/usr/bin/make | |
gmake | |
./scripts/get.sh __local__ __install_only__ | |
source ~/.xmake/profile | |
cd .. | |
xmake repo -u | |
xmake f -m ${{ env.MODE }} -yc ${{ env.XMAKE_ARGS }} | |
xmake -y --jobs=${{ env.JOBS }} --linkjobs=${{ env.LINK_JOBS }} ${{ env.XMAKE_ARGS }} | |
mv build/bsd build/freebsd | |
mv build/freebsd/x86_64 build/freebsd/x64 | |
- name: Build FreeBSD (arm64) | |
if: matrix.plat == 'freebsd' && matrix.arch == 'arm64' | |
uses: cross-platform-actions/[email protected] | |
with: | |
operating_system: freebsd | |
architecture: arm64 | |
version: '13.3' | |
memory: 8G | |
shell: bash | |
environment_variables: LINK_JOBS JOBS MODE XMAKE_ARGS | |
run: | | |
sudo pkg install -y git cmake ninja gmake gtk3 dbus | |
git clone --recursive https://github.com/xmake-io/xmake.git | |
cd ./xmake | |
/usr/bin/make --version | |
./configure --make=/usr/bin/make | |
gmake | |
./scripts/get.sh __local__ __install_only__ | |
source ~/.xmake/profile | |
cd .. | |
xmake repo -u | |
xmake f -m ${{ env.MODE }} -yc ${{ env.XMAKE_ARGS }} | |
xmake -y --jobs=${{ env.JOBS }} --linkjobs=${{ env.LINK_JOBS }} ${{ env.XMAKE_ARGS }} | |
mv build/bsd build/freebsd | |
- name: Fix MacOS Target Path (Stage 1) | |
if: ${{ matrix.plat == 'macos' }} | |
run: mv build/macosx build/macos | |
- name: Fix MacOS Target Path (Stage 2) | |
if: ${{ matrix.plat == 'macos' && matrix.arch == 'x64' }} | |
run: mv build/macos/x86_64 build/macos/x64 | |
- name: Fix Path | |
run: | | |
cd build/${{ matrix.plat }}/${{ matrix.arch }} | |
mv ${{ env.MODE }}/* . | |
cd ../../.. | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: build/ | |