Skip to content

Codecleanup type to kind #66

Codecleanup type to kind

Codecleanup type to kind #66

Workflow file for this run

name: CMake osxcross Cross-Compile & Darling Test
on:
push:
branches:
- master
paths:
- '**.cpp'
- '**.h'
- '**CMakeLists.txt'
- .github/workflows/cmake-osxcross.yml
pull_request:
branches:
- '**'
paths:
- '**.cpp'
- '**.h'
- '**CMakeLists.txt'
- .github/workflows/cmake-osxcross.yml
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: Install Warf dependencies
run: |
sudo apt install cmake ninja-build
- name: Install Darling dependencies
run: |
sudo apt install libavcodec58 libavformat58 \
libavutil56 libcairo2 libdbus-1-3 libegl1 libgif7 \
libgl1 libglu1-mesa libglu1 libpulse0 libswresample3 \
libxcursor1 libxkbfile1 libxrandr2 libfuse2
- name: Create Packages Environment
working-directory: ${{github.workspace}}
run: |
mkdir packages
- name: Fetch OSXCross
working-directory: ${{github.workspace}}
shell: bash
run: ./scripts/osxcrossFetch.sh
- name: Install OSXCross dependnecies
working-directory: ${{github.workspace}}/packages/osxcross/tools
run: sudo ./get_dependencies.sh
- name: Cache C++ dependencies in Packages Directory
uses: actions/cache@v3
with:
path: |
packages
key: ${{ runner.OS }}-c++-packages-cache-OSXCross-Release-${{ hashFiles('depsCache.json') }}
restore-keys: |
${{ runner.OS }}-c++-packages-cache-OSXCross-Release
- name: Fetch MacOS 11.3 SDK
working-directory: ${{github.workspace}}
shell: bash
run: ./scripts/macos-sdkFetch.sh
- name: Build OSXCross
working-directory: ${{github.workspace}}
shell: bash
run: ./scripts/build-osxcross.sh
- name: Download Darling
working-directory: ${{github.workspace}}
shell: bash
run: ./scripts/downloadDarling.sh
- name: Install Darling
working-directory: ${{github.workspace}}/packages
run: |
sudo dpkg -i darling_0.1.20220704.focal_amd64.deb
- 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: Build Warf Cmake x64
working-directory: ${{github.workspace}}
run: |
export PATH=$PATH:${{github.workspace}}/packages/osxcross/target/bin
export LD_LIBRARY_PATH=${{github.workspace}}/packages/osxcross/target/lib:$LD_LIBRARY_PATH
cmake -S . -B build/x64 \
-GNinja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=o64-clang \
-DCMAKE_CXX_COMPILER=o64-clang++ \
-DBuildTest=TRUE \
-DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_CROSS_COMPILING=TRUE \
-DCMAKE_LINKER=x86_64-apple-darwin20.4-ld \
-DCMAKE_C_COMPILER_AR=x86_64-apple-darwin20.4-ar \
-DCMAKE_CXX_COMPILER_AR=x86_64-apple-darwin20.4-ar
- name: Build Warf with Ninja x64
working-directory: ${{github.workspace}}
run: |
export PATH=$PATH:${{github.workspace}}/packages/osxcross/target/bin
export LD_LIBRARY_PATH=${{github.workspace}}/packages/osxcross/target/lib:$LD_LIBRARY_PATH
ninja -C./build/x64
- name: Test Warf x64 with Darling
working-directory: ${{github.workspace}}
run: |
darling shell build/x64/test/WarfLang_TEST
- name: Build Warf Cmake aarch64
working-directory: ${{github.workspace}}
run: |
export PATH=$PATH:${{github.workspace}}/packages/osxcross/target/bin
export LD_LIBRARY_PATH=${{github.workspace}}/packages/osxcross/target/lib:$LD_LIBRARY_PATH
cmake -S . -B build/aarch64 \
-GNinja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=oa64-clang \
-DCMAKE_CXX_COMPILER=oa64-clang++ \
-DBuildTest=TRUE \
-DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_CROSS_COMPILING=TRUE \
-DCMAKE_LINKER=aarch64-apple-darwin20.4-ld \
-DCMAKE_C_COMPILER_AR=aarch64-apple-darwin20.4-ar \
-DCMAKE_CXX_COMPILER_AR=aarch64-apple-darwin20.4-ar
- name: Build Warf with Ninja aarch64
working-directory: ${{github.workspace}}
run: |
export PATH=$PATH:${{github.workspace}}/packages/osxcross/target/bin
export LD_LIBRARY_PATH=${{github.workspace}}/packages/osxcross/target/lib:$LD_LIBRARY_PATH
ninja -C./build/aarch64
- name: Prepare x64 Binaries for upload
shell: bash
run: |
mkdir ${{github.workspace}}/artifactsX64
cp build/x64/src/lib/lib${{ env.APPNAME }}Core.a ${{github.workspace}}/artifactsX64
cp build/x64/src/cli/${{ env.APPNAME }} ${{github.workspace}}/artifactsX64
cp build/x64/test/${{ env.APPNAME }}Lang_TEST ${{github.workspace}}/artifactsX64
pushd ${{github.workspace}}
zip -r ${{ env.APPNAME }}-MacOS-osxcross-x64.zip artifactsX64
popd
- name: Prepare aarch64 Binaries for upload
shell: bash
run: |
mkdir ${{github.workspace}}/artifactsArm64
cp build/aarch64/src/lib/lib${{ env.APPNAME }}Core.a ${{github.workspace}}/artifactsArm64
cp build/aarch64/src/cli/${{ env.APPNAME }} ${{github.workspace}}/artifactsArm64
cp build/aarch64/test/${{ env.APPNAME }}Lang_TEST ${{github.workspace}}/artifactsArm64
pushd ${{github.workspace}}
zip -r ${{ env.APPNAME }}-MacOS-osxcross-aarch64.zip artifactsArm64
popd
- name: 'Upload x64 Pull Request Artifact'
uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/pull/')
with:
name: ${{ env.APPNAME }} x64 Pull Request Artifacts
path: ${{ env.APPNAME }}-*-x64.zip
retention-days: 5
- name: 'Upload aarch64 Pull Request Artifact'
uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/pull/')
with:
name: ${{ env.APPNAME }} aarch64 Pull Request Artifacts
path: ${{ env.APPNAME }}-*-aarch64.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 }}-*-aarch64.zip