Merge pull request #26 from denismakogon/more-api #150
This file contains 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: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
jobs: | |
build-on-macos: | |
runs-on: macos-latest | |
steps: | |
- name: 'Check out repository' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: caching | |
uses: actions/cache@v4 | |
id: cmakelists | |
with: | |
path: | | |
CMakeLists.txt | |
key: ${{ github.sha }}-${{ github.run_id }} | |
- name: Set up Homebrew | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
with: | |
test-bot: false | |
- name: install prerequisites | |
shell: bash | |
run: | | |
brew install [email protected] | |
brew install gcc | |
pip3 install conan --break-system-packages | |
- name: conan-profile | |
shell: bash | |
run: | | |
conan profile detect | |
conan version | |
cp .github/conan2/macos_default ~/.conan2/profiles/default | |
conan profile show | |
mkdir -p libs | |
mkdir -p build | |
- name: compile x86_64 | |
shell: bash | |
run: | | |
conan install . --output-folder=build --build=missing | |
cd build | |
cp ../toolchains/macos-x86_64.cmake conan_toolchain.cmake | |
LIB_SUFFIX="-macos-x86_64" cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release | |
cmake --build . | |
file lib* | |
cp libjudy* ../libs/ | |
rm -fr * | |
- name: compile aarch64 | |
shell: bash | |
run: | | |
conan install . --output-folder=build --build=missing | |
cd build | |
cp ../toolchains/macos-aarch64.cmake conan_toolchain.cmake | |
LIB_SUFFIX="-macos-aarch64" cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release | |
cmake --build . | |
file lib* | |
cp libjudy* ../libs/ | |
rm -fr * | |
- name: artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libjudy-macos | |
path: libs/libjudy* | |
retention-days: 1 | |
build-on-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: caching | |
uses: actions/cache@v4 | |
id: cmakelists | |
with: | |
path: | | |
CMakeLists.txt | |
/home/linuxbrew/.linuxbrew/Cellar | |
key: ${{ github.sha }}-${{ github.run_id }} | |
- name: Set up Homebrew | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
with: | |
test-bot: false | |
- name: install prerequisites | |
shell: bash | |
run: | | |
brew install gcc | |
brew install conan | |
- name: conan-profile | |
shell: bash | |
run: | | |
conan profile detect | |
conan version | |
cp .github/conan2/linux_default ~/.conan2/profiles/default | |
conan profile show | |
mkdir -p libs | |
mkdir -p build | |
- name: compile x86_64 | |
shell: bash | |
run: | | |
conan install . --output-folder=build --build=missing | |
cd build | |
LIB_SUFFIX="-linux-x86_64" cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release | |
cmake --build . | |
file lib* | |
cp libjudy* ../libs/ | |
rm -fr CMakeFiles/ | |
- name: artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libjudy-linux | |
path: libs/libjudy* | |
retention-days: 1 | |
package: | |
needs: [ build-on-macos, build-on-linux ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest ] | |
include: | |
- os: ubuntu-latest | |
TARGET: linux | |
PLATFORM: x64 | |
steps: | |
- name: 'Check out repository' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: caching | |
uses: actions/cache@v4 | |
id: cmakelists | |
with: | |
path: | | |
CMakeLists.txt | |
/usr/local/Cellar | |
key: ${{ github.sha }}-${{ github.run_id }} | |
- name: 'Download jextract' | |
id: jextract | |
uses: oracle-actions/setup-java@v1 | |
with: | |
install: false | |
uri: https://download.java.net/java/early_access/jextract/22/5/openjdk-22-jextract+5-33_${{matrix.TARGET}}-${{matrix.PLATFORM}}_bin.tar.gz | |
- name: 'Extract jextract' | |
shell: sh | |
run: | | |
mkdir -p /tmp/jextract | |
tar --strip-components=1 -xvf ${{ steps.jextract.outputs.archive }} -C /tmp/jextract | |
export PATH=${PATH}:/tmp/jextract/bin | |
- name: 'Install OracleJDK GA' | |
id: jdk | |
uses: oracle-actions/setup-java@v1 | |
with: | |
website: oracle.com | |
release: 22 | |
- name: prepare-project | |
shell: bash | |
run: | | |
export PATH=${PATH}:/tmp/jextract/bin | |
mkdir -p build | |
jextract -I /usr/local/include @jextract_dump.txt include/api.h | |
- name: version | |
id: version | |
shell: bash | |
run: echo "version_var=$(date +'%Y.%m.%d+%s')" >> $GITHUB_ENV | |
- name: Set up Homebrew | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
with: | |
test-bot: false | |
- name: install prerequisites | |
shell: bash | |
run: | | |
brew install gcc | |
brew install conan | |
- name: conan-profile | |
shell: bash | |
run: | | |
conan profile detect | |
conan version | |
cp .github/conan2/${{ matrix.TARGET }}_default ~/.conan2/profiles/default | |
conan profile show | |
- name: conan-install | |
shell: bash | |
run: | | |
mkdir -p build | |
conan install . --output-folder=build --build=missing | |
cd build | |
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release | |
- name: java sources | |
shell: bash | |
run: | | |
export PATH=${PATH}:/tmp/jextract/bin | |
cd build | |
make java-sources | |
mkdir src/main/resources | |
- name: libjudy-linux | |
uses: actions/download-artifact@v4 | |
with: | |
name: libjudy-linux | |
path: build/src/main/resources/lib | |
- name: libjudy-macos | |
uses: actions/download-artifact@v4 | |
with: | |
name: libjudy-macos | |
path: build/src/main/resources/lib | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: build/src/main/resources | |
- name: jar | |
shell: bash | |
run: | | |
cd build | |
make jar | |
- name: jar tf | |
run: jar tf ../target/judy*.jar | |
working-directory: build/ | |
- name: 'make release' | |
if: github.event_name == 'push' | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: ${{ secrets.GH_RELEASE_TOKEN }} | |
automatic_release_tag: ${{ env.version_var }} | |
prerelease: false | |
title: Judy C++ UDP server ${{ env.version_var }} for Java | |
files: | | |
LICENSE | |
target/*.jar |