Skip to content

CI: upload release

CI: upload release #85

name: Ubuntu
on: [push, pull_request]
jobs:
build:
# https://docs.github.com/en/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
strategy:
matrix:
ftype: [full, lite]
fail-fast: false
# https://github.com/actions/virtual-environments
name: ${{matrix.ftype}}
runs-on: ubuntu-latest
steps:
- name: Set up ENVs to inherit
run: |
BRoot="${PWD}"
BDir="build/${{matrix.ftype}}"
CDir="${BDir}-config"
echo BRoot="$BRoot" >> $GITHUB_ENV
echo BDir="$BDir" >> $GITHUB_ENV
echo CDir="$CDir" >> $GITHUB_ENV
- name: Set up toolset
# `AX_CODE_COVERAGE` requires autoconf-archive: https://github.com/google/oss-fuzz/pull/5379/files
# gpgme for metalink, but depends on many others, that's not preferred on windows
# gettext for NLS, expat for metalink, libidn2 and libunistring for libpsl
# https://packages.ubuntu.com/
run: |
sudo apt-get update
sudo apt-get install -y \
gperf \
autopoint \
autoconf \
automake \
autoconf-archive \
git \
python3 \
gcc \
libidn2-dev \
libgpgme-dev \
libwww-perl \
libio-socket-ssl-perl
- name: Show setup result
run: |
echo "bash --version"
bash --version
echo "gcc -v"
gcc -v
git --version
python -V
python -c "import sys; print(sys.executable)"
python3 -V
python3 -c "import sys; print(sys.executable)"
perl -e 'print $^O . "\n"'
pwd
echo "PATH"
echo "$BRoot"
echo "$BDir"
echo "$CDir"
- uses: actions/checkout@v4
# Shallow fetch makes version unknown: git describe --abbrev=4 --match="$prefix*" HEAD
with:
fetch-depth: 0
# gettext-0.20 issue: https://github.com/coreutils/gnulib/blob/master/build-aux/po/Makefile.in.in#L11
# gettext and gettext-devel may be not available yet.
- name: Generate configure
run: |
loc_ver=$(gettext -V | sed -n "s/gettext[^0-9]\+\([0-9.]\+\).*/\1/p")
req_ver=$(sed -n "s/^\gettext\s\+\([0-9.]\+\)$/\1/mp" bootstrap.conf)
if [ -n "${req_ver}" ] && [ ${loc_ver} \< ${req_ver} ]; then
echo "Reset gettext version: bootstrap.conf requires "${req_ver}", local is "${loc_ver}
sed -i "s/^\(gettext\s\+\)[0-9.]\+$/\1${loc_ver}/gm" bootstrap.conf
fi
req_ver=$(sed -n "s/^AM_GNU_GETTEXT_VERSION(\[\([0-9.]\+\)\])$/\1/mp" configure.ac)
if [ -n "${req_ver}" ] && [ ${loc_ver} \< ${req_ver} ]; then
echo "Reset gettext version: configure.ac requires "${req_ver}", local is "${loc_ver}
sed -i "s/^\(AM_GNU_GETTEXT_VERSION(\[\)[0-9.]\+\(\])\)$/\1${loc_ver}\2/gm" configure.ac
fi
./bootstrap --skip-po
sed -i "s/-dirty\b//p" configure
# -->
- name: Install extra dependencies
run: |
if [ "${{matrix.ftype}}" = "full" ]; then
wget https://github.com/c-ares/c-ares/releases/download/cares-1_19_0/c-ares-1.19.0.tar.gz
tar -xvzf c-ares-1.19.0.tar.gz
cd c-ares-1.19.0
./configure --prefix=/usr --disable-tests
sudo make install
cd ..
wget https://github.com/metalink-dev/libmetalink/releases/download/release-0.1.3/libmetalink-0.1.3.tar.gz
tar -xvzf libmetalink-0.1.3.tar.gz
cd libmetalink-0.1.3
./configure --prefix=/usr --disable-xmltest
sudo make install
fi
- name: configure
run: |
mkdir -p $BDir
mkdir -p $CDir
cd $CDir
pwd
export CFLAGS+=" -Wall"
if [ "${{matrix.ftype}}" = "full" ]; then
CFLAGS+=" -O2" $BRoot/configure --prefix=/usr --with-ssl=openssl --with-cares --with-metalink
elif [ "${{matrix.ftype}}" = "lite" ]; then
CFLAGS+=" -Os" LDFLAGS="-s" $BRoot/configure --prefix=/usr --with-ssl=openssl --disable-debug --without-libpsl --without-cares --without-metalink --disable-pcre --disable-pcre2
fi
# <--
# gnulib_po gettext requires gettext version 0.20 higher env can have!
- name: Build
run: |
cd $CDir
echo -e "all:\n\n" > gnulib_po/Makefile
make
- name: Show compiled wget info
run: |
ls -l $CDir/src/wget
$CDir/src/wget -V
- name: fuzz
run: |
cd $CDir/fuzz
make check
- name: testenv
if: ${{success()}} || ${{failure()}}
run: |
cd $CDir/testenv
make check
timeout-minutes: 5 # in case of stuck
- name: tests
if: ${{success()}} || ${{failure()}}
run: |
cd $CDir/tests
make check
timeout-minutes: 5 # in case of stuck
- name: Upload wget
uses: actions/upload-artifact@v4
if: ${{success()}} || ${{failure()}}
with:
name: wget-${{runner.os}}-${{matrix.ftype}}
path: |
${{env.CDir}}/src/wget
- name: Upload logs
uses: actions/upload-artifact@v4
if: ${{failure()}}
with:
name: wget-${{runner.os}}-${{matrix.ftype}}-logs
# Previous steps can be stuck and then timeout, so all `.log` files and sub-folders.
path: |
${{env.CDir}}/config.log
${{env.CDir}}/fuzz/*.log
${{env.CDir}}/testenv/
${{env.CDir}}/tests/*.log
${{env.CDir}}/tests/Makefile
${{env.CDir}}/tests/**/
!${{env.CDir}}/tests/.deps/
!${{env.CDir}}/tests/unit-tests
!${{env.CDir}}/tests/*.o