nightly and release build with local-tun

This commit is contained in:
zonyitoo
2021-09-02 04:02:25 +08:00
parent c0b0d7c554
commit d553554aa3
4 changed files with 39 additions and 13 deletions
+11 -1
View File
@@ -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
+11 -1
View File
@@ -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
View File
@@ -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;