mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-11-06 16:14:11 +00:00
nightly and release build with local-tun
This commit is contained in:
@@ -26,8 +26,18 @@ jobs:
|
||||
- name: Build ${{ matrix.target }}
|
||||
timeout-minutes: 120
|
||||
run: |
|
||||
compile_target=${{ matrix.target }}
|
||||
|
||||
if [[ "$compile_target" == *"-linux-"* || "$compile_target" == *"-apple-"* ]]; then
|
||||
compile_features="-f local-redir -f local-tun"
|
||||
fi
|
||||
|
||||
if [[ "$compile_target" == "mips-"* || "$compile_target" == "mipsel-"* || "$compile_target" == "mips64-"* || "$compile_target" == "mips64el-"* ]]; then
|
||||
compile_compress="-u"
|
||||
fi
|
||||
|
||||
cd build
|
||||
./build-release -t ${{ matrix.target }}
|
||||
./build-release -t ${{ matrix.target }} $compile_features $compile_compress
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
|
||||
@@ -38,8 +38,18 @@ jobs:
|
||||
- name: Build ${{ matrix.target }}
|
||||
timeout-minutes: 120
|
||||
run: |
|
||||
compile_target=${{ matrix.target }}
|
||||
|
||||
if [[ "$compile_target" == *"-linux-"* || "$compile_target" == *"-apple-"* ]]; then
|
||||
compile_features="-f local-redir -f local-tun"
|
||||
fi
|
||||
|
||||
if [[ "$compile_target" == "mips-"* || "$compile_target" == "mipsel-"* || "$compile_target" == "mips64-"* || "$compile_target" == "mips64el-"* ]]; then
|
||||
compile_compress="-u"
|
||||
fi
|
||||
|
||||
cd build
|
||||
./build-release -t ${{ matrix.target }}
|
||||
./build-release -t ${{ matrix.target }} $compile_features $compile_compress
|
||||
|
||||
- name: Upload Github Assets
|
||||
uses: softprops/action-gh-release@v1
|
||||
|
||||
+17
-10
@@ -10,8 +10,9 @@ fi
|
||||
|
||||
targets=()
|
||||
features=()
|
||||
use_upx=false
|
||||
|
||||
while getopts "t:f:" opt; do
|
||||
while getopts "t:f:u" opt; do
|
||||
case $opt in
|
||||
t)
|
||||
targets+=($OPTARG)
|
||||
@@ -19,8 +20,11 @@ while getopts "t:f:" opt; do
|
||||
f)
|
||||
features+=($OPTARG)
|
||||
;;
|
||||
u)
|
||||
use_upx=true
|
||||
;;
|
||||
?)
|
||||
echo "Usage: $(basename $0) [-t <target-triple>] [-f features]"
|
||||
echo "Usage: $(basename $0) [-t <target-triple>] [-f features] [-u]"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -32,11 +36,18 @@ if [[ "${#targets[@]}" == "0" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[[ -z $upx ]] && upx="echo pending"
|
||||
if [[ $upx == "echo pending" ]] && hash upx 2>/dev/null; then
|
||||
upx="upx -9"
|
||||
if [[ "${use_upx}" = true ]]; then
|
||||
if [[ ! -z $upx ]] && hash upx 2>/dev/null; then
|
||||
upx="upx -9"
|
||||
fi
|
||||
|
||||
if [[ "x$upx" == "x" ]]; then
|
||||
echo "Couldn't find upx in PATH, consider specifying it with variable \$upx"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
function build() {
|
||||
cd "$CUR_DIR/.."
|
||||
|
||||
@@ -45,10 +56,6 @@ function build() {
|
||||
RELEASE_DIR="target/${TARGET}/release"
|
||||
TARGET_FEATURES="${features[@]}"
|
||||
|
||||
if [[ "$TARGET" == *"-linux-"* || "$TARGET" == *"-darwin" ]]; then
|
||||
TARGET_FEATURES+=" local-redir local-tun"
|
||||
fi
|
||||
|
||||
if [[ "${TARGET_FEATURES}" != "" ]]; then
|
||||
echo "* Building ${TARGET} package ${VERSION} with features \"${TARGET_FEATURES}\" ..."
|
||||
|
||||
@@ -75,7 +82,7 @@ function build() {
|
||||
|
||||
cd ${RELEASE_DIR}
|
||||
|
||||
if [[ "$TARGET" == "mips"* ]]; then
|
||||
if [[ "${use_upx}" = true ]]; then
|
||||
# Enable upx for MIPS.
|
||||
$upx sslocal ssserver ssurl ssmanager #>/dev/null
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use std::{io, marker::Unpin};
|
||||
|
||||
use bytes::BytesMut;
|
||||
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
||||
use tun::platform::Device as TunDevice;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user