Skip to content

Commit

Permalink
Add Windows Autobuild CI (tindy2013#91)
Browse files Browse the repository at this point in the history
* Add Windows x64 Build to Actions

Clean up build scripts.

* Add build-time dependency

Fix v2ray release package name.

* Fix CURL library usage in CMakeLists

Fix wrong package name.

* Fix typo

* Fix wrong clients install path

* Change order of dependency builds

* Fix libev-mingw download URL

* Use another download URL of libev

* Fix typo

* Add CFLAGS for stack protector

* Add unzip package install

* Clean up scripts

Fix websocketd not found on building Windows clients.
Fix v2ray-plugin unpack failed on building Linux ARMHF clients.

* Add Windows Build to Travis CI

Add Windows x86 Build to Actions.
Clean up scripts.

* Rename calling clients

Add downloading Shadowsocks(R)-Windows clients.

* Add build for icon resource on Windows

* Fix dependency problem

Fix stripping websocketd will break the program.
  • Loading branch information
tindy2013 committed Sep 8, 2020
1 parent 760b473 commit c34981d
Show file tree
Hide file tree
Showing 10 changed files with 307 additions and 55 deletions.
60 changes: 53 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ jobs:
- name: Build
run: |
docker run -v $GITHUB_WORKSPACE:/root/workdir -e TRAVIS_BRANCH=action -e TRAVIS_TAG=action multiarch/alpine:x86-latest-stable /bin/sh -c "apk add bash git && cd /root/workdir && bash scripts/build.alpine.release.sh"
tar czf stairspeedtest_reborn_linux32.tar.gz stairspeedtest
- name: Upload
uses: actions/upload-artifact@v2
with:
name: stairspeedtest_reborn_linux32
path: stairspeedtest_reborn_linux32.tar.gz
path: stairspeedtest/

linux64_build:
name: Linux x86_64 Build
Expand All @@ -25,12 +24,11 @@ jobs:
- name: Build
run: |
docker run -v $GITHUB_WORKSPACE:/root/workdir -e TRAVIS_BRANCH=action -e TRAVIS_TAG=action multiarch/alpine:amd64-latest-stable /bin/sh -c "apk add bash git && cd /root/workdir && bash scripts/build.alpine.release.sh"
tar czf stairspeedtest_reborn_linux64.tar.gz stairspeedtest
- name: Upload
uses: actions/upload-artifact@v2
with:
name: stairspeedtest_reborn_linux64
path: stairspeedtest_reborn_linux64.tar.gz
path: stairspeedtest/

macos_build:
name: macOS Build
Expand All @@ -39,10 +37,58 @@ jobs:
- uses: actions/checkout@v2
- name: Build
run: |
TRAVIS_BRANCH=action TRAVIS_TAG=action bash scripts/build.macos.release.sh
tar czf stairspeedtest_reborn_darwin64.tar.gz stairspeedtest
bash scripts/build.macos.release.sh
bash scripts/build.macos.clients.sh
mv base stairspeedtest
- name: Upload
uses: actions/upload-artifact@v2
with:
name: stairspeedtest_reborn_darwin64
path: stairspeedtest_reborn_darwin64.tar.gz
path: stairspeedtest/

windows64_build:
name: Windows x86_64 Build
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
with:
update: true
install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-bzip2 mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls mingw-w64-x86_64-libsodium mingw-w64-x86_64-c-ares mingw-w64-x86_64-boost mingw-w64-x86_64-libmariadbclient unzip p7zip
- name: Build
run: |
bash scripts/build.windows.release.sh
bash scripts/build.windows.clients.sh
mv base stairspeedtest
- name: Upload
uses: actions/upload-artifact@v1
with:
name: stairspeedtest_reborn_win64
path: stairspeedtest/
windows32_build:
name: Windows x86 Build
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
with:
update: true
install: base-devel git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-libevent mingw-w64-i686-pcre2 mingw-w64-i686-freetype mingw-w64-i686-libpng mingw-w64-i686-bzip2 mingw-w64-i686-openssl mingw-w64-i686-mbedtls mingw-w64-i686-libsodium mingw-w64-i686-c-ares mingw-w64-i686-boost mingw-w64-i686-libmariadbclient unzip p7zip
msystem: MINGW32
- name: Build
run: |
bash scripts/build.windows.release.sh
bash scripts/build.windows.clients.sh
mv base stairspeedtest
- name: Upload
uses: actions/upload-artifact@v1
with:
name: stairspeedtest_reborn_win32
path: stairspeedtest/

75 changes: 75 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ matrix:
script:
- bash scripts/build.macos.release.sh
before_deploy:
- bash scripts/build.macos.clients.sh
- tar czf stairspeedtest_reborn_darwin64.tar.gz stairspeedtest
deploy:
provider: releases
Expand Down Expand Up @@ -76,3 +77,77 @@ matrix:
draft: true
on:
tags: true
- name: "Windows x86_64 Build"
os: windows
before_install:
- |-
[[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64
choco uninstall -y mingw
choco upgrade --no-progress -y msys2
export msys2='cmd //C RefreshEnv.cmd '
export msys2+='& set MSYS=winsymlinks:nativestrict '
export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start'
export mingw64="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --"
export msys2+=" -msys2 -c "\"\$@"\" --"
$msys2 pacman --sync --noconfirm --needed base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-bzip2 mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls mingw-w64-x86_64-libsodium mingw-w64-x86_64-c-ares mingw-w64-x86_64-boost mingw-w64-x86_64-libmariadbclient unzip
taskkill //IM gpg-agent.exe //F
export PATH=/C/tools/msys64/mingw64/bin:$PATH
export MAKE=make
before_cache:
- |-
$msys2 pacman --sync --clean --noconfirm
cache:
directories:
- $HOME/AppData/Local/Temp/chocolatey
- /C/tools/msys64
script:
- $mingw64 bash scripts/build.windows.release.sh
before_deploy:
- $mingw64 bash scripts/build.windows.clients.sh
- mv base stairspeedtest
- 7z a stairspeedtest_reborn_win64.7z stairspeedtest/
deploy:
provider: releases
token: "$GITHUB_OAUTH_TOKEN"
file: "stairspeedtest_reborn_win64.7z"
skip_cleanup: true
draft: true
on:
tags: true
- name: "Windows x86 Build"
os: windows
before_install:
- |-
[[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64
choco uninstall -y mingw
choco upgrade --no-progress -y msys2
export msys2='cmd //C RefreshEnv.cmd '
export msys2+='& set MSYS=winsymlinks:nativestrict '
export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start'
export mingw32="$msys2 -mingw32 -full-path -here -c "\"\$@"\" --"
export msys2+=" -msys2 -c "\"\$@"\" --"
$msys2 pacman --sync --noconfirm --needed base-devel git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-libevent mingw-w64-i686-pcre2 mingw-w64-i686-freetype mingw-w64-i686-libpng mingw-w64-i686-bzip2 mingw-w64-i686-openssl mingw-w64-i686-mbedtls mingw-w64-i686-libsodium mingw-w64-i686-c-ares mingw-w64-i686-boost mingw-w64-i686-libmariadbclient unzip
taskkill //IM gpg-agent.exe //F
export PATH=/C/tools/msys64/mingw64/bin:$PATH
export MAKE=make
before_cache:
- |-
$msys2 pacman --sync --clean --noconfirm
cache:
directories:
- $HOME/AppData/Local/Temp/chocolatey
- /C/tools/msys64
script:
- $mingw32 bash scripts/build.windows.release.sh
before_deploy:
- $mingw32 bash scripts/build.windows.clients.sh
- mv base stairspeedtest
- 7z a stairspeedtest_reborn_win32.7z stairspeedtest/
deploy:
provider: releases
token: "$GITHUB_OAUTH_TOKEN"
file: "stairspeedtest_reborn_win32.7z"
skip_cleanup: true
draft: true
on:
tags: true
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ INCLUDE_DIRECTORIES(${LIBEVENT_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(stairspeedtest ${LIBEVENT_LIBRARY})

FIND_PACKAGE(CURL 7.54.0 REQUIRED)
LINK_DIRECTORIES(${CURL_LIBRARY_DIRS})
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(stairspeedtest ${CURL_LIBRARIES})
TARGET_LINK_LIBRARIES(stairspeedtest CURL::libcurl)
ADD_DEFINITIONS(-DCURL_STATICLIB)

FIND_PACKAGE(OpenSSL 1.1.0 REQUIRED)
Expand Down
6 changes: 6 additions & 0 deletions base/webgui.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
chcp 65001>nul
title Stair Speedtest Web GUI Backend
setlocal enabledelayedexpansion
start http://127.0.0.1:65430/gui.html
tools\gui\websocketd --port=65430 --maxforks=1 --staticdir=tools\gui stairspeedtest /rpc
35 changes: 17 additions & 18 deletions scripts/build.alpine.clients.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,38 @@ apk add openssl-dev openssl-libs-static libev-dev pcre-dev libsodium-dev libsodi

git clone https://github.com/shadowsocks/simple-obfs --depth=1
cd simple-obfs
git submodule init
git submodule update
git submodule update --init
./autogen.sh
./configure --disable-documentation
make -j4
cd src
gcc obfs_local*.o ../libcork/.libs/libcork.a -o simple-obfs -lev -s -static
mv simple-obfs ../../base/tools/clients/
cd ../..
gcc $(find src/ -name "obfs_local-*.o") $(find . -name "*.a") -o simple-obfs -static -lev -s
mv simple-obfs ../base/tools/clients/
cd ..

git clone https://github.com/shadowsocks/shadowsocks-libev --depth=1
cd shadowsocks-libev
git submodule update --init
./autogen.sh
./configure --disable-documentation
make -j4
cd src
gcc ss_local*.o .libs/libshadowsocks-libev.a -o ss-local -lpcre -lmbedtls -lmbedcrypto -lev -lsodium -s -static
mv ss-local ../../base/tools/clients/
cd ../..
gcc $(find src/ -name "ss_local-*.o") $(find . -name "*.a") -o ss-local -static -lpcre -lmbedtls -lmbedcrypto -lev -lsodium -s
mv ss-local ../base/tools/clients/
cd ..

git clone -b Akkariiin/develop --single-branch --depth=1 https://github.com/shadowsocksrr/shadowsocksr-libev
cd shadowsocksr-libev
./autogen.sh
./configure --disable-documentation
make -j4
cd src
gcc ss_local*.o .libs/libshadowsocks-libev.a ../libudns/.libs/libudns.a -o ssr-local -lpcre -lssl -lcrypto -lev -lsodium -s -static
mv ssr-local ../../base/tools/clients/
cd ../..
gcc $(find src/ -name "ss_local-*.o") $(find . -name "*.a") -o ssr-local -static -lpcre -lssl -lcrypto -lev -lsodium -s
mv ssr-local ../base/tools/clients/
cd ..

git clone https://github.com/trojan-gfw/trojan --depth=1
cd trojan
cmake -DDEFAULT_CONFIG=config.json -DFORCE_TCP_FASTOPEN=ON .
make -j4
g++ CMakeFiles/trojan.dir/src/*.o CMakeFiles/trojan.dir/src/core/*.o CMakeFiles/trojan.dir/src/proto/*.o CMakeFiles/trojan.dir/src/session/*.o CMakeFiles/trojan.dir/src/ssl/*.o -o trojan -static -lmysqlclient -lboost_program_options -lssl -lcrypto -lz -s
g++ $(find CMakeFiles/trojan.dir/src/ -name "*.o") -o trojan -static -lmysqlclient -lboost_program_options -lssl -lcrypto -lz -s
mv trojan ../base/tools/clients/
cd ..

Expand All @@ -70,10 +66,13 @@ fi

unzip v2ray*.zip v2ray v2ctl
unzip websocketd*.zip websocketd
tar xvf v2ray-plugin*.gz
rm v2ray-plugin*.gz
if [[ "$ARCH" = "armhf" ]];then
tar xvf v2ray-plugin*.gz v2ray-plugin_linux_arm7
else
tar xvf v2ray-plugin*.gz
fi
strip -s websocketd
mv v2ray-plugin* base/tools/clients/v2ray-plugin
mv v2ray-plugin_* base/tools/clients/v2ray-plugin
mv v2ray base/tools/clients/
mv v2ctl base/tools/clients/
mv websocketd base/tools/gui/
Expand Down
9 changes: 4 additions & 5 deletions scripts/build.macos.clients.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ cc -Xlinker -unexported_symbol -Xlinker "*" ss_local*.o .libs/libshadowsocks-lib
mv ssr-local ../../base/tools/clients
cd ../..

curl -LO https://github.com/v2ray/v2ray-core/releases/latest/download/v2ray-macos.zip
unzip v2ray-macos.zip v2ray v2ctl
mv v2ray base/tools/clients
mv v2ctl base/tools/clients
curl -LO https://github.com/v2ray/v2ray-core/releases/latest/download/v2ray-macos-64.zip
unzip v2ray*.zip v2ray v2ctl
mv v2ray v2ctl base/tools/clients/

curl -LO https://github.com/trojan-gfw/trojan/releases/download/v1.15.1/trojan-1.15.1-macos.zip
unzip trojan*.zip trojan/trojan
mv trojan/trojan base/tools/clients
mv trojan/trojan base/tools/clients/

curl -LO https://github.com/joewalnes/websocketd/releases/download/v0.3.0/websocketd-0.3.0-darwin_amd64.zip
unzip websocketd-0.3.0-darwin_amd64.zip websocketd
Expand Down
10 changes: 0 additions & 10 deletions scripts/build.macos.release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,4 @@ make -j8
rm stairspeedtest
c++ -Xlinker -unexported_symbol -Xlinker "*" -o base/stairspeedtest -framework CoreFoundation -framework Security $(find CMakeFiles/stairspeedtest.dir/src/ -name "*.o") $(find . -name "*.a") -lcurl -ldl -lpthread -O3

if [ "$TRAVIS_BRANCH" = "$TRAVIS_TAG" ];then
bash scripts/build.macos.clients.sh

cd base
chmod +rx stairspeedtest *.sh
chmod +r *
cd ..
mv base stairspeedtest
fi

set +xe
93 changes: 93 additions & 0 deletions scripts/build.windows.clients.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/bash
set -xe
mkdir base/tools/clients

curl -LO https://github.com/shadowsocks/libev/archive/mingw.tar.gz
tar xvf mingw.tar.gz
cd libev-mingw
./configure --prefix=$MINGW_PREFIX
make install -j4
cd ..

git clone https://github.com/shadowsocks/simple-obfs --depth=1
cd simple-obfs
git submodule update --init
./autogen.sh
./configure --disable-documentation
make -j4
gcc $(find src/ -name "obfs_local-*.o") $(find . -name "*.a" ! -name "*.dll.a") -o simple-obfs -fstack-protector -static -lev -lws2_32 -s
mv simple-obfs.exe ../base/tools/clients/
cd ..

git clone https://github.com/shadowsocks/shadowsocks-libev --depth=1
cd shadowsocks-libev
git submodule update --init
./autogen.sh
./configure --disable-documentation

# fix codes
sed -i "s/%I/%z/g" src/utils.h

make -j4
gcc $(find src/ -name "ss_local-*.o") $(find . -name "*.a" ! -name "*.dll.a") -o ss-local -fstack-protector -static -lev -lws2_32 -lsodium -lmbedtls -lmbedcrypto -lpcre
mv ss-local.exe ../base/tools/clients/
cd ..

git clone -b Akkariiin/develop --single-branch --depth=1 https://github.com/shadowsocksrr/shadowsocksr-libev
cd shadowsocksr-libev

# build ahead to reconfigure
cd libudns
./autogen.sh
./configure
make -j4
cd ..

./autogen.sh
CFLAGS+="-fstack-protector" ./configure --disable-documentation

# fix codes
sed -i "s/^const/extern const/g" src/tls.h
sed -i "s/^const/extern const/g" src/http.h

make -j4
gcc $(find src/ -name "ss_local-*.o") $(find . -name "*.a" ! -name "*.dll.a") -o ssr-local -fstack-protector -static -lpcre -lssl -lcrypto -lev -lws2_32 -s
mv ssr-local.exe ../base/tools/clients/
cd ..

git clone https://github.com/trojan-gfw/trojan --depth=1
cd trojan
cmake -DMYSQL_INCLUDE_DIR=$MINGW_PREFIX/include/mysql -G "Unix Makefiles" .
make -j4
g++ -o trojan $(find CMakeFiles/trojan.dir/src/ -name "*.obj") -static -lmysqlclient -lssl -lcrypto -lz -lws2_32 -lwsock32 -lboost_program_options-mt -lcrypt32 -lsecur32 -lshlwapi -s
mv trojan.exe ../base/tools/clients/
cd ..

if [[ "$MSYSTEM" = "MINGW64" ]];then
curl -LO https://github.com/v2ray/v2ray-core/releases/latest/download/v2ray-windows-64.zip
curl -LO https://github.com/joewalnes/websocketd/releases/download/v0.3.1/websocketd-0.3.1-windows_amd64.zip
curl -LO https://github.com/shadowsocks/v2ray-plugin/releases/download/v1.3.1/v2ray-plugin-windows-amd64-v1.3.1.tar.gz
fi
if [[ "$MSYSTEM" = "MINGW32" ]];then
curl -LO https://github.com/v2ray/v2ray-core/releases/latest/download/v2ray-windows-32.zip
curl -LO https://github.com/joewalnes/websocketd/releases/download/v0.3.1/websocketd-0.3.1-windows_386.zip
curl -LO https://github.com/shadowsocks/v2ray-plugin/releases/download/v1.3.1/v2ray-plugin-windows-386-v1.3.1.tar.gz
fi

curl -LO https://github.com/shadowsocks/shadowsocks-windows/releases/download/4.1.10.0/Shadowsocks-4.1.10.0.zip
unzip Shadowsocks-4.1.10.0.zip Shadowsocks.exe
mv Shadowsocks.exe base/tools/clients/shadowsocks-win.exe

curl -LO https://github.com/shadowsocksrr/shadowsocksr-csharp/releases/download/4.9.2/ShadowsocksR-win-4.9.2.zip
7z x ShadowsocksR-win-4.9.2.zip ShadowsocksR-win-4.9.2/ShadowsocksR-dotnet2.0.exe
mv ShadowsocksR-win-4.9.2/ShadowsocksR-dotnet2.0.exe base/tools/clients/shadowsocksr-win.exe

unzip v2ray*.zip v2ray.exe v2ctl.exe
unzip websocketd*.zip websocketd
tar xvf v2ray-plugin*.gz
rm v2ray-plugin*.gz
mv v2ray-plugin* base/tools/clients/v2ray-plugin.exe
mv v2ray.exe v2ctl.exe base/tools/clients/
mv websocketd base/tools/gui/websocketd.exe

set +xe
Loading

0 comments on commit c34981d

Please sign in to comment.