v2.1.0 #217
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: Release | |
on: | |
push: | |
branches: | |
- release-v1 | |
- release-v2 | |
jobs: | |
build-python-sdk-macos: | |
runs-on: macos-13 | |
strategy: | |
fail-fast: true | |
matrix: | |
python: | |
- version: "3.7" | |
universal2: false | |
- version: "3.8" | |
universal2: true | |
- version: "3.9" | |
universal2: true | |
- version: "3.10" | |
universal2: true | |
- version: "3.11" | |
universal2: true | |
- version: "3.12" | |
universal2: true | |
- version: "3.13" | |
universal2: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python.version }} | |
architecture: x64 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
default: true | |
- name: Build wheels - x86_64 | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: x86_64 | |
args: -i python --release --out dist -m python/Cargo.toml | |
- name: Install built wheel - x86_64 | |
run: | | |
pip install longport --no-index --find-links dist --force-reinstall | |
- name: Build wheels - universal2 | |
if: ${{ matrix.python.universal2 }} | |
uses: PyO3/maturin-action@v1 | |
with: | |
args: -i python --release --target universal2-apple-darwin --out dist -m python/Cargo.toml | |
- name: Install built wheel - universal2 | |
if: ${{ matrix.python.universal2 }} | |
run: | | |
pip install longport --no-index --find-links dist --force-reinstall | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-macos-${{ matrix.python.version }} | |
path: dist | |
build-python-sdk-windows: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
target: [x64, x86] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.target }} | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
default: true | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: -i python --release --out dist -m python/Cargo.toml | |
- name: Install built wheel | |
run: | | |
pip install longport --no-index --find-links dist --force-reinstall | |
python -c "import longport" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-windows-${{ matrix.target }}-${{ matrix.python-version }} | |
path: dist | |
build-python-sdk-linux: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
target: [x86_64, i686] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
manylinux: auto | |
args: -i python${{ matrix.python-version }} --release --out dist -m python/Cargo.toml | |
- name: Install built wheel | |
if: matrix.target == 'x86_64' | |
run: | | |
pip install longport --no-index --find-links dist --force-reinstall | |
python -c "import longport" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux-${{ matrix.target }}-${{ matrix.python-version }} | |
path: dist | |
build-python-sdk-linux-cross: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
target: [aarch64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
manylinux: 2_28 | |
args: -i python${{ matrix.python-version }} --release --out dist -m python/Cargo.toml | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Install built wheel | |
with: | |
arch: none | |
distro: none | |
base_image: "--platform=linux/aarch64 ubuntu:20.04" | |
githubToken: ${{ github.token }} | |
dockerRunArgs: | | |
--volume "${PWD}/dist:/artifacts" | |
install: | | |
apt-get update | |
apt-get install -y --no-install-recommends python3 python3-venv software-properties-common | |
add-apt-repository ppa:deadsnakes/ppa | |
apt-get update | |
apt-get install -y curl python${{ matrix.python-version }}-venv | |
run: | | |
ls -lrth /artifacts | |
PYTHON=python${{ matrix.python-version }} | |
$PYTHON -m venv venv | |
venv/bin/pip install -U pip | |
venv/bin/pip install longport --no-index --find-links /artifacts --force-reinstall | |
venv/bin/python -c 'import longport' | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux-${{ matrix.target }}-${{ matrix.python-version }} | |
path: dist | |
build-nodejs-sdk: | |
strategy: | |
fail-fast: true | |
matrix: | |
settings: | |
- host: ubuntu-22.04 | |
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine | |
build: | | |
yarn build | |
strip -x *.node | |
artifact-name: linux-x64-musl | |
- host: ubuntu-22.04 | |
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 | |
build: | | |
rustup target add aarch64-unknown-linux-gnu | |
yarn build --target aarch64-unknown-linux-gnu | |
aarch64-unknown-linux-gnu-strip *.node | |
artifact-name: linux-aarch64 | |
# - host: ubuntu-22.04 | |
# docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine | |
# build: | | |
# rustup target add aarch64-unknown-linux-musl | |
# yarn build --target aarch64-unknown-linux-musl | |
# /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node | |
# artifact-name: linux-aarch64-musl | |
- host: macos-13 | |
architecture: x64 | |
build: | | |
yarn build | |
strip -x *.node | |
artifact-name: macos | |
- host: windows-latest | |
build: yarn build | |
architecture: x64 | |
artifact-name: windows | |
- host: ubuntu-22.04 | |
build: | | |
yarn build | |
strip *.node | |
artifact-name: linux-x64 | |
- host: macos-13 | |
target: aarch64-apple-darwin | |
build: | | |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*; | |
export CC=$(xcrun -f clang); | |
export CXX=$(xcrun -f clang++); | |
SYSROOT=$(xcrun --sdk macosx --show-sdk-path); | |
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"; | |
yarn build --target aarch64-apple-darwin | |
strip -x *.node | |
artifact-name: macos-aarch64 | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
if: ${{ !matrix.settings.docker }} | |
with: | |
node-version: 16 | |
check-latest: true | |
architecture: ${{ matrix.settings.architecture }} | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
if: ${{ !matrix.settings.docker }} | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
target: ${{ matrix.settings.target }} | |
- name: Install dependencies | |
working-directory: nodejs | |
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 | |
- name: Build | |
if: ${{ !matrix.settings.docker }} | |
working-directory: nodejs | |
run: ${{ matrix.settings.build }} | |
- name: Build in Docker | |
uses: addnab/docker-run-action@v3 | |
if: ${{ matrix.settings.docker }} | |
with: | |
image: ${{ matrix.settings.docker }} | |
options: "--user 0:0 -v ${{ github.workspace }}:/build -w /build/nodejs" | |
run: ${{ matrix.settings.build }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bindings-${{ matrix.settings.artifact-name }} | |
path: nodejs/longport.*.node | |
build-java-jni: | |
strategy: | |
fail-fast: true | |
matrix: | |
settings: | |
- host: ubuntu-22.04 | |
lib_prefix: "lib" | |
lib_suffix: ".so" | |
target: x86_64-unknown-linux-gnu | |
cross: true | |
- host: ubuntu-22.04 | |
lib_prefix: "lib" | |
lib_suffix: ".so" | |
target: aarch64-unknown-linux-gnu | |
cross: true | |
- host: windows-latest | |
lib_suffix: ".dll" | |
target: x86_64-pc-windows-msvc | |
- host: macos-13 | |
lib_prefix: "lib" | |
lib_suffix: ".dylib" | |
target: x86_64-apple-darwin | |
- host: macos-13 | |
lib_prefix: "lib" | |
lib_suffix: ".dylib" | |
target: aarch64-apple-darwin | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
target: ${{ matrix.settings.target }} | |
- name: Build | |
if: ${{ !matrix.settings.cross }} | |
run: | | |
cargo build -p longport-java --release --target ${{ matrix.settings.target }} | |
mv target/${{ matrix.settings.target }}/release/${{ matrix.settings.lib_prefix }}longport_java${{ matrix.settings.lib_suffix }} longport_java-${{ matrix.settings.target }}${{ matrix.settings.lib_suffix }} | |
- name: Install latest cross binary | |
if: ${{ matrix.settings.cross }} | |
uses: st3iny/install-cross-binary@v2 | |
- name: Build with Cross | |
if: ${{ matrix.settings.cross }} | |
run: | | |
cross build -p longport-java --release --target ${{ matrix.settings.target }} | |
mv target/${{ matrix.settings.target }}/release/${{ matrix.settings.lib_prefix }}longport_java${{ matrix.settings.lib_suffix }} longport_java-${{ matrix.settings.target }}${{ matrix.settings.lib_suffix }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jnis-${{ matrix.settings.target }} | |
path: longport_java-${{ matrix.settings.target }}${{ matrix.settings.lib_suffix }} | |
copy-cpp-headers: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: include-c | |
path: c/csrc/include | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: include-cpp | |
path: cpp/include | |
build-cpp-sdk-debug: | |
needs: | |
- copy-cpp-headers | |
strategy: | |
fail-fast: true | |
matrix: | |
settings: | |
- host: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
platform: x86_64_linux | |
dylib_ext: so | |
- host: windows-latest | |
target: x86_64-pc-windows-msvc | |
platform: x86_64_windows | |
- host: macos-13 | |
target: x86_64-apple-darwin | |
platform: x86_64_macos | |
dylib_ext: dylib | |
- host: macos-13 | |
target: aarch64-apple-darwin | |
platform: aarch64_macos | |
dylib_ext: dylib | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install MSBuild | |
if: ${{ matrix.settings.host == 'windows-latest' }} | |
uses: microsoft/setup-msbuild@v1.1 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
target: ${{ matrix.settings.target }} | |
- name: Get CMake | |
uses: lukka/get-cmake@latest | |
- name: Install cargo make | |
uses: davidB/rust-cargo-make@v1 | |
- name: Build | |
if: ${{ matrix.settings.target != 'aarch64-apple-darwin' }} | |
run: | | |
cargo make cmake-debug | |
cargo make c | |
cargo make cpp | |
- name: Build | |
if: ${{ matrix.settings.target == 'aarch64-apple-darwin' }} | |
run: | | |
cargo make cmake-debug-macos-aarch64 | |
cargo make cpp | |
- name: Copy files | |
if: ${{ matrix.settings.host == 'windows-latest' }} | |
run: | | |
md dist\lib\${{ matrix.settings.platform }}\debug | |
copy cmake.build\x64\Debug\cargo\build\${{ matrix.settings.target }}\debug\longport_c.dll dist\lib\${{ matrix.settings.platform }}\debug | |
copy cmake.build\x64\Debug\cargo\build\${{ matrix.settings.target }}\debug\longport_c.dll.lib dist\lib\${{ matrix.settings.platform }}\debug\longport_c.lib | |
copy cmake.build\Debug\longport_cpp.dll dist\lib\${{ matrix.settings.platform }}\debug | |
copy cmake.build\cpp\Debug\longport_cpp.lib dist\lib\${{ matrix.settings.platform }}\debug | |
- name: Copy files | |
if: ${{ matrix.settings.host != 'windows-latest' }} | |
run: | | |
mkdir -p dist/lib/${{ matrix.settings.platform }}/debug | |
cp cmake.build/cargo/build/${{ matrix.settings.target }}/debug/liblongport_c.${{ matrix.settings.dylib_ext }} dist/lib/${{ matrix.settings.platform }}/debug | |
cp cmake.build/liblongport_cpp.${{ matrix.settings.dylib_ext }} dist/lib/${{ matrix.settings.platform }}/debug | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libs-debug-${{ matrix.settings.target }} | |
path: dist/lib | |
build-cpp-sdk-release: | |
needs: | |
- copy-cpp-headers | |
strategy: | |
fail-fast: true | |
matrix: | |
settings: | |
- host: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
platform: x86_64_linux | |
dylib_ext: so | |
- host: windows-latest | |
target: x86_64-pc-windows-msvc | |
platform: x86_64_windows | |
- host: macos-13 | |
target: x86_64-apple-darwin | |
platform: x86_64_macos | |
dylib_ext: dylib | |
- host: macos-13 | |
target: aarch64-apple-darwin | |
platform: aarch64_macos | |
dylib_ext: dylib | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install MSBuild | |
if: ${{ matrix.settings.host == 'windows-latest' }} | |
uses: microsoft/setup-msbuild@v1.1 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
target: ${{ matrix.settings.target }} | |
- name: Get CMake | |
uses: lukka/get-cmake@latest | |
- name: Install cargo make | |
uses: davidB/rust-cargo-make@v1 | |
- name: Build | |
if: ${{ matrix.settings.target != 'aarch64-apple-darwin' }} | |
run: | | |
cargo make cmake-release | |
cargo make c-release | |
cargo make cpp-release | |
- name: Build | |
if: ${{ matrix.settings.target == 'aarch64-apple-darwin' }} | |
run: | | |
cargo make cmake-release-macos-aarch64 | |
cargo make cpp-release | |
- name: Copy files | |
if: ${{ matrix.settings.host == 'windows-latest' }} | |
run: | | |
md dist\lib\${{ matrix.settings.platform }}\release | |
copy cmake.build\x64\Release\cargo\build\${{ matrix.settings.target }}\release\longport_c.dll dist\lib\${{ matrix.settings.platform }}\release | |
copy cmake.build\x64\Release\cargo\build\${{ matrix.settings.target }}\release\longport_c.dll.lib dist\lib\${{ matrix.settings.platform }}\release\longport_c.lib | |
copy cmake.build\Release\longport_cpp.dll dist\lib\${{ matrix.settings.platform }}\release | |
copy cmake.build\cpp\Release\longport_cpp.lib dist\lib\${{ matrix.settings.platform }}\release | |
- name: Copy files | |
if: ${{ matrix.settings.host != 'windows-latest' }} | |
run: | | |
mkdir -p dist/lib/${{ matrix.settings.platform }}/release | |
cp cmake.build/cargo/build/${{ matrix.settings.target }}/release/liblongport_c.${{ matrix.settings.dylib_ext }} dist/lib/${{ matrix.settings.platform }}/release | |
cp cmake.build/liblongport_cpp.${{ matrix.settings.dylib_ext }} dist/lib/${{ matrix.settings.platform }}/release | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libs-release-${{ matrix.settings.target }} | |
path: dist/lib | |
build-ios-cpp-sdk: | |
needs: | |
- copy-cpp-headers | |
strategy: | |
fail-fast: true | |
matrix: | |
settings: | |
- target: aarch64-apple-ios | |
platform: OS64 | |
build-type: Debug | |
target-dir: debug | |
cargo-args: "" | |
- target: aarch64-apple-ios | |
platform: OS64 | |
build-type: Release | |
target-dir: release | |
cargo-args: -r | |
- target: aarch64-apple-ios-sim | |
platform: SIMULATOR64 | |
build-type: Debug | |
target-dir: debug | |
cargo-args: "" | |
- target: aarch64-apple-ios-sim | |
platform: SIMULATOR64 | |
build-type: Release | |
target-dir: release | |
cargo-args: -r | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: Install target | |
run: | | |
rustup target install ${{ matrix.settings.target }} | |
- name: Build C | |
working-directory: c | |
run: | | |
cargo rustc --crate-type=staticlib --target --target ${{ matrix.settings.target }} ${{ matrix.settings.cargo-args }} | |
- name: Get CMake | |
uses: lukka/get-cmake@latest | |
- name: Build CPP | |
working-directory: cpp | |
run: | | |
mkdir cmake.build | |
cd cmake.build && cmake -DCMAKE_BUILD_TYPE={{ matrix.settings.build-type }} -DCMAKE_TOOLCHAIN_FILE=../static/toolchains/ios.cmake -DPLATFORM=${{ matrix.settings.platform }} -DDENABLE_BITCODE=true ../static && make | |
- name: Copy files | |
run: | | |
mkdir -p dist/lib/${{ matrix.settings.target }}/${{ matrix.settings.target-dir }} | |
cp target/${{ matrix.settings.target }}/${{ matrix.settings.target-dir }}/liblongport_c.a dist/lib/${{ matrix.settings.target }}/${{ matrix.settings.target-dir }} | |
cp cpp/cmake.build/liblongport_cpp.a dist/lib/${{ matrix.settings.target }}/${{ matrix.settings.target-dir }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libs-ios-${{ matrix.settings.build-type }}-${{ matrix.settings.target }} | |
path: dist/lib | |
build-android-cpp-sdk: | |
needs: | |
- copy-cpp-headers | |
strategy: | |
fail-fast: true | |
matrix: | |
settings: | |
- target: armv7-linux-androideabi | |
cc: armv7a-linux-androideabi28-clang | |
cxx: armv7a-linux-androideabi28-clang++ | |
ar: llvm-ar | |
build-type: Debug | |
target-dir: debug | |
cargo-args: "" | |
- target: armv7-linux-androideabi | |
cc: armv7a-linux-androideabi28-clang | |
cxx: armv7a-linux-androideabi28-clang++ | |
ar: llvm-ar | |
build-type: Release | |
target-dir: release | |
cargo-args: -r | |
- target: aarch64-linux-android | |
cc: aarch64-linux-android28-clang | |
cxx: aarch64-linux-android28-clang++ | |
ar: llvm-ar | |
build-type: Debug | |
target-dir: debug | |
cargo-args: "" | |
- target: aarch64-linux-android | |
cc: aarch64-linux-android28-clang | |
cxx: aarch64-linux-android28-clang++ | |
ar: llvm-ar | |
build-type: Release | |
target-dir: release | |
cargo-args: -r | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: Install target | |
run: | | |
rustup target install ${{ matrix.settings.target }} | |
- name: Setup NDK | |
id: setup-ndk | |
uses: nttld/setup-ndk@v1 | |
with: | |
ndk-version: r26d | |
add-to-path: true | |
- name: Build C | |
working-directory: c | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
CC: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.settings.cc }} | |
AR: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.settings.ar }} | |
run: | | |
cargo rustc --crate-type=staticlib --target ${{ matrix.settings.target }} ${{ matrix.settings.cargo-args }} | |
- name: Get CMake | |
uses: lukka/get-cmake@latest | |
- name: Build CPP | |
working-directory: cpp | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
CC: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.settings.cc }} | |
CXX: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.settings.cxx }} | |
AR: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.settings.ar }} | |
run: | | |
mkdir cmake.build | |
cd cmake.build && cmake -DCMAKE_BUILD_TYPE=Debug ../static && make | |
- name: Copy files | |
run: | | |
mkdir -p dist/lib/${{ matrix.settings.target }}/${{ matrix.settings.target-dir }} | |
cp target/${{ matrix.settings.target }}/${{ matrix.settings.target-dir }}/liblongport_c.a dist/lib/${{ matrix.settings.target }}/${{ matrix.settings.target-dir }} | |
cp cpp/cmake.build/liblongport_cpp.a dist/lib/${{ matrix.settings.target }}/${{ matrix.settings.target-dir }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libs-android-${{ matrix.settings.build-type }}-${{ matrix.settings.target }} | |
path: dist/lib | |
build: | |
needs: | |
- build-python-sdk-macos | |
- build-python-sdk-windows | |
- build-python-sdk-linux | |
- build-python-sdk-linux-cross | |
- build-nodejs-sdk | |
- build-java-jni | |
- build-cpp-sdk-debug | |
- build-cpp-sdk-release | |
- build-ios-cpp-sdk | |
- build-android-cpp-sdk | |
runs-on: ubuntu-22.04 | |
steps: | |
- run: echo "All builds are done" | |
publish-rust-sdk: | |
needs: | |
- build | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: true | |
max-parallel: 1 | |
matrix: | |
package: | |
- name: longport-proto | |
registryName: longport-proto | |
path: rust/crates/proto | |
- name: longport-httpcli | |
registryName: longport-httpcli | |
path: rust/crates/httpclient | |
- name: longport-wscli | |
registryName: longport-wscli | |
path: rust/crates/wsclient | |
- name: longport-candlesticks | |
registryName: longport-candlesticks | |
path: rust/crates/candlesticks | |
- name: longport | |
registryName: longport | |
path: rust | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: get version | |
working-directory: ${{ matrix.package.path }} | |
run: echo PACKAGE_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV | |
- name: check published version | |
run: echo PUBLISHED_VERSION=$(cargo search ${{ matrix.package.registryName }} --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -) >> $GITHUB_ENV | |
- name: cargo login | |
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION | |
run: cargo login ${{ secrets.CRATES_TOKEN }} | |
- name: cargo package | |
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION | |
working-directory: ${{ matrix.package.path }} | |
run: | | |
cargo package | |
echo "We will publish:" $PACKAGE_VERSION | |
echo "This is current latest:" $PUBLISHED_VERSION | |
- name: Publish ${{ matrix.package.name }} | |
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION | |
working-directory: ${{ matrix.package.path }} | |
run: | | |
echo "# Cargo Publish" | |
cargo publish --no-verify | |
publish-cpp-sdk: | |
needs: | |
- build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download includes | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./sdk/libs | |
pattern: libs-* | |
merge-multiple: true | |
- name: Download includes | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./sdk/include | |
pattern: include-* | |
merge-multiple: true | |
- name: Get Version | |
run: echo SDK_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' c/Cargo.toml) >> $GITHUB_ENV | |
- name: Package | |
run: tar czvf openapi-cpp-sdk-$SDK_VERSION.tar.gz ./sdk | |
- name: Upload SDK to BJ | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.FE_S3_OPEN_STATIC_PROD_BJ_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.FE_S3_OPEN_STATIC_PROD_BJ_ACCESS_KEY_SECRET }} | |
run: | | |
aws --region=${{ secrets.PROD_BJ_AWS_DEFAULT_REGION }} s3 cp openapi-cpp-sdk-$SDK_VERSION.tar.gz s3://${{ secrets.FE_S3_OPEN_STATIC_PROD_BJ_BUCKET }}/openapi-sdk/ --cache-control max-age=31536000 | |
- name: Upload SDK to HK | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.FE_S3_OPEN_STATIC_PROD_HK_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.FE_S3_OPEN_STATIC_PROD_HK_ACCESS_KEY_SECRET }} | |
run: | | |
aws --region=${{ secrets.PROD_HK_AWS_DEFAULT_REGION }} s3 cp openapi-cpp-sdk-$SDK_VERSION.tar.gz s3://${{ secrets.FE_S3_OPEN_STATIC_PROD_HK_BUCKET }}/openapi-sdk/ --cache-control max-age=31536000 | |
publish-python-sdk: | |
runs-on: ubuntu-22.04 | |
environment: | |
name: pypi | |
url: https://pypi.org/p/longport | |
permissions: | |
id-token: write | |
needs: | |
- build | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
pattern: wheels-* | |
merge-multiple: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.7 | |
- name: Publish to PyPi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
publish-nodejs-sdk: | |
runs-on: ubuntu-22.04 | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Update versions | |
run: node ./.github/misc/update_jssdk_version.mjs $(sed -nE 's/^\s*version = "(.*?)"/\1/p' nodejs/Cargo.toml) | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
check-latest: true | |
- name: Install napi-rs/cli | |
run: npm install -g @napi-rs/cli | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./nodejs/artifacts | |
pattern: bindings-* | |
merge-multiple: true | |
- name: Move artifacts | |
run: napi artifacts | |
working-directory: ./nodejs | |
- name: List packages | |
run: ls -R ./npm | |
shell: bash | |
working-directory: ./nodejs | |
- name: Publish | |
run: | | |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | |
npm publish --access public | |
working-directory: ./nodejs | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
publish-java-sdk: | |
runs-on: ubuntu-22.04 | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "8" | |
distribution: "temurin" | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./java/jnis | |
pattern: jnis-* | |
merge-multiple: true | |
- name: Copy jnis | |
working-directory: java | |
run: | | |
mkdir -p javasrc/target/natives/linux_64 | |
mkdir -p javasrc/target/natives/linux_arm64 | |
mkdir -p javasrc/target/natives/windows_64 | |
mkdir -p javasrc/target/natives/osx_64 | |
mkdir -p javasrc/target/natives/osx_arm64 | |
mv jnis/longport_java-x86_64-unknown-linux-gnu.so javasrc/target/natives/linux_64/liblongport_java.so | |
mv jnis/longport_java-aarch64-unknown-linux-gnu.so javasrc/target/natives/linux_arm64/liblongport_java.so | |
mv jnis/longport_java-x86_64-pc-windows-msvc.dll javasrc/target/natives/windows_64/longport_java.dll | |
mv jnis/longport_java-x86_64-apple-darwin.dylib javasrc/target/natives/osx_64/liblongport_java.dylib | |
mv jnis/longport_java-aarch64-apple-darwin.dylib javasrc/target/natives/osx_arm64/liblongport_java.dylib | |
- name: Get version | |
working-directory: java | |
run: echo PACKAGE_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV | |
- name: Update version | |
working-directory: java/javasrc | |
run: mvn versions:set -DnewVersion=${PACKAGE_VERSION} | |
- name: Publish maven package | |
uses: samuelmeuli/action-maven-publish@v1 | |
with: | |
directory: java/javasrc | |
maven_profiles: release | |
maven_goals_phases: deploy | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
nexus_username: ${{ secrets.OSSRH_USERNAME }} | |
nexus_password: ${{ secrets.OSSRH_PASSWORD }} |