Browse Source

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
pull/855/head
Hamish Coleman 3 years ago
committed by GitHub
parent
commit
c3c72e2656
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 173
      .github/workflows/tests.yml
  2. 4
      packages/debian/Makefile.in
  3. 47
      packages/debian/configure
  4. 45
      packages/debian/configure.in

173
.github/workflows/tests.yml

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

4
packages/debian/Makefile.in

@ -7,7 +7,7 @@ N2N_BUILD=${N2N_HOME}/packages/debian/n2n
all: clean pkg all: clean pkg
pkg: pkg:
cd ../..; make; cd - make -C ../../
if test -e "${N2N_BUILD}"; then /bin/rm -fr ${N2N_BUILD}; fi 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/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 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 ../../community.list ${N2N_BUILD}/usr/share/doc/n2n/examples/
install -m644 ../../doc/*.md ${N2N_BUILD}/usr/share/doc/n2n/ install -m644 ../../doc/*.md ${N2N_BUILD}/usr/share/doc/n2n/
@/bin/rm -f ../n2n*.deb @/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 -dpkg-sig --sign builder -k D1EB60BE ../n2n_*deb
@\rm -f ../n2n_*dsc ../n2n_*.gz ../n2n_*changes @\rm -f ../n2n_*dsc ../n2n_*.gz ../n2n_*changes
@/bin/mv ../n2n_*deb . @/bin/mv ../n2n_*deb .

47
packages/debian/configure

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

45
packages/debian/configure.in

@ -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` 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` 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` DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l`
EXTRA_DEP="" EXTRA_DEP=""
@ -16,41 +13,37 @@ if test $DEBIAN_VERSION = "0"; then
EXTRA_DEP=", libzstd1" EXTRA_DEP=", libzstd1"
fi 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 if test $MACHINE = "x86_64"; then
EXTN="amd64" EXTN="amd64"
else
if test $SHORT_MACHINE = "aar"; then
EXTN="arm64"
EXTRA_DEPS=""
else
if test $SHORT_MACHINE = "arm"; then
EXTN="armhf"
EXTRA_DEPS=""
else else
if test $SHORT_MACHINE = "mip"; then if test $SHORT_MACHINE = "aar"; then
EXTN="mips" EXTN="arm64"
EXTRA_DEPS="" else
else if test $SHORT_MACHINE = "arm"; then
EXTN="i386" EXTN="armhf"
fi else
fi if test $SHORT_MACHINE = "mip"; then
fi EXTN="mips"
else
EXTN="i386"
fi
fi
fi
fi
fi fi
if test "${with_edgex+set}" = set; then if test "${with_edgex+set}" = set; then
EXTN="mipsel" EXTN="mipsel"
EXTRA_DEPS=""
BUILDPACKAGE_EXTRA="--host-arch mipsel"
fi fi
APP=n2n APP=n2n
DATE=`date -R` DATE=`date -R`
AC_SUBST(APP) AC_SUBST(APP)
AC_SUBST(BUILDPACKAGE_EXTRA)
AC_SUBST(MACHINE)
AC_SUBST(N2N_VERSION_SHORT) AC_SUBST(N2N_VERSION_SHORT)
AC_SUBST(GIT_COMMITS) AC_SUBST(GIT_COMMITS)
AC_SUBST(EXTN) AC_SUBST(EXTN)

Loading…
Cancel
Save