Build #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
triplet: x64-windows-static | |
- os: macos-13 | |
triplet: x64-osx | |
- os: ubuntu-latest | |
triplet: x64-linux | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up nasm | |
if: matrix.os != 'windows-latest' | |
uses: ilammy/setup-nasm@v1 | |
- name: Set up vcpkg | |
shell: bash | |
run: | | |
git clone https://github.com/Microsoft/vcpkg.git | |
./vcpkg/bootstrap-vcpkg.sh | |
- name: Configure project (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
run: | | |
cmake -B library\src\main\cpp\build -S library\src\main\cpp ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake ^ | |
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | |
- name: Configure project (macOS) | |
if: matrix.os == 'macos-13' | |
shell: bash | |
run: | | |
cmake -B library/src/main/cpp/build -S library/src/main/cpp \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \ | |
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | |
- name: Configure project (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
shell: bash | |
run: | | |
cmake -B library/src/main/cpp/build -S library/src/main/cpp \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-Bsymbolic" \ | |
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \ | |
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | |
- name: Build project (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
run: | | |
cmake --build library\src\main\cpp\build --config Release --parallel | |
- name: Build project (non-Windows) | |
if: matrix.os != 'windows-latest' | |
shell: bash | |
run: | | |
cmake --build library/src/main/cpp/build --config Release --parallel | |
- name: Create resources folder | |
run: mkdir -p library/src/main/resources/bin | |
- name: Copy binaries (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: bash | |
run: | | |
cp library/src/main/cpp/build/Release/klarity.dll library/src/main/resources/bin/ | |
- name: Copy binaries (macOS) | |
if: matrix.os == 'macos-13' | |
shell: bash | |
run: | | |
cp library/src/main/cpp/build/libklarity.dylib library/src/main/resources/bin/ | |
- name: Copy binaries (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
shell: bash | |
run: | | |
cp library/src/main/cpp/build/libklarity.so library/src/main/resources/bin/ | |
- name: Make binaries executable (non-Windows) | |
if: matrix.os != 'windows-latest' | |
shell: bash | |
run: | | |
chmod +x library/src/main/resources/bin/* || true | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17.0.15+6 | |
- name: Set up Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Make Gradle wrapper executable (non-Windows) | |
if: matrix.os != 'windows-latest' | |
shell: bash | |
run: | | |
chmod +x gradlew | |
- name: Make JARs | |
run: ./gradlew :library:jar -x test --no-daemon | |
- name: Clean up resources | |
shell: bash | |
run: rm -rf library/src/main/resources/bin | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.triplet }} | |
path: ${{ github.workspace }}/library/build/libs/library-1.0.0.jar |