Add Windows Autobuild CI (#244)

* Add Windows x64 CI

* Add missing dependency

* Fix rapidjson build

* Add Windows build to Travis CI

Add Windows x86 build to GitHub Actions

* Fix mingw32-make not found

* Fix subsystem on Actions

Fix install prefix on Travis CI.

* Use MINGW_PREFIX instead of /usr

* Clean up scripts

Add Windows x86 build to Travis CI.
This commit is contained in:
Tindy X
2020-09-07 20:08:19 +08:00
committed by GitHub
parent 10c3d2f35e
commit abe03cebeb
4 changed files with 154 additions and 2 deletions

View File

@@ -40,3 +40,44 @@ jobs:
with:
name: subconverter_darwin64
path: subconverter/
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 python2 python2-pip
- name: Build
run: bash scripts/build.windows.release.sh
- name: Upload
uses: actions/upload-artifact@v1
with:
name: subconverter_win64
path: subconverter/
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 python2 python2-pip
msystem: MINGW32
- name: Build
run: bash scripts/build.windows.release.sh
- name: Upload
uses: actions/upload-artifact@v1
with:
name: subconverter_win32
path: subconverter/

View File

@@ -80,4 +80,74 @@ jobs:
skip_cleanup: true
draft: true
on:
tags: true
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 python2 python2-pip
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:
- 7z a subconverter_win64.7z subconverter/
deploy:
provider: releases
token: "$GITHUB_OAUTH_TOKEN"
file: "subconverter_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 python2 python2-pip
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:
- 7z a subconverter_win32.7z subconverter/
deploy:
provider: releases
token: "$GITHUB_OAUTH_TOKEN"
file: "subconverter_win32.7z"
skip_cleanup: true
draft: true
on:
tags: true

View File

@@ -6,7 +6,7 @@ apk add mbedtls-dev mbedtls-static zlib-dev rapidjson-dev libevent-dev libevent-
git clone https://github.com/curl/curl --depth=1
cd curl
cmake -DCMAKE_USE_MBEDTLS=ON -DHTTP_ONLY=ON -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_USE_LIBSSH2=OFF . > /dev/null
cmake -DCMAKE_USE_MBEDTLS=ON -DHTTP_ONLY=ON -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_USE_LIBSSH2=OFF -DBUILD_CURL_EXE=OFF . > /dev/null
make install -j2 > /dev/null
cd ..

View File

@@ -0,0 +1,41 @@
#!/bin/bash
set -xe
git clone https://github.com/curl/curl --depth=1
cd curl
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_USE_LIBSSH2=OFF -DHTTP_ONLY=ON -DCMAKE_USE_SCHANNEL=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CURL_EXE=OFF -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX -G "Unix Makefiles" .
make install -j4
cd ..
git clone https://github.com/jbeder/yaml-cpp --depth=1
cd yaml-cpp
cmake -DCMAKE_BUILD_TYPE=Release -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX -G "Unix Makefiles" .
make install -j4
cd ..
git clone https://github.com/svaarala/duktape --depth=1
cd duktape
pip2 install PyYAML
mkdir dist
python2 util/dist.py
cd dist/source/src
gcc -c -O3 -o duktape.o duktape.c
gcc -c -O3 -o duk_module_node.o -I. ../extras/module-node/duk_module_node.c
ar cr libduktape.a duktape.o
ar cr libduktape_module.a duk_module_node.o
install -m0644 ./*.a $MINGW_PREFIX/lib
install -m0644 ./duk*.h $MINGW_PREFIX/include
install -m0644 ../extras/module-node/duk_module_node.h $MINGW_PREFIX/include
cd ../../../..
git clone https://github.com/Tencent/rapidjson --depth=1
cd rapidjson
cmake -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX -G "Unix Makefiles" .
make install -j4
cd ..
cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" .
make -j4
rm subconverter.exe
g++ $(find CMakeFiles/subconverter.dir/src -name "*.obj") curl/lib/libcurl.a -o base/subconverter.exe -static -levent -lpcre2-8 -lduktape -lduktape_module -lyaml-cpp -lcrypt32 -lws2_32 -lwsock32 -lz -s
mv base subconverter