This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update github actions * fix lint * lint * update to 4.0.0-alpha-1 * get windows to be like web5-rs * fix windows * fix windows build * fix windows * update windows * update example
- Loading branch information
1 parent
5b39d6d
commit 33563e2
Showing
7 changed files
with
149 additions
and
69 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,13 +24,70 @@ env: | |
TBDEX_SDK_LOG_LEVEL: debug | ||
|
||
jobs: | ||
test: | ||
permissions: | ||
id-token: write | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install Rust 1.74.0 | ||
run: rustup toolchain install 1.74.0 | ||
- name: Set Rust 1.74.0 as default | ||
run: rustup default 1.74.0 | ||
- name: Test | ||
run: | | ||
rustup component add llvm-tools-preview | ||
cargo install grcov | ||
cargo test --package tbdex | ||
env: | ||
RUSTFLAGS: -Cinstrument-coverage | ||
LLVM_PROFILE_FILE: tbdex-rs-%p-%m.profraw | ||
- name: Upload test coverage to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
use_oidc: true | ||
files: '*.profraw' | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Init Hermit | ||
uses: cashapp/activate-hermit@v1 | ||
with: | ||
cache: true | ||
- name: Setup | ||
run: just setup | ||
- name: Lint | ||
run: just lint | ||
|
||
rust-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Init Hermit | ||
uses: cashapp/activate-hermit@v1 | ||
with: | ||
cache: true | ||
- name: Setup | ||
run: just setup | ||
- name: Test | ||
run: just test | ||
|
||
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 | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust 1.74.0 | ||
run: rustup toolchain install 1.74.0 | ||
- name: Set Rust 1.74.0 as default | ||
run: rustup default 1.74.0 | ||
- name: Run Build Script | ||
run: | | ||
cd bindings/tbdex_uniffi/libtargets/aarch64_apple_darwin | ||
|
@@ -49,9 +106,11 @@ jobs: | |
runs-on: macos-12 | ||
name: Build x86_64-apple-darwin target | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust | ||
run: rustup toolchain install stable | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust 1.74.0 | ||
run: rustup toolchain install 1.74.0 | ||
- name: Set Rust 1.74.0 as default | ||
run: rustup default 1.74.0 | ||
- name: Run Build Script | ||
run: | | ||
cd bindings/tbdex_uniffi/libtargets/x86_64_apple_darwin | ||
|
@@ -70,7 +129,11 @@ jobs: | |
runs-on: ubuntu-latest | ||
name: Build x86_64-unknown-linux-gnu target | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust 1.74.0 | ||
run: rustup toolchain install 1.74.0 | ||
- name: Set Rust 1.74.0 as default | ||
run: rustup default 1.74.0 | ||
- name: Run Build Script | ||
run: | | ||
cd bindings/tbdex_uniffi/libtargets/x86_64_unknown_linux_gnu | ||
|
@@ -89,7 +152,11 @@ jobs: | |
runs-on: ubuntu-latest | ||
name: Build x86_64-unknown-linux-musl target | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust 1.74.0 | ||
run: rustup toolchain install 1.74.0 | ||
- name: Set Rust 1.74.0 as default | ||
run: rustup default 1.74.0 | ||
- name: Run Build Script | ||
run: | | ||
cd bindings/tbdex_uniffi/libtargets/x86_64_unknown_linux_musl | ||
|
@@ -116,39 +183,17 @@ jobs: | |
- name: Build the library | ||
run: | | ||
cargo build --target x86_64-pc-windows-msvc --release --package tbdex_uniffi | ||
mkdir -p bound/kt/src/main/resources | ||
if (-not (Test-Path -Path "bound/kt/src/main/resources")) { | ||
New-Item -ItemType Directory -Path "bound/kt/src/main/resources" | ||
} | ||
cp target/x86_64-pc-windows-msvc/release/tbdex_uniffi.dll bound/kt/src/main/resources/tbdex_uniffi_x86_64_pc_windows_msvc.dll | ||
shell: powershell | ||
- name: Upload .dll | ||
uses: actions/[email protected] | ||
with: | ||
name: x86_64-pc-windows-msvc-dll | ||
path: bound/kt/src/main/resources/tbdex_uniffi_x86_64_pc_windows_msvc.dll | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Init Hermit | ||
uses: cashapp/activate-hermit@v1 | ||
with: | ||
cache: true | ||
- name: Setup | ||
run: just setup | ||
- name: Lint | ||
run: just lint | ||
|
||
rust-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Init Hermit | ||
uses: cashapp/activate-hermit@v1 | ||
with: | ||
cache: true | ||
- name: Setup | ||
run: just setup | ||
- name: Test | ||
run: just test | ||
|
||
kotlin-build-test-deploy-snapshot: | ||
needs: | ||
|
@@ -168,7 +213,7 @@ jobs: | |
distribution: "adopt" | ||
java-version: "11" | ||
|
||
# Cache Maven repo | ||
# Cache Maven repo | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
|
@@ -181,7 +226,11 @@ jobs: | |
run: | | ||
# Version resolution: use provided | ||
if [ -n "${{ github.event.inputs.version }}" ]; then | ||
resolvedVersion=${{ github.event.inputs.version }} | ||
if [[ "${{ github.event.inputs.version }}" != *-SNAPSHOT ]]; then | ||
resolvedVersion="${{ github.event.inputs.version }}-SNAPSHOT" | ||
else | ||
resolvedVersion="${{ github.event.inputs.version }}" | ||
fi | ||
# Otherwise, construct a version for deployment in form X.Y.Z-commit-$shortSHA-SNAPSHOT | ||
else | ||
longSHA=$(git rev-parse --verify HEAD) | ||
|
@@ -193,8 +242,7 @@ jobs: | |
echo "Resolved SNAPSHOT Version: $resolvedVersion" | ||
echo "resolved_version=$resolvedVersion" >> $GITHUB_OUTPUT | ||
# Package up the native binaries | ||
#TODO Centralize this block as we re-use it via copy/paste right now | ||
# Download and package the native binaries | ||
- name: Download MacOS aarch64 Native Library | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -221,7 +269,7 @@ jobs: | |
name: x86_64-pc-windows-msvc-dll | ||
path: bound/kt/src/main/resources/ | ||
|
||
- name: Build and Test Kotlin Project | ||
- name: Deploy Snapshot / Verify | ||
run: | | ||
# cd into the Kotlin project | ||
|
@@ -309,6 +357,8 @@ jobs: | |
cache: true | ||
- name: Setup | ||
run: just setup | ||
- name: Install latest stable Rust | ||
run: rustup install stable && rustup default stable | ||
- name: Install Nextest | ||
run: cargo install cargo-nextest | ||
- name: Create nextest.toml | ||
|
@@ -326,8 +376,8 @@ jobs: | |
sed -i '' 's/<testsuite name="tbdex"/<testsuite name="TbdexTestVectorsProtocolTest"/' target/nextest/ci/junit.xml | ||
- name: Move Test Results | ||
run: mv target/nextest/ci/junit.xml test-results/rust-test-results.xml | ||
- name: Upload Rust Test Results | ||
uses: actions/upload-artifact@v3 | ||
- name: Upload Rust Test Vector Results | ||
uses: actions/upload-artifact@v4.0.0 | ||
with: | ||
name: rust-test-results | ||
path: test-results/rust-test-results.xml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,8 @@ jobs: | |
|
||
git-tag: | ||
runs-on: ubuntu-latest | ||
needs: run-ci | ||
needs: | ||
- run-ci | ||
outputs: | ||
RELEASE_TAG: ${{ steps.set-version-and-tag.outputs.RELEASE_TAG }} | ||
RELEASE_VERSION: ${{ steps.set-version-and-tag.outputs.RELEASE_VERSION }} | ||
|
@@ -43,8 +44,7 @@ jobs: | |
git config user.email "[email protected]" | ||
# Cache Maven repo | ||
- id: cache | ||
uses: actions/cache@v3 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
|
@@ -100,7 +100,7 @@ jobs: | |
-DnewVersion=$nextVersion | ||
git add -Av | ||
git commit -m "[TBD Release Manager 🚀] Setting next development version after $version to: $nextVersion" | ||
git push origin main | ||
git push origin "${GITHUB_REF#refs/heads/}" | ||
git push origin $tagName | ||
kotlin-release-to-tbd-artifactory-and-maven-central: | ||
|
@@ -130,13 +130,12 @@ jobs: | |
restore-keys: | | ||
${{ runner.os }}-maven- | ||
# Package up the native binaries | ||
#TODO Centralize this block as we re-use it via copy/paste right now | ||
# Download and package the native binaries | ||
- name: Download MacOS aarch64 Native Library | ||
uses: actions/[email protected] | ||
with: | ||
name: aarch64-apple-darwin-dylib | ||
path: bound/kt/src/main/resources/ | ||
name: aarch64-apple-darwin-dylib | ||
path: bound/kt/src/main/resources/ | ||
- name: Download MacOS x86_64 Native Library | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -160,26 +159,35 @@ jobs: | |
|
||
- name: Deploy Release Version of Kotlin Project to Maven Central | ||
run: | | ||
# cd into the Kotlin project | ||
cd bound/kt/ | ||
# Publish to Sonatype | ||
# Precondition check: Only attempt to publish artifact if we have credentials | ||
if [ -n "${{ secrets.SONATYPE_PASSWORD }}" ]; then | ||
# Maven deploy lifecycle will build, run tests, verify, sign, and deploy | ||
mvn deploy --batch-mode \ | ||
--settings .maven_settings.xml \ | ||
-P ossrh,sign-artifacts | ||
else | ||
echo "Error: No credentials" | ||
exit 1 | ||
fi | ||
# cd into the Kotlin project | ||
cd bound/kt/ | ||
# Publish to Sonatype | ||
# Precondition check: Only attempt to publish artifact if we have credentials | ||
if [ -n "${{ secrets.SONATYPE_PASSWORD }}" ]; then | ||
# Maven deploy lifecycle will build, run tests, verify, sign, and deploy | ||
mvn deploy --batch-mode \ | ||
--settings .maven_settings.xml \ | ||
-P ossrh,sign-artifacts | ||
else | ||
echo "Error: No credentials" | ||
exit 1 | ||
fi | ||
env: | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
SIGN_KEY_PASS: ${{ secrets.GPG_SECRET_PASSPHRASE }} | ||
SIGN_KEY: ${{ secrets.GPG_SECRET_KEY }} | ||
|
||
- name: Create GitHub Release | ||
uses: actions/[email protected] | ||
id: release | ||
with: | ||
tag_name: "v${{ github.event.inputs.version }}" | ||
release_name: "v${{ github.event.inputs.version }}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
kotlin-docs: | ||
permissions: | ||
contents: read | ||
|
@@ -201,7 +209,7 @@ jobs: | |
${{ runner.os }}-maven- | ||
- run: mvn dokka:dokka | ||
working-directory: bound/kt | ||
- run: mkdir -p _site/kt/${GITHUB_REF_NAME} && mv bound/kt/target/dokka/* _site/kt/${GITHUB_REF_NAME} | ||
- run: mkdir -p _site/kt/v${{ github.event.inputs.version }} && mv bound/kt/target/dokka/* _site/kt/v${{ github.event.inputs.version }} | ||
env: | ||
GITHUB_REF_NAME: ${{ github.ref_name }} | ||
- name: Setup Pages | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
files=( | ||
"libtbdex_uniffi_aarch64_apple_darwin.dylib" | ||
"libtbdex_uniffi_x86_64_apple_darwin.dylib" | ||
"libweb5_uniffi_x86_64_unknown_linux_gnu.so" | ||
"libweb5_uniffi_x86_64_unknown_linux_musl.so" | ||
) | ||
|
||
crate_name="crate_name" # Replace with the actual crate name | ||
|
||
for file in "${files[@]}"; do | ||
if [[ -f "$file" ]]; then | ||
echo "Checking $file for $crate_name..." | ||
nm -D "$file" | grep "$crate_name" && echo "$crate_name found in $file with gnm" | ||
objdump -T "$file" | grep "$crate_name" && echo "$crate_name found in $file with gobjdump" | ||
else | ||
echo "$file does not exist" | ||
fi | ||
done | ||
|
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
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
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