Skip to content

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

.github/workflows/build-native.yml

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

Workflow file for this run

---
on:
workflow_dispatch:
env:
DEBUG: y
BOOST: boost_1_85_0
jobs:
release:
name: "Create Release"
runs-on: ubuntu-22.04
permissions:
contents: write
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Parse changelog
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG=$(echo "${{ github.ref }}" | cut -f3 -d '/')
echo "TAG=$TAG" >> $GITHUB_ENV
echo "::set-output name=TAG::$TAG"
echo 'CHANGELOGENTRY<<EOF' >> $GITHUB_ENV
./tools/changelog.sh "$TAG" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
case "$TAG" in
*-rc*)
echo "PRERELEASE=true" >> $GITHUB_ENV
;;
*)
echo "PRERELEASE=false" >> $GITHUB_ENV
;;
esac
id: changelogentry
- name: get XCSoar Version
id: get_version
run: |
VERSION=$(cat VERSION.txt)
echo "$VERSION"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "::set-output name=VERSION::${VERSION}"
- name: Create release
id: create_release
if: startsWith(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
allowUpdates: true
name: Version ${{ github.ref_name }}
body: ${{ env.CHANGELOGENTRY }}
prerelease: ${{ env.PRERELEASE }}
build:
runs-on: ${{ matrix.os }}
needs: release
container: ${{ matrix.target_container }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
target: UNIX
target_bin: xcsoar_${{ needs.release.outputs.version }}_amd64
target_bin_path: ''
target_final: xcsoar_
target_ext: .deb
target_upload: true
target_container: debian:bookworm-slim
- os: ubuntu-22.04
target: ANDROID
target_bin: XCSoar
target_bin_path: bin
target_final: XCSoar
target_ext: .apk
target_upload: true
ndk: r26d
target_container: debian:bookworm-slim
steps:
- name: Install checkout dependencies
run: |
if [ "${{ matrix.os }}" = 'ubuntu-22.04' ]; then
apt-get update
apt-get install -y --no-install-recommends git \
ca-certificates rsync openssh-client
fi
- name: Set vars for release
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "DEBUG=y" >> $GITHUB_ENV
if [ ${{ matrix.target }} = "xcsoar" ]; then
echo "TARGET_FINAL=xcsoar" >> $GITHUB_ENV
fi
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Cache ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.target }}-ccache
- 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: |
if [ ${{ matrix.os }} = 'ubuntu-22.04' ]; then
./ide/provisioning/install-debian-packages.sh UPDATE
./ide/provisioning/install-debian-packages.sh BASE
if [ ${{ matrix.target }} = 'UNIX' ]; then
./ide/provisioning/install-debian-packages.sh LINUX
./ide/provisioning/install-debian-packages.sh LIBINPUT_GBM
./ide/provisioning/install-debian-packages.sh DEBIAN
./ide/provisioning/install-debian-packages.sh JET
fi
if [ ${{ matrix.target }} = 'KOBO' ]; then
./ide/provisioning/install-debian-packages.sh LINUX
./ide/provisioning/install-debian-packages.sh ARM
./ide/provisioning/install-debian-packages.sh KOBO
fi
if [ ${{ matrix.target }} = 'WIN64' ]; then
./ide/provisioning/install-debian-packages.sh LINUX
./ide/provisioning/install-debian-packages.sh WIN
fi
if [ ${{ matrix.target }} = 'PC' ]; then
./ide/provisioning/install-debian-packages.sh LINUX
./ide/provisioning/install-debian-packages.sh WIN
fi
if [ ${{ matrix.target }} = 'ANDROID' ]; then
./ide/provisioning/install-debian-packages.sh LINUX
./ide/provisioning/install-debian-packages.sh ARM
./ide/provisioning/install-debian-packages.sh LLVM
./ide/provisioning/install-debian-packages.sh ANDROID
./ide/provisioning/install-android-tools.sh NDK
./ide/provisioning/install-android-tools.sh SDK
./ide/provisioning/install-android-tools.sh JET
fi
./ide/provisioning/install-debian-packages.sh CLEAN
elif [ ${{ matrix.os }} = 'macos-12' ]; then
brew install \
make \
quilt \
librsvg \
imagemagick gettext sox \
fmt \
sdl2 \
libsodium \
freetype \
libpng libjpeg-turbo \
libtiff libgeotiff proj \
c-ares \
curl \
lua
fi
echo "git_hash=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV
- name: Prepare signing key
shell: bash
if: ${{ matrix.target == 'ANDROID' && startsWith(github.ref, 'refs/tags/v') }}
run: |
if [ -n "${{ secrets.XCSOAR_UPLOAD_KEY_JKS_BASE64 }}" ]; then
mkdir -p ~/.android/
echo "${{ secrets.XCSOAR_UPLOAD_KEY_JKS_BASE64 }}" | base64 -d > ~/.android/signing-key.jks
md5sum ~/.android/signing-key.jks
fi
- name: Compile XCSoar - PR
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |
if [ ${{ matrix.target }} = 'ANDROID' ]; then
make -j$(nproc) TARGET=ANDROID DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 \
output/ANDROID/bin/${{ matrix.target_bin }}-debug${{ matrix.target_ext }}
elif [ ${{ matrix.target }} = "WIN64" ]; then
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything
elif [ ${{ matrix.target }} = "KOBO" ]; then
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 output/${{ matrix.target }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
elif [ ${{ matrix.target }} = "OSX64" ]; then
gmake -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 OPTIMIZE="-O0"
fi
- name: Compile XCSoar - Sanitizer Check
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |
if [ ${{ matrix.target }} = "UNIX" ]; then
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything check VFB=y SANITIZE=y DEBUG_GLIBCXX=y
fi
- name: Compile XCSoar - Release
if: startsWith(github.ref, 'refs/tags/v')
run: |
if [ ${{ matrix.target }} = 'ANDROID' ]; then
if [ -n "${{ secrets.XCSOAR_UPLOAD_KEY_JKS_PASSWORD }}" ] && [ -n "${{ secrets.XCSOAR_UPLOAD_KEY_JKS_KEY_ALIAS }}" ]; then
ANDROID_KEYSTORE_PASS=${{ secrets.XCSOAR_UPLOAD_KEY_JKS_PASSWORD }} \
make -j$(nproc) TARGET=ANDROIDFAT DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 \
output/ANDROID/bin/${{ matrix.target_bin }}${{ matrix.target_ext }} \
ANDROID_KEYSTORE=~/.android/signing-key.jks ANDROID_KEY_ALIAS=${{ secrets.XCSOAR_UPLOAD_KEY_JKS_KEY_ALIAS }}
else
make -j$(nproc) TARGET=ANDROIDFAT DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 \
output/ANDROID/bin/${{ matrix.target_bin }}${{ matrix.target_ext }}
fi
elif [ ${{ matrix.target }} = "WIN64" ]; then
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything
elif [ ${{ matrix.target }} = "PC" ]; then
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything
elif [ ${{ matrix.target }} = "KOBO" ]; then
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 output/${{ matrix.target }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
elif [ ${{ matrix.target }} = "OSX64" ]; then
gmake -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 OPTIMIZE="-O0"
fi
- name: Create UNIX dpkg
if: ${{ matrix.target == 'UNIX' && startsWith(github.ref, 'refs/tags/v') }}
run: |
mkdir -p output/UNIX/DPKG
rsync -apt . output/UNIX/DPKG --exclude=output/UNIX/DPKG
cd output/UNIX/DPKG
dpkg-buildpackage --jobs-force=$(nproc) --no-sign
cp *.dpkg ../
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target_final }}-${{ env.git_hash }}${{ matrix.target }}${{ matrix.target_ext }}
path: output/${{ matrix.target }}/${{ matrix.target_bin_path }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
if: ${{ startsWith(github.ref, 'refs/tags/v') && matrix.target_upload == true && needs.release.outputs.upload_url != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: output/${{ matrix.target }}/${{ matrix.target_bin_path }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
asset_name: ${{ matrix.target_final }}-${{ matrix.target }}${{ matrix.target_ext }}
asset_content_type: application/zip
- name: Deploy to Download server - testing
if: ${{ github.repository == 'XCSoar/XCSoar' && github.ref == 'refs/heads/master' }}
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.REPOSITORY_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: output/${{ matrix.target }}/${{ matrix.target_bin_path }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
REMOTE_HOST: ${{ secrets.REPOSITORY_HOST }}
REMOTE_USER: ${{ secrets.REPOSITORY_SSH_USER }}
TARGET: ${{ secrets.REPOSITORY_REMOTE_PATH }}/testing/${{ matrix.target }}/
- name: Deploy to Download server - release
if: ${{ github.repository == 'XCSoar/XCSoar' && startsWith(github.ref, 'refs/tags/v') && matrix.target_upload == true }}
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.REPOSITORY_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: output/${{ matrix.target }}/${{ matrix.target_bin_path }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
REMOTE_HOST: ${{ secrets.REPOSITORY_HOST }}
REMOTE_USER: ${{ secrets.REPOSITORY_SSH_USER }}
TARGET: ${{ secrets.REPOSITORY_REMOTE_PATH }}/releases/${{ needs.release.outputs.version }}/${{ matrix.target }}/