Skip to content

Commit

Permalink
Setup lexbor build and publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
DrewCarlson committed Jul 30, 2023
1 parent 2794c51 commit 80b6056
Show file tree
Hide file tree
Showing 14 changed files with 354 additions and 23 deletions.
208 changes: 208 additions & 0 deletions .github/workflows/build-lexbor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
name: Build and Release Lexbor Binaries

on:
push:
tags:
- 'lexbor-v*'

jobs:
build-macos-arm64:
name: Build macos arm64
runs-on: macos-13
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Build Lexbor
run: |
cd lexbor
mkdir build && mkdir install
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../cmake-files/macos-arm64.cmake -DCMAKE_INSTALL_PREFIX=../install -DLEXBOR_BUILD_SHARED=OFF
make
make install
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: macos_arm64
path: lexbor/install/lib/liblexbor_static.a

build-macos-x64:
name: Build macos x64
runs-on: macos-13
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Build Lexbor
run: |
cd lexbor
mkdir build && mkdir install
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../cmake-files/macos-x64.cmake -DCMAKE_INSTALL_PREFIX=../install -DLEXBOR_BUILD_SHARED=OFF
make
make install
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: macos_x64
path: lexbor/install/lib/liblexbor_static.a

build-ios-arm64:
name: Build iOS arm64
runs-on: macos-13
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Build Lexbor
run: |
cd lexbor
mkdir build && mkdir install
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../cmake-files/ios-arm64.cmake -DCMAKE_INSTALL_PREFIX=../install -DLEXBOR_BUILD_SHARED=OFF
make
make install
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: ios_arm64
path: lexbor/install/lib/liblexbor_static.a

build-ios-x64:
name: Build iOS x64
runs-on: macos-13
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Build Lexbor
run: |
cd lexbor
mkdir build && mkdir install
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../cmake-files/ios-x64.cmake -DCMAKE_INSTALL_PREFIX=../install -DLEXBOR_BUILD_SHARED=OFF
make
make install
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: ios_x64
path: lexbor/install/lib/liblexbor_static.a

build-linux-x64:
name: Build Linux x64
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Build Lexbor
run: |
cd lexbor
mkdir build && mkdir install
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install -DLEXBOR_BUILD_SHARED=OFF
make
make install
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: linux_x64
path: lexbor/install/lib/liblexbor_static.a

build-linux-arm64:
name: Build Linux arm64
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- run: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu

- name: Build Lexbor
run: |
cd lexbor
mkdir build && mkdir install
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../cmake-files/linux-arm64.cmake -DCMAKE_INSTALL_PREFIX=../install -DLEXBOR_BUILD_SHARED=OFF
make
make install
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: linux_arm64
path: lexbor/install/lib/liblexbor_static.a

build-windows-x64:
name: Build Windows x64
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- run: sudo apt-get install -y mingw-w64

- name: Build Lexbor
run: |
cd lexbor
mkdir build && mkdir install
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../cmake-files/windows-x64.cmake -DCMAKE_INSTALL_PREFIX=../install -DLEXBOR_BUILD_SHARED=OFF
make
make install
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: mingw_x64
path: lexbor/install/lib/liblexbor_static.a

create-release:
name: Create Release
runs-on: ubuntu-latest
needs: [ build-windows-x64, build-linux-arm64, build-linux-x64, build-ios-x64, build-ios-arm64, build-macos-x64, build-macos-arm64 ]
permissions:
contents: write
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v3
- run: |
zip -r mingw_x64.zip mingw_x64
zip -r linux_arm64.zip linux_arm64
zip -r linux_x64.zip linux_x64
zip -r ios_x64.zip ios_x64
zip -r ios_arm64.zip ios_arm64
zip -r macos_x64.zip macos_x64
zip -r macos_arm64.zip macos_arm64
- name: Upload Artifacts to Release
uses: softprops/action-gh-release@v1
with:
files: |
mingw_x64.zip
linux_arm64.zip
linux_x64.zip
ios_x64.zip
ios_arm64.zip
macos_x64.zip
macos_arm64.zip
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
lexbor-bin/
!lexbor-bin/.gitkeep

### IntelliJ IDEA ###
.idea/
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ document.use { document ->
![](https://img.shields.io/static/v1?label=&message=macOS&color=blue)
![](https://img.shields.io/static/v1?label=&message=Windows&color=blue)
![](https://img.shields.io/static/v1?label=&message=iOS&color=blue)
![](https://img.shields.io/static/v1?label=&message=tvOS&color=blue)
![](https://img.shields.io/static/v1?label=&message=watchOS&color=blue)

```kotlin
repositories {
Expand Down
17 changes: 17 additions & 0 deletions cmake-files/ios-arm64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
set(CMAKE_SYSTEM_NAME iOS)
set(CMAKE_SYSTEM_PROCESSOR arm64)

set(CMAKE_OSX_ARCHITECTURES arm64)
set(CMAKE_OSX_DEPLOYMENT_TARGET 9.0)
set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH NO)

execute_process(
COMMAND xcrun --sdk iphoneos --show-sdk-path
OUTPUT_VARIABLE IOS_SDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

set(CMAKE_OSX_SYSROOT ${IOS_SDK_PATH})

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch arm64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch arm64")
14 changes: 14 additions & 0 deletions cmake-files/ios-x64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set(CMAKE_SYSTEM_NAME iOS)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

set(CMAKE_OSX_ARCHITECTURES x86_64)
set(CMAKE_OSX_DEPLOYMENT_TARGET 9.0)
set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH NO)

execute_process(
COMMAND xcrun --sdk iphonesimulator --show-sdk-path
OUTPUT_VARIABLE IOS_SIMULATOR_SDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

set(CMAKE_OSX_SYSROOT ${IOS_SIMULATOR_SDK_PATH})
10 changes: 10 additions & 0 deletions cmake-files/linux-arm64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm64)

set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)
set(CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabi)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
12 changes: 12 additions & 0 deletions cmake-files/macos-arm64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR arm64)

set(CMAKE_OSX_ARCHITECTURES arm64)

execute_process(
COMMAND xcrun --sdk macosx --show-sdk-path
OUTPUT_VARIABLE MACOS_SDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

set(CMAKE_OSX_SYSROOT ${MACOS_SDK_PATH})
12 changes: 12 additions & 0 deletions cmake-files/macos-x64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

set(CMAKE_OSX_ARCHITECTURES x86_64)

execute_process(
COMMAND xcrun --sdk macosx --show-sdk-path
OUTPUT_VARIABLE MACOS_SDK_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

set(CMAKE_OSX_SYSROOT ${MACOS_SDK_PATH})
10 changes: 10 additions & 0 deletions cmake-files/windows-x64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
set(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Loading

0 comments on commit 80b6056

Please sign in to comment.