@@ -19,33 +19,83 @@ jobs:
1919 - run : rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
2020 - run : cargo build --verbose
2121 - run : cargo test --verbose
22-
2322 release :
2423 if : startsWith(github.ref, 'refs/tags/v')
25- runs-on : ubuntu-latest
24+ strategy :
25+ matrix :
26+ include :
27+ - os : ubuntu-latest
28+ suffix : linux-x86_64
29+ target : x86_64-unknown-linux-gnu
30+ ext : so
31+ - os : macos-14
32+ suffix : macos-arm64
33+ target : aarch64-apple-darwin
34+ ext : dylib
35+ - os : macos-14
36+ suffix : ios-arm64
37+ target : aarch64-apple-ios
38+ ext : a
39+ - os : ubuntu-latest
40+ suffix : android-arm64
41+ target : aarch64-linux-android
42+ ext : so
43+ runs-on : ${{ matrix.os }}
2644 needs : build_and_test
2745 steps :
2846 - uses : actions/checkout@v4
2947 - run : rustup update stable && rustup default stable
48+ - run : rustup target add ${{ matrix.target }}
49+ - name : Configure NDK tool-chain
50+ if : matrix.target == 'aarch64-linux-android'
51+ shell : bash
52+ run : |
53+ NDK="$(ls -d "$ANDROID_HOME"/ndk/* | sort -V | tail -n1)"
54+ echo "Using NDK at $NDK"
55+ echo "NDK=$NDK" >> "$GITHUB_ENV"
56+ echo "LLVM_BIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin" >> "$GITHUB_ENV"
57+ echo "$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin" >> "$GITHUB_PATH"
58+ echo "CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang" >> "$GITHUB_ENV"
3059 - name : Extract version from tag
3160 id : extract
3261 run : echo "version=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
33- - run : cargo build --release
62+ - run : cargo build --release --target ${{ matrix.target }}
3463 - name : Archive and rename binary
64+ shell : bash
3565 run : |
36- VERSION=${{ steps.extract.outputs.version }}
37- PLATFORM=linux-x86_64
38- mkdir -p target/dist
39- cp target/release/libscal3.so target/dist/libscal3-$VERSION-$PLATFORM.so
40- - run : cargo publish --locked
66+ VERSION=${{ steps.version.outputs.VERSION }}
67+ SUFFIX=${{ matrix.suffix }}
68+ EXT=${{ matrix.ext }}
69+ mkdir -p dist
70+ SRC="target/${{ matrix.target }}/release/libscal3.${EXT}"
71+ cp "$SRC" "dist/libscal3-${VERSION}-${SUFFIX}.${EXT}"
72+ - uses : actions/upload-artifact@v4
73+ with :
74+ name : bin-${{ matrix.suffix }}
75+ path : dist/*
76+ publish :
77+ if : startsWith(github.ref, 'refs/tags/v')
78+ needs : release
79+ runs-on : ubuntu-latest
80+ steps :
81+ - uses : actions/checkout@v4
82+ - uses : actions/download-artifact@v4
83+ with : { name: bin-linux-x86_64, path: dist/ }
84+ - uses : actions/download-artifact@v4
85+ with : { name: bin-macos-arm64, path: dist/ }
86+ - uses : actions/download-artifact@v4
87+ with : { name: bin-ios-arm64, path: dist/ }
88+ - uses : actions/download-artifact@v4
89+ with : { name: bin-android-arm64, path: dist/ }
90+ - name : Publish crate
91+ run : cargo publish --locked
4192 env :
4293 CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
43- - name : Create GitHub Release with uploaded binary
94+ - name : Create GitHub Release with all binaries
4495 run : |
45- VERSION=${{ steps.extract.outputs.version }}
46- PLATFORM=linux-x86_64
47- gh release create "${{ steps.extract.outputs.version }}" target/dist/libscal3-$VERSION-$PLATFORM.so \
48- --title "Release ${{ steps.extract.outputs.version }}" \
96+ VERSION=${GITHUB_REF##*/}
97+ gh release create "$VERSION" dist/* \
98+ --title "Release $VERSION" \
4999 --verify-tag
50100 env :
51101 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments