test on all available runner environments and add autogenerated crossbuilt dpkg packages (#852)

* Make test workflow smoke test use the same internal name as descriptive name

* Refactor workflow to be test_os then build for that OS

* Run tests on all available github runner environments

* Ensure that dpkg builds will fail if the compile fails

* Allow explicitly overriding the debian package architecture

* Pass the detected architecture into the dpkg build process

* Use the possibly overridden MACHINE variable to calculate the short machine name

* Remove unused variable

* Remove unused AC_SUBST

* Allow EXTN to be overridden instead of MACHINE

* Add crossbuilding for dpkg builds

* Ubnuts dont got no crossbuild for mips

* Use the correct value for EXTN
This commit is contained in:
Hamish Coleman 2021-10-14 11:09:19 +01:00 committed by GitHub
parent f5b730baed
commit c3c72e2656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 178 additions and 95 deletions

View File

@ -6,7 +6,7 @@ on:
pull_request:
jobs:
quicktest:
smoketest:
name: Smoke test
runs-on: ubuntu-latest
@ -18,36 +18,136 @@ jobs:
./configure
make test
fulltest:
needs: quicktest
name: Full test
test_linux:
needs: smoketest
name: Test Linux
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- ubuntu-20.04
- ubuntu-18.04
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v2
- if: runner.os == 'Linux'
name: Install essential
- name: Install essential
run: |
sudo apt-get update
sudo apt-get install build-essential
- if: runner.os == 'macOS'
name: Install packages
- name: generate a makefile and use it to install more packages
run: |
brew install automake gcovr
./autogen.sh
./configure
make build-dep
shell: bash
- name: Run the real configure step
run: |
CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="--coverage" ./configure --with-zstd
shell: bash
- name: Run embedded tests
run: make test
shell: bash
- if: ${{ always() }}
name: Upload tests output
uses: actions/upload-artifact@v2
with:
name: tests-out-${{matrix.os}}
path: tests/*.out
- name: Generate coverage reports
run: |
make gcov
make cover
shell: bash
- name: Upload gcovr report artifact
uses: actions/upload-artifact@v2
with:
name: coverage-${{matrix.os}}
path: coverage
- name: Upload data to codecov
uses: codecov/codecov-action@v2
test_macos:
needs: smoketest
name: Test MacOS
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- macos-10.15
- macos-11
steps:
- uses: actions/checkout@v2
- name: Install packages
run: |
brew install automake
- name: generate a makefile and use it to install more packages
run: |
./autogen.sh
./configure
make build-dep
shell: bash
- name: Run the real configure step
run: |
CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="--coverage" ./configure --with-zstd
shell: bash
- name: Run embedded tests
run: make test
shell: bash
- if: ${{ always() }}
name: Upload tests output
uses: actions/upload-artifact@v2
with:
name: tests-out-${{matrix.os}}
path: tests/*.out
- name: Generate coverage reports
run: |
make gcov
make cover
shell: bash
- name: Upload gcovr report artifact
uses: actions/upload-artifact@v2
with:
name: coverage-${{matrix.os}}
path: coverage
- name: Upload data to codecov
uses: codecov/codecov-action@v2
test_windows:
needs: smoketest
name: Test Windows
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- windows-2016
- windows-2019
- windows-2022
steps:
- uses: actions/checkout@v2
- if: runner.os == 'Windows'
# This is a pretty big hammer, but gets the windows compile moving
name: Hack up a fake autoconf
- name: Hack up a fake autoconf
run: |
echo true >autogen.sh
cp scripts/hack_fakeautoconf configure
@ -81,26 +181,21 @@ jobs:
make gcov
shell: bash
- if: runner.os != 'Windows'
name: Generate gcovr report
run: |
make cover
shell: bash
- if: runner.os != 'Windows'
name: Upload gcovr report artifact
uses: actions/upload-artifact@v2
with:
name: coverage-${{matrix.os}}
path: coverage
- name: Upload data to codecov
uses: codecov/codecov-action@v2
package_dpkg:
needs: fulltest
needs: test_linux
name: Package for Debian/Ubuntu
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
arch:
- amd64
- arm64
- armhf
- i386
steps:
- uses: actions/checkout@v2
@ -109,14 +204,18 @@ jobs:
- name: Install packages needed for build
run: |
sudo apt-get install debhelper
sudo apt-get install debhelper build-essential crossbuild-essential-${{ matrix.arch }}
- name: Configure
run: |
# This will warn about CC, but we cannot set CC until we run it :-S
HOST_TRIPLET=$(dpkg-architecture -a${{ matrix.arch }} -q DEB_HOST_GNU_TYPE)
export CC=$HOST_TRIPLET-gcc
export AR=$HOST_TRIPLET-ar
./autogen.sh
./configure
./configure --host $HOST_TRIPLET
cd packages/debian/
./configure
./configure EXTN=${{ matrix.arch }}
- name: Build
run: |
@ -126,11 +225,11 @@ jobs:
- name: Upload dpkg
uses: actions/upload-artifact@v2
with:
name: package-dpkg-amd64
name: package-dpkg-${{ matrix.arch }}
path: packages/debian/*.deb
package_rpm:
needs: fulltest
needs: test_linux
name: Package for Redhat/RPM
runs-on: ubuntu-latest
@ -165,8 +264,8 @@ jobs:
name: package-rpm-x86_64
path: rpmbuild/RPMS/x86_64/*.rpm
package_windows:
needs: fulltest
binaries_windows:
needs: test_windows
name: Binaries for Windows (x86_64-pc-mingw64)
runs-on: windows-latest
@ -190,8 +289,8 @@ jobs:
name: binaries-x86_64-pc-mingw64
path: binaries
package_macos:
needs: fulltest
binaries_macos:
needs: test_macos
name: Binaries for MacOS (x86_64-apple-darwin)
runs-on: macos-latest
@ -220,8 +319,8 @@ jobs:
name: binaries-x86_64-apple-darwin
path: binaries
package_crosscompile_linux:
needs: fulltest
binaries_linux_crosscompile:
needs: test_linux
name: Binaries for linux
runs-on: ubuntu-latest
strategy:

View File

@ -7,7 +7,7 @@ N2N_BUILD=${N2N_HOME}/packages/debian/n2n
all: clean pkg
pkg:
cd ../..; make; cd -
make -C ../../
if test -e "${N2N_BUILD}"; then /bin/rm -fr ${N2N_BUILD}; fi
mkdir -p ${N2N_BUILD}/usr/sbin ${N2N_BUILD}/usr/share/man/man1 ${N2N_BUILD}/usr/share/man/man7 ${N2N_BUILD}/usr/share/man/man8
mkdir -p ${N2N_BUILD}/usr/share/doc/n2n/examples
@ -19,7 +19,7 @@ pkg:
install -m644 ../../community.list ${N2N_BUILD}/usr/share/doc/n2n/examples/
install -m644 ../../doc/*.md ${N2N_BUILD}/usr/share/doc/n2n/
@/bin/rm -f ../n2n*.deb
dpkg-buildpackage -rfakeroot -d -us -uc @BUILDPACKAGE_EXTRA@
dpkg-buildpackage -rfakeroot -d -us -uc -a@EXTN@
-dpkg-sig --sign builder -k D1EB60BE ../n2n_*deb
@\rm -f ../n2n_*dsc ../n2n_*.gz ../n2n_*changes
@/bin/mv ../n2n_*deb .

View File

@ -588,8 +588,6 @@ DATE
EXTN
GIT_COMMITS
N2N_VERSION_SHORT
MACHINE
BUILDPACKAGE_EXTRA
APP
target_alias
host_alias
@ -1699,9 +1697,6 @@ fi
N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2`
GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2`
MACHINE=`uname -m`
SHORT_MACHINE=`uname -m | cut -b1-3`
DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l`
EXTRA_DEP=""
@ -1709,33 +1704,31 @@ if test $DEBIAN_VERSION = "0"; then
EXTRA_DEP=", libzstd1"
fi
BUILDPACKAGE_EXTRA=
if test "${EXTN+set}" != set; then
MACHINE=`uname -m`
SHORT_MACHINE=`echo $MACHINE | cut -b1-3`
if test $MACHINE = "x86_64"; then
EXTN="amd64"
else
if test $SHORT_MACHINE = "aar"; then
EXTN="arm64"
EXTRA_DEPS=""
else
if test $SHORT_MACHINE = "arm"; then
EXTN="armhf"
EXTRA_DEPS=""
if test $MACHINE = "x86_64"; then
EXTN="amd64"
else
if test $SHORT_MACHINE = "mip"; then
EXTN="mips"
EXTRA_DEPS=""
else
EXTN="i386"
fi
fi
fi
if test $SHORT_MACHINE = "aar"; then
EXTN="arm64"
else
if test $SHORT_MACHINE = "arm"; then
EXTN="armhf"
else
if test $SHORT_MACHINE = "mip"; then
EXTN="mips"
else
EXTN="i386"
fi
fi
fi
fi
fi
if test "${with_edgex+set}" = set; then
EXTN="mipsel"
EXTRA_DEPS=""
BUILDPACKAGE_EXTRA="--host-arch mipsel"
fi
APP=n2n
@ -1748,8 +1741,6 @@ DATE=`date -R`
ac_config_files="$ac_config_files debian/changelog"
ac_config_files="$ac_config_files debian/files"

View File

@ -6,9 +6,6 @@ AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X])
N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2`
GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2`
MACHINE=`uname -m`
SHORT_MACHINE=`uname -m | cut -b1-3`
DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l`
EXTRA_DEP=""
@ -16,41 +13,37 @@ if test $DEBIAN_VERSION = "0"; then
EXTRA_DEP=", libzstd1"
fi
BUILDPACKAGE_EXTRA=
if test "${EXTN+set}" != set; then
MACHINE=`uname -m`
SHORT_MACHINE=`echo $MACHINE | cut -b1-3`
if test $MACHINE = "x86_64"; then
EXTN="amd64"
else
if test $SHORT_MACHINE = "aar"; then
EXTN="arm64"
EXTRA_DEPS=""
else
if test $SHORT_MACHINE = "arm"; then
EXTN="armhf"
EXTRA_DEPS=""
if test $MACHINE = "x86_64"; then
EXTN="amd64"
else
if test $SHORT_MACHINE = "mip"; then
EXTN="mips"
EXTRA_DEPS=""
else
EXTN="i386"
fi
fi
fi
if test $SHORT_MACHINE = "aar"; then
EXTN="arm64"
else
if test $SHORT_MACHINE = "arm"; then
EXTN="armhf"
else
if test $SHORT_MACHINE = "mip"; then
EXTN="mips"
else
EXTN="i386"
fi
fi
fi
fi
fi
if test "${with_edgex+set}" = set; then
EXTN="mipsel"
EXTRA_DEPS=""
BUILDPACKAGE_EXTRA="--host-arch mipsel"
fi
APP=n2n
DATE=`date -R`
AC_SUBST(APP)
AC_SUBST(BUILDPACKAGE_EXTRA)
AC_SUBST(MACHINE)
AC_SUBST(N2N_VERSION_SHORT)
AC_SUBST(GIT_COMMITS)
AC_SUBST(EXTN)