Skip to content

Commit

Permalink
Merge branch 'main' into fragment-generator
Browse files Browse the repository at this point in the history
  • Loading branch information
cong-or authored Oct 12, 2023
2 parents 34c0b9c + 82771e0 commit 183875c
Show file tree
Hide file tree
Showing 230 changed files with 15,777 additions and 1,144 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,46 @@ on:
pull_request:
branches:
- main
- fix-earthly-integration-testing

permissions:
id-token: write
contents: read
packages: write

env:
AWS_REGION: eu-central-1
AWS_ROLE_ARN: arn:aws:iam::332405224602:role/ci
EARTHLY_VERSION: 0.7.6
ECR_REGISTRY: 332405224602.dkr.ecr.eu-central-1.amazonaws.com
TAG: ${{ github.sha }}

jobs:
build:
name: CI Test
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
steps:
- name: Setup CI
uses: input-output-hk/catalyst-ci/actions/setup@master
with:
aws_role_arn: ${{ env.AWS_ROLE_ARN }}
aws_region: ${{ env.AWS_REGION }}
earthly_version: ${{ env.EARTHLY_VERSION }}
- name: Install Earthly
uses: earthly/actions/setup-earthly@v1
with:
version: v0.7.0
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Login to GitHub Container Registry
- name: Login to ECR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.ECR_REGISTRY }}
- name: Run tests
env:
EARTHLY_SECRETS: "IDEASCALE_EMAIL=${{ secrets.IDEASCALE_EMAIL }}, IDEASCALE_PASSWORD=${{ secrets.IDEASCALE_PASSWORD }}, IDEASCALE_API_TOKEN=${{ secrets.IDEASCALE_API_TOKEN }}"
run: |
earthly -P --remote-cache=ghcr.io/${{ github.repository }}:cache +test
earthly -P --buildkit-host "tcp://${{ secrets.EARTHLY_SATELLITE_ADDRESS }}:8372" +test
186 changes: 186 additions & 0 deletions .github/workflows/cordova_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
name: Release cordova extension package

on:
push:
tags:
- cordova-*

env:
RUST_LATEST_STABLE_VERSION: 1.67

jobs:
initial_release:
name: Publish cordova extension package
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.create_release.outputs.id }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false

build_uniffi:
name: Build uniffi jni shared libs for android with cross
runs-on: ubuntu-latest
strategy:
matrix:
config:
- { target: aarch64-linux-android }
- { target: armv7-linux-androideabi }
- { target: i686-linux-android }
- { target: x86_64-linux-android }
steps:
- name: Checkout code
uses: actions/checkout@v1
with:
submodules: true

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}}
override: true
default: true

- name: Install cross
run: cargo install cross

- name: Build library (release)
env:
RUSTFLAGS: "-C embed-bitcode"
run: |
cross rustc --release --target ${{ matrix.config.target }} -p wallet-uniffi --features builtin-bindgen -- -C lto
- name: Prepare package
run: mkdir -p jniLibs/${{ matrix.config.target }}

- name: copy binary
run: cp ./target/${{ matrix.config.target }}/release/libuniffi_jormungandr_wallet.so ./jniLibs/${{ matrix.config.target }}/;

- uses: actions/upload-artifact@v2
with:
name: jniLibs
path: ./jniLibs
retention-days: 1

build_lipo_asset:
name: Build universal lib for cordova plugin
runs-on: macos-latest
strategy:
fail-fast: false

steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}}
override: true
default: true

- run: rustup target add x86_64-apple-ios
- run: rustup target add aarch64-apple-ios

- name: Checkout code
uses: actions/checkout@v1
with:
submodules: true

- name: build universal lib
env:
RUSTFLAGS: "-C embed-bitcode"
working-directory: ./src/chain-wallet-libs/bindings/wallet-cordova/scripts
run: python3 ./build_ios.py

- uses: actions/upload-artifact@v1
with:
name: iosLibs
path: ./src/chain-wallet-libs/bindings/wallet-cordova/src/ios

package_cordova_plugin:
runs-on: ubuntu-latest
needs: [initial_release, build_uniffi, build_lipo_asset]

steps:
- name: Checkout code
uses: actions/checkout@v1
with:
submodules: true

- name: Download jni libs
uses: actions/download-artifact@v1
with:
name: jniLibs

- name: make libs directory
run: mkdir -p src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs

