chore: debug #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Binary | |
on: | |
push: | |
branches: | |
- build | |
watch: | |
types: [started] | |
jobs: | |
build: | |
if: github.event.repository.owner.id == github.event.sender.id | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-10.11] | |
# arch: [amd64, arm64] | |
arch: [amd64, arm64, ppc64le, s390x, 386, arm] | |
steps: | |
- name: Check Out Branch | |
uses: actions/checkout@master | |
with: | |
ref: build | |
- name: Linux Build | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt install -y screen | |
mkdir ./artifact | |
arch=${{ matrix.arch }} | |
screen -dmS "pack_$arch" bash -c "nc -l 9999 > aria2c && chmod a+x aria2c && tar cvf $(pwd)/artifact/aria2c-linux-$arch.tar aria2c"; | |
HOST=$(ip -4 address|grep docker|grep -oE '([0-9]+\.){3}[0-9]+'|grep -v 255) | |
docker run --rm --privileged tonistiigi/binfmt:latest --install all | |
docker buildx create --use --name=multibulider --driver docker-container --driver-opt image=moby/buildkit:master | |
docker buildx use multibulider | |
docker buildx build --build-arg HOST=${HOST} --platform linux/${arch} -t aria2 . | |
- name: macOS Build | |
if: ${{ runner.os == 'macOS' && matrix.arch == 'amd64' }} | |
run: | | |
brew install cppunit gettext openssl libssh2 c-ares sqlite3 \ | |
autoconf automake pkg-config libtool libuv libxml2 zlib upx libuv | |
(cd ..; | |
curl -L https://c-ares.haxx.se/download/c-ares-1.17.2.tar.gz -o c-ares.tar.gz; | |
tar xf c-ares.tar.gz; | |
cd c-ares-*; | |
./configure --disable-shared; | |
make -j`sysctl -n machdep.cpu.thread_count`; | |
make install -j`sysctl -n machdep.cpu.thread_count`;) | |
git checkout build | |
autoreconf -i; | |
export LDFLAGS="-L/usr/local/opt/libxml2/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/sqlite3/lib -L/usr/local/lib -L/usr/local/opt/libuv/lib"; | |
export CPPFLAGS="-I/usr/local/opt/libxml2/include -I/usr/local/opt/zlib/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite3/include -I/usr/local/include -I/usr/local/opt/libuv/include"; | |
export PKG_CONFIG_PATH="/usr/local/opt/sqlite3/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig:/usr/local/opt/[email protected]/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/opt/libuv/lib/pkgconfig"; | |
export CC=clang | |
export CXX=clang++ | |
sudo rm -fr /usr/local/opt/libxml2/lib/*.dylib /usr/local/opt/libssh2/lib/*.dylib /usr/local/opt/[email protected]/lib/*.dylib /usr/local/opt/[email protected]/lib/*.dylib \ | |
/usr/local/opt/c-ares/lib/*.dylib /usr/local/opt/gettext/lib/*.dylib /usr/local/opt/sqlite/lib/*.dylib /usr/local/opt/zlib/lib/*.dylib /usr/local/opt/libuv/lib/*.dylib || true; | |
./configure \ | |
--prefix=/usr/local \ | |
--without-appletls \ | |
--without-gnutls \ | |
--with-openssl \ | |
--with-libuv \ | |
--with-libssh2 \ | |
--with-sqlite3 \ | |
--with-ca-bundle='/usr/local/etc/openssl/cert.pem' \ | |
ARIA2_STATIC=yes \ | |
--enable-shared=no | |
make -j`sysctl -n machdep.cpu.thread_count` | |
strip src/aria2c | |
upx src/aria2c | |
mkdir ./artifact/ | |
mv src/aria2c ./aria2c | |
tar cf ./artifact/aria2c-macos-amd64.tar aria2c | |
- name: upload macOS aria2c | |
if: ${{ runner.os == 'macOS' && matrix.arch == 'amd64' }} | |
uses: actions/upload-artifact@master | |
with: | |
name: aria2c-macos-${{ matrix.arch }} | |
path: ./artifact/ | |
- name: upload Linux aria2c | |
if: runner.os == 'Linux' | |
uses: actions/upload-artifact@master | |
with: | |
name: aria2c-linux-${{ matrix.arch }} | |
path: ./artifact/ | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set Build Date | |
run: echo "ReleaseVersion=`date +%Y%m%d`" >> $GITHUB_ENV | |
- name: Retrieve aria2c-macos-amd64 | |
uses: actions/download-artifact@master | |
with: | |
name: aria2c-macos-amd64 | |
path: ./artifact | |
- name: Retrieve aria2c-linux-amd64 | |
uses: actions/download-artifact@master | |
with: | |
name: aria2c-linux-amd64 | |
path: ./artifact | |
- name: Retrieve aria2c-linux-arm64 | |
uses: actions/download-artifact@master | |
with: | |
name: aria2c-linux-arm64 | |
path: ./artifact | |
- name: Retrieve aria2c-linux-ppc64le | |
uses: actions/download-artifact@master | |
with: | |
name: aria2c-linux-ppc64le | |
path: ./artifact | |
- name: Retrieve aria2c-linux-s390x | |
uses: actions/download-artifact@master | |
with: | |
name: aria2c-linux-s390x | |
path: ./artifact | |
- name: Retrieve aria2c-linux-386 | |
uses: actions/download-artifact@master | |
with: | |
name: aria2c-linux-386 | |
path: ./artifact | |
- name: Retrieve aria2c-linux-arm | |
uses: actions/download-artifact@master | |
with: | |
name: aria2c-linux-arm | |
path: ./artifact | |
# - name: SSH 连接到 Actions | |
# uses: P3TERX/ssh2actions@main | |
# env: | |
# TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
# TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
- name: release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: '${{ secrets.GITHUB_TOKEN }}' | |
prerelease: false | |
automatic_release_tag: ${{ env.ReleaseVersion }} | |
title: ${{ env.ReleaseVersion }} | |
files: ./artifact/* |