Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Attempt to build shared libs dynamically #6

Attempt to build shared libs dynamically

Attempt to build shared libs dynamically #6

Workflow file for this run

name: Build Shared Libraries
on:
push:
branches:
- main
- kendall/github-mvn-repo
pull_request:
jobs:
build_aarch64_apple_darwin:
runs-on: macos-latest
name: Build aarch64-apple-darwin target
steps:
- uses: actions/checkout@v2
# - name: Install Rust
# run: rustup toolchain install stable
# - name: Run Build Script
# run: |
# cd bindings/tbdex_uniffi/libtargets/aarch64_apple_darwin
# ./build
- name: Upload .dylib
uses: actions/upload-artifact@v3
with:
name: aarch64-apple-darwin-dylib
path: bound/kt/src/main/resources/libtbdex_uniffi_aarch64_apple_darwin.dylib
build_x86_64_apple_darwin:
runs-on: macos-12
name: Build x86_64-apple-darwin target
steps:
- uses: actions/checkout@v2
# - name: Install Rust
# run: rustup toolchain install stable
# - name: Run Build Script
# run: |
# cd bindings/tbdex_uniffi/libtargets/x86_64_apple_darwin
# ./build
- name: Upload .dylib
uses: actions/upload-artifact@v3
with:
name: x86_64-apple-darwin-dylib
path: bound/kt/src/main/resources/libtbdex_uniffi_x86_64_apple_darwin.dylib
build_x86_64_unknown_linux_gnu:
runs-on: ubuntu-latest
name: Build x86_64-unknown-linux-gnu target
steps:
- uses: actions/checkout@v2
# - name: Run Build Script
# run: |
# cd bindings/tbdex_uniffi/libtargets/x86_64_unknown_linux_gnu
# ./build
- name: Upload .so
uses: actions/upload-artifact@v3
with:
name: x86_64-unknown-linux-gnu-so
path: bound/kt/src/main/resources/libtbdex_uniffi_x86_64_unknown_linux_gnu.so
build_x86_64_unknown_linux_musl:
runs-on: ubuntu-latest
name: Build x86_64-unknown-linux-musl target
steps:
- uses: actions/checkout@v2
# - name: Run Build Script
# run: |
# cd bindings/tbdex_uniffi/libtargets/x86_64_unknown_linux_musl
# ./build
- name: Upload .so
uses: actions/upload-artifact@v3
with:
name: x86_64-unknown-linux-musl-so
path: bound/kt/src/main/resources/libtbdex_uniffi_x86_64_unknown_linux_musl.so
package_artifact:
runs-on: ubuntu-latest
needs:
- build_aarch64_apple_darwin
- build_x86_64_apple_darwin
- build_x86_64_unknown_linux_gnu
- build_x86_64_unknown_linux_musl
name: Package Maven Artifact
steps:
- uses: actions/checkout@v2
- name: Download aarch64-apple-darwin binary
uses: actions/download-artifact@v3
with:
name: aarch64-apple-darwin-dylib
path: bound/kt/src/main/resources/
- name: Download x86_64-apple-darwin binary
uses: actions/download-artifact@v3
with:
name: x86_64-apple-darwin-dylib
path: bound/kt/src/main/resources/
- name: Download x86_64-unknown-linux-gnu binary
uses: actions/download-artifact@v3
with:
name: x86_64-unknown-linux-gnu-so
path: bound/kt/src/main/resources/
- name: Download x86_64-unknown-linux-musl binary
uses: actions/download-artifact@v3
with:
name: x86_64-unknown-linux-musl-so
path: bound/kt/src/main/resources/
- name: Package Maven Artifact
run: |
cd bound/kt
mvn install -DskipTests=true
- name: Upload Maven artifact
uses: actions/upload-artifact@v3
with:
name: maven-artifact
path: bound/kt/target/
test_shared_libraries:
needs: package_artifact
strategy:
matrix:
include:
- target: aarch64_apple_darwin
os: macos-latest
- target: x86_64_apple_darwin
os: macos-12
- target: x86_64_unknown_linux_gnu
os: ubuntu-latest
- target: x86_64_unknown_linux_musl
os: ubuntu-latest
name: Test on ${{ matrix.target }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Download Maven artifact
uses: actions/download-artifact@v3
with:
name: maven-artifact
path: bound/kt/target/
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "11"
- name: Run tests on macOS and Ubuntu
if: ${{ matrix.target != 'x86_64_unknown_linux_musl' }}
run: |
cd bound/kt
mvn '-Dtest=SystemArchitectureTest#can load shared library' test
- name: Run tests on Alpine for x86_64_unknown_linux_musl
if: ${{ matrix.target == 'x86_64_unknown_linux_musl' }}
run: |
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace \
alpine:latest /bin/sh -c "\
apk update && apk add openjdk11 && apk add maven && \
cd bound/kt && \
mvn '-Dtest=SystemArchitectureTest#can load shared library' test"
publish_artifact:
runs-on: ubuntu-latest
needs: test_shared_libraries
name: Publish Maven Artifact
steps:
- run: echo "hello world"