Skip to content

Codecleanup type to kind #90

Codecleanup type to kind

Codecleanup type to kind #90

Workflow file for this run

name: CMake Aarch64
on:
push:
branches:
- master
paths:
- '**.cpp'
- '**.h'
- '**CMakeLists.txt'
- .github/workflows/cmake-aarch64.yml
pull_request:
branches:
- '**'
paths:
- '**.cpp'
- '**.h'
- '**CMakeLists.txt'
- .github/workflows/cmake-arch64.yml
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
TARGET_TRIPLE: aarch64-unknown-linux-gnu
GCC_VERS: 12
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: install cross-build dependencies
run: |
sudo apt-get update
sudo apt install cmake ninja-build llvm-dev clang lld libc++-dev \
libc++abi-dev zlib1g-dev git build-essential \
ca-certificates crossbuild-essential-arm64 \
libstdc++-$GCC_VERS-dev-arm64-cross qemu-user wget rsync curl
- name: setup sysroot
run: |
cd ${{github.workspace}} \
&& mkdir -p sysroots/aarch64-linux-gnu/usr \
&& cd sysroots/aarch64-linux-gnu/usr \
&& cp -r -v -L /usr/aarch64-linux-gnu/include /usr/aarch64-linux-gnu/lib . \
&& cd lib \
&& cp -r -v -L /usr/lib/gcc-cross/aarch64-linux-gnu/$GCC_VERS/*gcc* . \
&& cp -r -v -L /usr/lib/gcc-cross/aarch64-linux-gnu/$GCC_VERS/*crt* . \
&& cp -r -v -L /usr/lib/gcc-cross/aarch64-linux-gnu/$GCC_VERS/libsupc++.a . \
&& cp -r -v -L /usr/lib/gcc-cross/aarch64-linux-gnu/$GCC_VERS/libstdc++* . \
&& cd ../../ \
&& mkdir tmp \
&& cd tmp \
&& export LIBEDIT_URL="http://ports.ubuntu.com/ubuntu-ports/pool/main/libe/libedit/" \
&& curl $LIBEDIT_URL 2>&1 | grep -oh "\"libedit-dev_3.1-2022.*arm64.deb\"" | sort -nr | head -n1 | xargs -I% wget $LIBEDIT_URL/% \
&& dpkg-deb -R libedit-dev*arm64.deb . \
&& rm -rf usr/share libedit-dev*arm64.deb DEBIAN \
&& export LIBBSD_URL=http://ports.ubuntu.com/ubuntu-ports/pool/main/libb/libbsd/ \
&& curl $LIBBSD_URL 2>&1 | grep -oh "\"libbsd-dev.*arm64.deb\"" | sort -nr | head -n1 | xargs -I% wget $LIBBSD_URL/% \
&& dpkg-deb -R libbsd-dev*arm64.deb . \
&& rm -rf usr/share libbsd-dev*arm64.deb DEBIAN \
&& export LIBTINFO_URL="http://ports.ubuntu.com/ubuntu-ports/pool/main/n/ncurses/" \
&& curl $LIBTINFO_URL 2>&1 | grep -oh "\"libncurses-dev.*arm64.deb\"" | sort -nr | head -n1 | xargs -I% wget $LIBTINFO_URL/% \
&& dpkg-deb -R libncurses-dev*arm64.deb . \
&& rm -rf usr/share libncurses-dev*arm64.deb DEBIAN \
&& rsync -av usr ../ \
&& cd .. \
&& rm -rf tmp \
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
run: |
cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build \
-GNinja -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_ASM_COMPILER=clang \
-DCMAKE_INSTALL_PREFIX=/ \
-DBuildTest=TRUE \
-DCMAKE_SYSROOT=$GITHUB_WORKSPACE/sysroots/aarch64-linux-gnu \
-DCMAKE_C_COMPILER_TARGET=$TARGET_TRIPLE \
-DCMAKE_CXX_COMPILER_TARGET=$TARGET_TRIPLE \
-DCMAKE_ASM_COMPILER_TARGET=$TARGET_TRIPLE \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld"
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE
- name: Set variables
run: |
APP=$(cat $GITHUB_WORKSPACE/src/lib/Version/appName.txt)
VER=$(cat $GITHUB_WORKSPACE/src/lib/Version/version.txt)
echo "VERSION=$VER" >> $GITHUB_ENV
echo "APPNAME=$APP" >> $GITHUB_ENV
- name: Test aarch64 via qemu
working-directory: ${{github.workspace}}
run: qemu-aarch64 -L sysroots/aarch64-linux-gnu/usr/ build/test/${{ env.APPNAME }}Lang_TEST
- name: Prepare Binaries for upload
shell: bash
run: |
mkdir ${{github.workspace}}/artifacts
cp build/src/lib/lib${{ env.APPNAME }}Core.a ${{github.workspace}}/artifacts
cp build/src/cli/${{ env.APPNAME }} ${{github.workspace}}/artifacts
pushd ${{github.workspace}}
zip -r ${{ env.APPNAME }}-$(uname -s)-arm64.zip artifacts
popd
- name: 'Upload Pull Request Artifact'
uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/pull/')
with:
name: ${{ env.APPNAME }} Pull Request Artifacts
path: ${{ env.APPNAME }}-*.zip
retention-days: 5
- name: Upload binaries to Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/heads/master')
with:
tag_name: ${{ env.APPNAME }}-${{ env.VERSION }}
files: |
${{ env.APPNAME }}-*.zip