Skip to content

Codecleanup type to kind #52

Codecleanup type to kind

Codecleanup type to kind #52

Workflow file for this run

name: CMake FreeBSD
on:
push:
branches:
- master
paths:
- '**.cpp'
- '**.h'
- '**CMakeLists.txt'
- .github/workflows/cmake-freeBSD.yml
pull_request:
branches:
- '**'
paths:
- '**.cpp'
- '**.h'
- '**CMakeLists.txt'
- .github/workflows/cmake-freeBSD.yml
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
TARGET_TRIPLE: x86_64-unknown-freebsd13.2
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: install cross-build dependencies
run: |
sudo apt install clang lld llvm-dev wget cmake ninja-build \
ca-certificates vim xz-utils libc++-dev libc++abi-dev
- name: setup sysroot
run: |
cd /tmp && wget http://ftp.plusline.de/FreeBSD/releases/amd64/13.2-RELEASE/base.txz \
&& mkdir -p /opt/cross-freebsd-13 \
&& cd /opt/cross-freebsd-13 \
&& tar -xf /tmp/base.txz ./lib/ ./usr/lib/ ./usr/include/ \
&& cd /opt/cross-freebsd-13/usr/lib \
&& find . -xtype l|xargs ls -l|grep ' /lib/' \
| awk '{print "ln -sf /opt/cross-freebsd-13"$11 " " $9}' \
| /bin/sh && \
rm -f /tmp/base.txz
- 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=Release \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_SYSTEM_NAME=FreeBSD -DCMAKE_CROSS_COMPILING=TRUE \
-DCMAKE_SYSROOT=/opt/cross-freebsd-13/ \
-DCMAKE_C_COMPILER_TARGET=$TARGET_TRIPLE \
-DCMAKE_CXX_COMPILER_TARGET=$TARGET_TRIPLE \
-DCMAKE_ASM_COMPILER_TARGET=$TARGET_TRIPLE \
-DDISABLE_LIBEDIT=true \
-DBuildTest=TRUE \
-DCMAKE_LINKER=lld \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-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: 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
cp build/test/${{ env.APPNAME }}Lang_TEST ${{github.workspace}}/artifacts
pushd ${{github.workspace}}
zip -r ${{ env.APPNAME }}-freebsd-x86_64.zip artifacts
popd
- name: 'Upload Pull Request Artifact'
uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/pull/') || startsWith(github.ref, 'refs/heads/master')
with:
name: ${{ env.APPNAME }}-freebsd-x86_64.zip
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
test:
needs: [build]
runs-on: macos-12
name: Fetch & Run Tests on FreeBSD
steps:
- uses: actions/download-artifact@v2
with:
name: Warf-freebsd-x86_64.zip
- name: Test in FreeBSD
id: test
uses: vmactions/freebsd-vm@v0
with:
usesh: true
prepare: |
pkg install -y unzip
run: |
unzip Warf-freebsd-x86_64.zip
./artifacts/WarfLang_TEST