Skip to content

.github/workflows/build-native.yml #30

.github/workflows/build-native.yml

.github/workflows/build-native.yml #30

Workflow file for this run

---
on:
workflow_dispatch:
push:
paths-ignore:
- 'cloud/**'
- 'doc/**'
- 'fuzzer/**'
- 'ide/**'
- 'kobo/**'
- 'python/**'
- '.github/workflows/build-container.yml'
- '.github/workflows/build-unix.yml'
- '.readthedocs.yaml'
branches:
- master
pull_request:
paths-ignore:
- 'cloud/**'
- 'doc/**'
- 'fuzzer/**'
- 'ide/**'
- 'kobo/**'
- 'python/**'
- '.github/workflows/build-container.yml'
- '.github/workflows/build-unix.yml'
- '.readthedocs.yaml'
branches:
- master
env:
DEBUG: y
BOOST: boost_1_85_0
jobs:
build-ubuntu:
runs-on: ubuntu-22.04
env:
TARGET: UNIX
TARGET_BIN: xcsoar
TARGET_FINAL: xcsoar-debug
TARGET_EXT: ''
steps:
- name: set vars for push
if: github.event_name == 'push'
run: |
echo "DEBUG=n" >> $GITHUB_ENV
echo "TARGET_FINAL=xcsoar" >> $GITHUB_ENV
- id: checkout
uses: actions/checkout@v4
with:
submodules: true
- id: cache-ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ env.TARGET }}
- name: "Cache Boost"
uses: actions/cache@v4
with:
key: ${{ env.BOOST }}-${{ hashFiles('lib/boost/patches/**') }}
path: |
${{ github.workspace }}/output/download/${{ env.BOOST }}.tar.bz2
${{ github.workspace }}/output/src/stamp-${{ env.BOOST }}
${{ github.workspace }}/output/src/${{ env.BOOST }}/boost
- name: find githash
run: |
echo "git_hash=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
make \
quilt \
g++ \
python3 \
librsvg2-bin xsltproc \
imagemagick gettext sox \
zlib1g-dev \
libfmt-dev \
libdbus-1-dev \
libsodium-dev \
libfreetype6-dev \
libpng-dev libjpeg-dev \
libtiff5-dev libgeotiff-dev \
libc-ares-dev \
libcurl4-gnutls-dev \
libc-ares-dev \
liblua5.4-dev \
libxml-parser-perl \
libasound2-dev \
libgles2-mesa-dev libegl1-mesa-dev \
libnetcdf-dev libnetcdf-c++4-dev
- name: Compile XCSoar
run: |
make -j$(nproc) TARGET=${{env.TARGET }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything check
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.TARGET_FINAL }}-${{ env.git_hash }}${{ env.TARGET_EXT }}
path: output/${{ env.TARGET }}/bin/${{ env.TARGET_BIN }}${{ env.TARGET_EXT }}
- name: Deploy to Staging server
if: |
github.repository == 'XCSoar/XCSoar' &&
github.ref == 'ref/head/master' &&
github.event == 'push'
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.REPOSITORY_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: output/${{ env.TARGET }}/bin/${{ env.TARGET_BIN }}.${{ env.TARGET_EXT }}
REMOTE_HOST: ${{ secrets.REPOSITORY_HOST }}
REMOTE_USER: ${{ secrets.REPOSITORY_SSH_USER }}
TARGET: ${{ secrets.REPOSITORY_REMOTE_PATH }}/testing/${{ env.TARGET }}/
build-sanitizer:
# Build with AddressSanitizer and all libstdc++ debugging features
# enabled.
runs-on: ubuntu-22.04
env:
TARGET: UNIX
steps:
- id: checkout
uses: actions/checkout@v4
with:
submodules: true
- id: cache-ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ env.TARGET }}-sanitizer
- name: find githash
run: |
echo "git_hash=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV
- name: "Cache Boost"
uses: actions/cache@v4
with:
key: ${{ env.BOOST }}-${{ hashFiles('lib/boost/patches/**') }}
path: |
${{ github.workspace }}/output/download/${{ env.BOOST }}.tar.bz2
${{ github.workspace }}/output/src/stamp-${{ env.BOOST }}
${{ github.workspace }}/output/src/${{ env.BOOST }}/boost
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
make \
quilt \
g++ \
python3 \
librsvg2-bin xsltproc \
imagemagick gettext sox \
zlib1g-dev \
libfmt-dev \
libdbus-1-dev \
libsodium-dev \
libfreetype6-dev \
libpng-dev libjpeg-dev \
libtiff5-dev libgeotiff-dev \
libc-ares-dev \
libcurl4-gnutls-dev \
libc-ares-dev \
liblua5.4-dev \
libxml-parser-perl \
libasound2-dev \
libnetcdf-dev libnetcdf-c++4-dev
- name: workaround random bits value in github actions
run: sudo sysctl --write vm.mmap_rnd_bits=28
- name: Compile XCSoar
run: |
make -j$(nproc) TARGET=${{env.TARGET }} DEBUG=${{ env.DEBUG }} VFB=y SANITIZE=y DEBUG_GLIBCXX=y USE_CCACHE=y V=2 everything check
build-kobo:
runs-on: ubuntu-22.04
env:
TARGET: KOBO
TARGET_BIN: KoboRoot
TARGET_FINAL: KoboRoot
TARGET_EXT: tgz
steps:
- name: set vars for push
if: github.event_name == 'push'
run: |
echo "DEBUG=n" >> $GITHUB_ENV
- id: checkout
uses: actions/checkout@v4
with:
submodules: true
- id: cache-ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ env.TARGET }}
- name: "Cache Boost"
uses: actions/cache@v4
with:
key: ${{ env.BOOST }}-${{ hashFiles('lib/boost/patches/**') }}
path: |
${{ github.workspace }}/output/download/${{ env.BOOST }}.tar.bz2
${{ github.workspace }}/output/src/stamp-${{ env.BOOST }}
${{ github.workspace }}/output/src/${{ env.BOOST }}/boost
- name: "Cache third-party libraries"
uses: actions/cache@v4
with:
key: ${{ runner.os }}-libs-${{ env.TARGET }}-${{ hashFiles('build/**') }}
path: |
${{ github.workspace }}/output/${{ env.TARGET }}/lib
!${{ github.workspace }}/output/${{ env.TARGET }}/lib/build
- name: find githash
run: |
echo "git_hash=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV
- name: Install dependencies
# texinfo appears to be necessary for building binutils, but
# that seems to be a binutils 2.38 bug.
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
make \
quilt \
g++ \
libmpc-dev \
texinfo \
librsvg2-bin xsltproc \
imagemagick gettext sox \
cmake meson ninja-build \
ttf-bitstream-vera \
libnetcdf-dev libnetcdf-c++4-dev
- name: Compile XCSoar
run: |
make -j$(nproc) \
TARGET=${{env.TARGET}} \
DEBUG=${{env.DEBUG}} \
USE_CCACHE=y \
V=2 \
output/${{env.TARGET}}/${{ env.TARGET_BIN }}.${{ env.TARGET_EXT }}
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.TARGET_FINAL }}-${{ env.git_hash }}.${{ env.TARGET_EXT }}
path: output/${{env.TARGET}}/${{ env.TARGET_BIN }}.${{ env.TARGET_EXT }}
- name: Deploy to Staging server
if: |
github.repository == 'XCSoar/XCSoar' &&
github.ref == 'ref/head/master' &&
github.event == 'push'
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.REPOSITORY_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: output/${{ env.TARGET }}/bin/${{ env.TARGET_BIN }}.${{ env.TARGET_EXT }}
REMOTE_HOST: ${{ secrets.REPOSITORY_HOST }}
REMOTE_USER: ${{ secrets.REPOSITORY_SSH_USER }}
TARGET: ${{ secrets.REPOSITORY_REMOTE_PATH }}/testing/${{ env.TARGET }}/
build-android:
runs-on: ubuntu-22.04
env:
DEBUG: n
TARGET: ANDROIDFAT
TARGET_BIN: XCSoar
TARGET_FINAL: XCSoar
TARGET_EXT: apk
NDK: r26d
steps:
- id: checkout
uses: actions/checkout@v4
with:
submodules: true
- id: cache-ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ env.TARGET }}
- name: "Cache Boost"
uses: actions/cache@v4
with:
key: ${{ env.BOOST }}-${{ hashFiles('lib/boost/patches/**') }}
path: |
${{ github.workspace }}/output/download/${{ env.BOOST }}.tar.bz2
${{ github.workspace }}/output/src/stamp-${{ env.BOOST }}
${{ github.workspace }}/output/src/${{ env.BOOST }}/boost
- name: "Cache third-party libraries"
uses: actions/cache@v4
with:
key: ${{ runner.os }}-libs-${{ env.TARGET }}-${{ hashFiles('build/**') }}
path: |
${{ github.workspace }}/output/ANDROID/*/lib
!${{ github.workspace }}/output/ANDROID/*/lib/build
- name: find githash
run: |
echo "git_hash=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
make \
quilt \
g++ \
librsvg2-bin xsltproc \
imagemagick gettext sox \
vorbis-tools \
cmake ninja-build
- name: Install Android NDK
# We need NDK r26, but the GitHub runner has only r25
run: |
mkdir -p output/download
cd output/download
wget --quiet https://dl.google.com/android/repository/android-ndk-${{env.NDK}}-linux.zip
unzip -q android-ndk-${{env.NDK}}-linux.zip
rm android-ndk-${{env.NDK}}-linux.zip
echo ANDROID_NDK_LATEST_HOME=$PWD/android-ndk-${{env.NDK}} >> $GITHUB_ENV
- name: Prepare signing key
shell: bash
run: |
echo "${{ secrets.XCSOAR_JET_UPLOAD_KEY_JKS_BASE64 }}" | base64 -d > signing-key.jks
md5sum signing-key.jks
- name: Compile XCSoar
run: |
ANDROID_KEYSTORE_PASS=${{ secrets.XCSOAR_JET_UPLOAD_KEY_JKS_PASSWORD }} \
make -j$(nproc) \
TARGET=${{env.TARGET}} \
ANDROID_NDK=${ANDROID_NDK_LATEST_HOME} \
ANDROID_SDK=${ANDROID_HOME} \
DEBUG=${{env.DEBUG}} \
USE_CCACHE=y \
V=2 \
ANDROID_KEYSTORE=signing-key.jks \
ANDROID_KEY_ALIAS=${{ secrets.XCSOAR_JET_UPLOAD_KEY_JKS_KEY_ALIAS }} \
output/ANDROID/bin/${{ env.TARGET_BIN }}.${{ env.TARGET_EXT }}
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.TARGET_FINAL }}-${{ env.git_hash }}.${{ env.TARGET_EXT }}
path: output/ANDROID/bin/${{ env.TARGET_BIN }}.${{ env.TARGET_EXT }}
- name: Deploy to Staging server
if: |
github.repository == 'XCSoar/XCSoar' &&
github.ref == 'ref/head/master' &&
github.event == 'push'
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.REPOSITORY_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: output/${{ env.TARGET }}/bin/${{ env.TARGET_BIN }}.${{ env.TARGET_EXT }}
REMOTE_HOST: ${{ secrets.REPOSITORY_HOST }}
REMOTE_USER: ${{ secrets.REPOSITORY_SSH_USER }}
TARGET: ${{ secrets.REPOSITORY_REMOTE_PATH }}/testing/${{ env.TARGET }}/
build-windows:
runs-on: ubuntu-22.04
container:
image: debian:bookworm-slim
env:
TARGET: WIN64
TARGET_BIN: XCSoar
TARGET_FINAL: XCSoar-debug
TARGET_EXT: .exe
steps:
- name: set vars for push
if: github.event_name == 'push'
run: |
echo "DEBUG=n" >> $GITHUB_ENV
echo "TARGET_FINAL=XCSoar" >> $GITHUB_ENV
- name: Install build dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends \
git \
quilt \
make \
g++ \
g++-mingw-w64 \
ccache \
xz-utils \
pkgconf \
ca-certificates \
python3 \
librsvg2-bin xsltproc \
imagemagick gettext sox \
cmake ninja-build
- id: checkout
uses: actions/checkout@v4
with:
submodules: true
- id: cache-ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ env.TARGET }}
- name: "Cache Boost"
uses: actions/cache@v3
with:
key: ${{ env.BOOST }}-${{ hashFiles('lib/boost/patches/**') }}
path: |
${{ github.workspace }}/output/download/${{ env.BOOST }}.tar.bz2
${{ github.workspace }}/output/src/stamp-${{ env.BOOST }}
${{ github.workspace }}/output/src/${{ env.BOOST }}/boost
- name: "Cache third-party libraries"
uses: actions/cache@v4
with:
key: ${{ runner.os }}-libs-${{ env.TARGET }}-${{ hashFiles('build/**') }}
path: |
${{ github.workspace }}/output/${{ env.TARGET }}/lib
!${{ github.workspace }}/output/${{ env.TARGET }}/lib/build
- name: find githash
run: |
echo "git_hash=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV
- name: Patch mingw intrin.h (mingw64 v8 bug workaround)
run: sed -i -e '/extern.* __builtin/d' /usr/share/mingw-w64/include/intrin.h
- name: Compile XCSoar
run: |
make -j$(nproc) TARGET=${{env.TARGET }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.TARGET_FINAL }}-${{ env.git_hash }}${{ env.TARGET_EXT }}
path: output/${{ env.TARGET }}/bin/${{ env.TARGET_BIN }}${{ env.TARGET_EXT }}
- name: store checks and compile artefacts
uses: actions/upload-artifact@v4
with:
name: xcsoar-${{ env.TARGET }}-artifact
path: |
${{ github.workspace }}/output/${{ env.TARGET }}
!${{ github.workspace }}/output/${{ env.TARGET }}/lib/build
!**.d
retention-days: 1
- name: Deploy to Staging server
if: |
github.repository == 'XCSoar/XCSoar' &&
github.ref == 'ref/head/master' &&
github.event == 'push'
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.REPOSITORY_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: output/${{ env.TARGET }}/bin/${{ env.TARGET_BIN }}.${{ env.TARGET_EXT }}
REMOTE_HOST: ${{ secrets.REPOSITORY_HOST }}
REMOTE_USER: ${{ secrets.REPOSITORY_SSH_USER }}
TARGET: ${{ secrets.REPOSITORY_REMOTE_PATH }}/testing/${{ env.TARGET }}/
test-windows:
runs-on: windows-latest
env:
TARGET: WIN64
needs: build-windows
steps:
- id: checkout
uses: actions/checkout@v4
- name: fetch artifacts
uses: actions/download-artifact@v4
with:
name: xcsoar-${{ env.TARGET }}-artifact
path: ${{ github.workspace }}/output/${{ env.TARGET }}
- name: XCSoar run checks on ${{ env.TARGET }}
run: make check-no-build
working-directory: ${{ github.workspace }}
build-macos:
runs-on: macos-12
env:
TARGET: OSX64
steps:
- id: checkout
uses: actions/checkout@v4
with:
submodules: true
- id: cache-ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: macos
- name: "Cache Boost"
uses: actions/cache@v3
with:
key: ${{ env.BOOST }}-${{ hashFiles('lib/boost/patches/**') }}
path: |
${{ github.workspace }}/output/download/${{ env.BOOST }}.tar.bz2
${{ github.workspace }}/output/src/stamp-${{ env.BOOST }}
${{ github.workspace }}/output/src/${{ env.BOOST }}/boost
- name: Install dependencies
run: |
brew install \
make \
quilt \
librsvg \
imagemagick gettext sox \
fmt \
sdl2 \
libsodium \
freetype \
libpng libjpeg-turbo \
libtiff libgeotiff proj \
c-ares \
curl \
lua \
netcdf-cxx \
libgeotiff
- name: Compile XCSoar
# We use "-O0" instead of the default "-Og" to work around a
# LLVM bug in Apple Xcode which crashes clang with "fatal
# error: error in backend: Cannot select: intrinsic
# %llvm.coro.size"
run: |
gmake -j$(sysctl -n hw.logicalcpu) TARGET=${{env.TARGET }} USE_CCACHE=y \
OPTIMIZE="-O0" \
USE_HOMEBREW=y \
V=2 \
everything check
- name: Deploy to Staging server
if: |
github.repository == 'XCSoar/XCSoar' &&
github.ref == 'ref/head/master' &&
github.event == 'push'
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.REPOSITORY_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: output/${{ env.TARGET }}/bin/${{ env.TARGET_BIN }}.${{ env.TARGET_EXT }}
REMOTE_HOST: ${{ secrets.REPOSITORY_HOST }}
REMOTE_USER: ${{ secrets.REPOSITORY_SSH_USER }}
TARGET: ${{ secrets.REPOSITORY_REMOTE_PATH }}/testing/${{ env.TARGET }}/
build-ios:
runs-on: macos-12
env:
TARGET: IOS64
steps:
- id: checkout
uses: actions/checkout@v4
with:
submodules: true
- name: "Cache third-party libraries"
uses: actions/cache@v4
with:
key: ${{ runner.os }}-libs-${{ env.TARGET }}-${{ hashFiles('build/**') }}
path: |
${{ github.workspace }}/output/${{ env.TARGET }}/lib
!${{ github.workspace }}/output/${{ env.TARGET }}/lib/build
- id: cache-ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ios
- name: "Cache Boost"
uses: actions/cache@v3
with:
key: ${{ env.BOOST }}-${{ hashFiles('lib/boost/patches/**') }}
path: |
${{ github.workspace }}/output/download/${{ env.BOOST }}.tar.bz2
${{ github.workspace }}/output/src/stamp-${{ env.BOOST }}
${{ github.workspace }}/output/src/${{ env.BOOST }}/boost
- name: Install dependencies
run: |
brew install \
automake autoconf libtool \
make \
quilt \
librsvg \
imagemagick gettext sox \
cmake ninja
- name: Compile XCSoar
# TODO: remove the "||true" as soon as the remaining SDL2
# linker failure ("Undefined symbols: _SDL_IsIPad, _main") is
# fixed.
run: |
gmake -j$(sysctl -n hw.logicalcpu) TARGET=${{env.TARGET }} USE_CCACHE=y \
OPTIMIZE="-O0" \
V=2 ||true
- name: Deploy to Staging server
if: |
github.repository == 'XCSoar/XCSoar' &&
github.ref == 'ref/head/master' &&
github.event == 'push'
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.REPOSITORY_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: output/${{ env.TARGET }}/bin/${{ env.TARGET_BIN }}.${{ env.TARGET_EXT }}
REMOTE_HOST: ${{ secrets.REPOSITORY_HOST }}
REMOTE_USER: ${{ secrets.REPOSITORY_SSH_USER }}
TARGET: ${{ secrets.REPOSITORY_REMOTE_PATH }}/testing/${{ env.TARGET }}/