Skip to content

Full flow

Full flow #2

Workflow file for this run

name: Publish Kotlin Library
on:
push:
branches:
- main
- kendall/github-mvn-repo
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:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Download Maven artifact
uses: actions/download-artifact@v3
with:
name: maven-artifact
path: bound/kt/target/
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "11"
- name: Set up Maven settings
run: |
mkdir -p ~/.m2
echo "<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd\">
<servers>
<server>
<id>github</id>
<username>${{ github.actor }}</username>
<password>${{ secrets.GITHUB_TOKEN }}</password>
</server>
</servers>
</settings>" > ~/.m2/settings.xml
- name: Deploy artifact
run: |
cd bound/kt
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
mvn deploy:deploy-file \
-Dfile=target/tbdex-core-${VERSION}.jar \
-DpomFile=pom.xml \
-DrepositoryId=github \
-Durl=https://maven.pkg.github.com/TBD54566975/tbdex-rs