optimize code structure #65
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: WeDPR-Lab-Crypto GitHub Actions | |
on: | |
push: | |
paths-ignore: | |
- "docs/**" | |
- "Changelog.md" | |
- "README.md" | |
pull_request: | |
paths-ignore: | |
- "docs/**" | |
- "Changelog.md" | |
- "README.md" | |
release: | |
types: [published, created, edited] | |
env: | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
jobs: | |
build_with_macos: | |
name: build_with_macos | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 5 | |
- name: Nightly default | |
run: rustup default nightly | |
- name: install macOS dependencies | |
if: runner.os == 'macOS' | |
run: brew install ccache | |
- name: build | |
run: cargo build --all --all-targets --verbose --release | |
- name: run test | |
run: cargo test | |
- name: bench | |
run: cargo bench | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_c_crypto.dylib | |
path: target/release/libffi_c_crypto.dylib | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_c_zkp.dylib | |
path: target/release/libffi_c_zkp.dylib | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_java_crypto_binary.dylib | |
path: target/release/libffi_java_crypto_binary.dylib | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_c_crypto_binary.dylib | |
path: target/release/libffi_c_crypto_binary.dylib | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_fisco_bcos_sdk.dylib | |
path: target/release/libffi_fisco_bcos_sdk.dylib | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_c_fisco_bcos.dylib | |
path: target/release/libffi_c_fisco_bcos.dylib | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_java_crypto.dylib | |
path: target/release/libffi_java_crypto.dylib | |
- name: build ffi_java_sdk | |
run: cargo clean && cd ffi/ffi_java/ffi_java_crypto && cargo build --release --no-default-features --features "wedpr_f_hex wedpr_f_signature_secp256k1 wedpr_f_hash_keccak256 wedpr_f_signature_sm2 wedpr_f_hash_sm3 wedpr_f_vrf_curve25519" | |
- name: rename to ffi_java_sdk lib | |
run: mv target/release/libffi_java_crypto.dylib target/release/libffi_java_sdk.dylib | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_java_sdk.dylib | |
path: target/release/libffi_java_sdk.dylib | |
build_with_centos: | |
name: build_with_centos | |
runs-on: ubuntu-latest | |
container: | |
image: docker.io/centos:7 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 5 | |
- name: install rust language | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly-2022-07-28 | |
override: true | |
- name: install CentOS dependencies | |
run: | | |
yum install -y epel-release centos-release-scl | |
yum install -y java-11-openjdk-devel git make gcc gcc-c++ glibc-static glibc-devel openssl openssl-devel cmake3 ccache devtoolset-7 libzstd-devel zlib-devel flex bison python-devel python3-devel && source /opt/rh/devtoolset-7/enable | |
- name: configure and compile | |
run: | | |
cargo build --all --all-targets --verbose --release | |
cargo test | |
cargo bench | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_c_crypto.so | |
path: target/release/libffi_c_crypto.so | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_c_zkp.so | |
path: target/release/libffi_c_zkp.so | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_java_crypto_binary.so | |
path: target/release/libffi_java_crypto_binary.so | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_c_crypto_binary.so | |
path: target/release/libffi_c_crypto_binary.so | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_fisco_bcos_sdk.so | |
path: target/release/libffi_fisco_bcos_sdk.so | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_c_fisco_bcos.so | |
path: target/release/libffi_c_fisco_bcos.so | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_java_crypto.so | |
path: target/release/libffi_java_crypto.so | |
- name: build ffi_java_sdk | |
run: cargo clean && cd ffi/ffi_java/ffi_java_crypto && cargo build --release --no-default-features --features "wedpr_f_hex wedpr_f_signature_secp256k1 wedpr_f_hash_keccak256 wedpr_f_signature_sm2 wedpr_f_hash_sm3 wedpr_f_vrf_curve25519" | |
- name: rename to ffi_java_sdk lib | |
run: mv target/release/libffi_java_crypto.so target/release/libffi_java_sdk.so | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: libffi_java_sdk.so | |
path: target/release/libffi_java_sdk.so | |
build_with_windows: | |
name: build_with_windows | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-2019] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 5 | |
- run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- run: vcpkg install openssl:x64-windows-static-md | |
- name: build and test | |
run: | | |
cargo build --all --all-targets --verbose --release | |
cargo test | |
cargo bench | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ffi_c_crypto.dll | |
path: D:\a\WeDPR-Lab-Crypto\WeDPR-Lab-Crypto\target\release\ffi_c_crypto.dll | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ffi_c_zkp.dll | |
path: D:\a\WeDPR-Lab-Crypto\WeDPR-Lab-Crypto\target\release\ffi_c_zkp.dll | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ffi_java_crypto_binary.dll | |
path: D:\a\WeDPR-Lab-Crypto\WeDPR-Lab-Crypto\target\release\ffi_java_crypto_binary.dll | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ffi_c_crypto_binary.dll | |
path: D:\a\WeDPR-Lab-Crypto\WeDPR-Lab-Crypto\target\release\ffi_c_crypto_binary.dll | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ffi_fisco_bcos_sdk.dll | |
path: D:\a\WeDPR-Lab-Crypto\WeDPR-Lab-Crypto\target\release\ffi_fisco_bcos_sdk.dll | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ffi_c_fisco_bcos.dll | |
path: D:\a\WeDPR-Lab-Crypto\WeDPR-Lab-Crypto\target\release\ffi_c_fisco_bcos.dll | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ffi_java_crypto.dll | |
path: D:\a\WeDPR-Lab-Crypto\WeDPR-Lab-Crypto\target\release\ffi_java_crypto.dll | |
- name: build ffi_java_sdk | |
run: cargo clean && cd ffi/ffi_java/ffi_java_crypto && cargo build --release --no-default-features --features "wedpr_f_hex wedpr_f_signature_secp256k1 wedpr_f_hash_keccak256 wedpr_f_signature_sm2 wedpr_f_hash_sm3 wedpr_f_vrf_curve25519" | |
- name: rename to vrf lib | |
run: mv D:\a\WeDPR-Lab-Crypto\WeDPR-Lab-Crypto\target\release\ffi_java_crypto.dll D:\a\WeDPR-Lab-Crypto\WeDPR-Lab-Crypto\target\release\ffi_java_sdk.dll | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ffi_java_sdk.dll | |
path: D:\a\WeDPR-Lab-Crypto\WeDPR-Lab-Crypto\target\release\ffi_java_sdk.dll |