- name: Copy libs
run: cp -r jniLibs/* src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs

- name: rename arm64-v8a
working-directory: ./src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs
run: mv aarch64-linux-android arm64-v8a

- name: rename armv7-linux-androideabi
working-directory: ./src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs
run: mv armv7-linux-androideabi armeabi-v7a

- name: rename i686-linux-android
working-directory: ./src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs
run: mv i686-linux-android x86

- name: rename x86_64
working-directory: ./src/chain-wallet-libs/bindings/wallet-cordova/src/android/libs
run: mv x86_64-linux-android x86_64

- name: Install uniffi
uses: actions-rs/[email protected]
with:
crate: uniffi_bindgen
version: 0.21.1
use-tool-cache: true

- name: copy java definitions from jni
run: python3 ./src/chain-wallet-libs/bindings/wallet-cordova/scripts/copy_jni_definitions.py

- name: Download artifact with universal lib
uses: actions/download-artifact@v1
with:
name: iosLibs

- name: Copy universal lib to plugin's directory
run: cp -r iosLibs/* src/chain-wallet-libs/bindings/wallet-cordova/src/ios

- name: setup node
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: package module
run: npm pack ./src/chain-wallet-libs/bindings/wallet-cordova

- name: rename-tarball
run: |
find ./src/chain-wallet-libs -name wallet-cordova-plugin*.tgz -exec mv {} {} \;
mv wallet-cordova-plugin*.tgz wallet-cordova-plugin-${{ needs.initial_release.outputs.version }}.tgz
ls
- name: Upload binaries to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.initial_release.outputs.upload_url }}
asset_path: ./wallet-cordova-plugin-${{ needs.initial_release.outputs.version }}.tgz
asset_name: wallet-cordova-plugin-${{ needs.initial_release.outputs.version }}.tgz
asset_content_type: application/gzip
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
rm -rf /opt/hostedtoolcache
- name: Build Docs
uses: docker://ghcr.io/input-output-hk/catalyst-gh-tools:v1.4.3
uses: docker://ghcr.io/input-output-hk/catalyst-gh-tools:v1.4.4
with:
driver-opts: network=host
entrypoint: cargo
Expand Down
29 changes: 24 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:

# We are excluding cat-dat-service and event-db because we are already running it with Earthly
- name: Build and archive tests
run: |
run: |
cargo nextest archive \
--workspace \
--exclude vitup \
Expand All @@ -138,8 +138,13 @@ jobs:
--exclude vit-servicing-station-server \
--exclude vit-servicing-station-tests \
--exclude vit-servicing-station-lib \
--exclude vit-servicing-station-cli-f10 \
--exclude vit-servicing-station-server-f10 \
--exclude vit-servicing-station-tests-f10 \
--exclude vit-servicing-station-lib-f10 \
--exclude cat-data-service \
--exclude event-db \
--exclude wallet-uniffi \
--archive-file nextest-archive.tar.zst
- name: Save test archive
Expand Down Expand Up @@ -210,6 +215,8 @@ jobs:
path: |
target/debug/vit-servicing-station-cli
target/debug/vit-servicing-station-server
target/debug/vit-servicing-station-cli-f10
target/debug/vit-servicing-station-server-f10
target/debug/jcli
target/debug/jormungandr
target/debug/explorer
Expand All @@ -220,7 +227,7 @@ jobs:

- name: Install cargo-make
run: cargo install --force cargo-make

- name: Install refinery
run: cargo install refinery_cli

Expand All @@ -231,7 +238,7 @@ jobs:
- name: Build external dependencies
if: steps.deps-cache.outputs.cache-hit != 'true'
run:
cargo build -p vit-servicing-station-cli -p vit-servicing-station-server -p jcli -p jormungandr -p explorer
cargo build -p vit-servicing-station-cli -p vit-servicing-station-server -p vit-servicing-station-cli-f10 -p vit-servicing-station-server-f10 -p jcli -p jormungandr -p explorer

- name: Setup Event DB
env:
Expand All @@ -241,7 +248,7 @@ jobs:
# We are excluding cat-dat-service and event-db because we are already running it with Earthly
- name: Build and archive tests
if: steps.archive-cache.outputs.cache-hit != 'true'
run: |
run: |
cargo nextest archive \
--workspace \
--exclude vitup \
Expand All @@ -252,8 +259,13 @@ jobs:
--exclude vit-servicing-station-server \
--exclude vit-servicing-station-tests \
--exclude vit-servicing-station-lib \
--exclude vit-servicing-station-cli-f10 \
--exclude vit-servicing-station-server-f10 \
--exclude vit-servicing-station-tests-f10 \
--exclude vit-servicing-station-lib-f10 \
--exclude cat-data-service \
--exclude event-db \
--exclude wallet-uniffi \
--archive-file nextest-archive.tar.zst
- name: Run Catalyst Core tests
Expand Down Expand Up @@ -374,11 +386,18 @@ jobs:
run:
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config

- name: Install uniffi
uses: actions-rs/[email protected]
with:
crate: uniffi_bindgen
version: 0.21.1
use-tool-cache: true

- name: Clippy and fmt
uses: actions-rs/toolchain@v1
with:
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}}
components: rustfmt, clippy

- run: rustup component add clippy
- run: scripts/check-fmt.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ result*
.vscode
**/.idea/
.temp/
tests/tmp/

# std
.std
Expand Down
Loading

0 comments on commit 183875c

Please sign in to comment.