wget-for-windows CI #254
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: wget-for-windows CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
bits: [64] | |
ftype: [wintls-static-lite,openssl-lite] | |
fail-fast: false | |
name: wget-wintls | |
runs-on: windows-latest | |
env: | |
mingw: mingw${{matrix.bits}} | |
build_type: ${{matrix.ftype}} | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: Set up ENVs for MSYS2 to inherit | |
shell: bash | |
run: | | |
arch="x86_64" | |
BRoot="${PWD}" | |
BDir="build/${build_type}/${mingw}" | |
CDir="${BDir}-config" | |
echo arch="$arch" >> $GITHUB_ENV | |
echo BRoot="$BRoot" >> $GITHUB_ENV | |
echo BDir="$BDir" >> $GITHUB_ENV | |
echo CDir="$CDir" >> $GITHUB_ENV | |
- name: Set up MSYS2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{env.mingw}} | |
release: false | |
install: >- | |
pkgconf | |
base-devel | |
gperf | |
autoconf | |
automake | |
autoconf-archive | |
git | |
python | |
libcares-devel | |
mingw-w64-${{env.arch}}-gpgme | |
mingw-w64-${{env.arch}}-gcc | |
mingw-w64-${{env.arch}}-gettext | |
mingw-w64-${{env.arch}}-openssl | |
# 克隆指定的仓库 | |
- name: Clone wget repository | |
run: git clone --branch mydev https://github.com/lifenjoiner/wget-for-windows.git wget | |
- name: Generate configure | |
run: | | |
cd wget # 进入克隆的仓库目录 | |
./bootstrap --skip-po | |
sed -i "s/-dirty\b//p" configure | |
- name: Install win-iconv (Build) | |
run: | | |
git clone -j$(nproc) https://github.com/gajgeospatial/win-iconv-1.0.0.git win-iconv | |
cd win-iconv | |
make -E CFLAGS=-Os prefix=/$mingw install | |
cd .. | |
- name: configure | |
run: | | |
mkdir -p $BDir | |
mkdir -p $CDir | |
cd $CDir | |
export CFLAGS+=" -Wall -DGNULIB_defined_ESOCK" | |
if [ "${{matrix.ftype}}" = "wintls-static-lite" ]; then | |
CFLAGS+=" -D_WIN32_WINNT=0x0600 -Os" LDFLAGS="-static -s" $BRoot/wget/configure --prefix=$BRoot/$BDir --disable-debug --disable-rpath --disable-nls --without-libpsl --without-metalink --disable-pcre --disable-pcre2 --with-winidn --enable-threads=windows | |
elif [ "${{matrix.ftype}}" = "openssl-lite" ]; then | |
CFLAGS+=" -Os" LDFLAGS="-static -s" $BRoot/wget/configure --prefix=$BRoot/$BDir --with-ssl=openssl --disable-debug --disable-rpath --disable-nls --without-libpsl --without-metalink --disable-pcre --disable-pcre2 --with-winidn --enable-threads=windows | |
fi | |
- name: Build | |
run: | | |
cd $CDir | |
echo -e "all:\n\n" > gnulib_po/Makefile | |
make -j$(nproc) | |
strip ${PWD}/src/wget.exe | |
cp -fv ${PWD}/src/wget.exe ${PWD}/src/wget-${{matrix.ftype}}.exe | |
- name: Show compiled wget info | |
run: | | |
ls -l $CDir/src/wget-${{matrix.ftype}}.exe | |
SHA=$(sha1sum $CDir/src/wget-${{matrix.ftype}}.exe | cut -b 1-40) | |
echo SHA="$SHA" >> $GITHUB_ENV | |
$CDir/src/wget -V | |
- name: Upload wget | |
uses: actions/upload-artifact@v4 | |
if: ${{success()}} || ${{failure()}} | |
with: | |
name: wget-${{env.mingw}}-${{env.build_type}}_${{env.SHA}} | |
path: | | |
${{env.CDir}}/src/wget-${{matrix.ftype}}.exe | |
- name: Get version number | |
run: | | |
VERSION=$(cat ${{env.CDir}}/.version) | |
echo "wget_VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: wget-${{ env.wget_VERSION }} | |
allowUpdates: true | |
artifacts: "${{env.CDir}}/src/wget-${{matrix.ftype}}.exe" | |
token: ${{ secrets.GITHUB_TOKEN }} |