From 7d4ff082009be3c149efa95641760c05ed934b91 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 11 Oct 2021 13:59:28 +0100 Subject: [PATCH] added automated binary artifacts (#849) * Allow an autobuilder with no access to private key material to create testable packages * Initial dpkg build - will need helpers installed to work * Start adding required dpkg helpers * Tweak package artifact names * Add a windows 'package' builder * Ensure prefix path handling deals with current directory change when descending to tools dir * The tools makefile currently only needs the SBINDIR path to install properly * Add a macos 'package' builder * Remove unused configure variables * Without commit history, some of the automatic version numbering will fail * Add an rpm builder * Need to set the env var for the rpm build before we change our working dir * Allow gpg signing to fail for generating test rpm packages * Unfortunately the rpm spec file hardcodes some path assumptions, so we need to use hacks to work around them * Return to the top dir before moving things around * A small change to make actions re-run the pipeline * Name this workflow file with a nicer looking name --- .github/workflows/tests.yml | 127 +++++++++++++++++++++++++++++++++++- Makefile.in | 3 +- autogen.sh | 3 - configure.seed | 3 - packages/debian/Makefile.in | 2 +- packages/rpm/Makefile.in | 2 +- 6 files changed, 128 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f346a5d..ce51528 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,5 +1,5 @@ -name: testing +name: Testing on: push: @@ -7,7 +7,7 @@ on: jobs: quicktest: - name: Quick test + name: Smoke test runs-on: ubuntu-latest steps: @@ -96,3 +96,126 @@ jobs: - name: Upload data to codecov uses: codecov/codecov-action@v2 + + package_dpkg: + needs: fulltest + name: Create packages for Debian/Ubuntu + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install packages needed for build + run: | + sudo apt-get install debhelper + + - name: Configure + run: | + ./autogen.sh + ./configure + cd packages/debian/ + ./configure + + - name: Build + run: | + cd packages/debian/ + make + + - name: Upload dpkg + uses: actions/upload-artifact@v2 + with: + name: package-amd64-dpkg + path: packages/debian/*.deb + + package_rpm: + needs: fulltest + name: Create packages for Redhat + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install packages needed for build + run: | + sudo apt-get install rpm + + - name: Configure + run: | + ./autogen.sh + ./configure + cd packages/rpm/ + ./configure + + - name: Build + run: | + make + HOME=$(pwd)/../ + cd packages/rpm/ + make + cd ../../ + mv ../rpmbuild ./ + + - name: Upload rpm + uses: actions/upload-artifact@v2 + with: + name: package-amd64-rpm + path: rpmbuild/RPMS/x86_64/*.rpm + + package_windows: + needs: fulltest + name: Create packages for Windows + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - name: Configure and Build + shell: bash + run: | + ./scripts/hack_fakeautoconf + make + + - name: Create binary dir + shell: bash + run: | + make install DESTDIR=package + + - name: Upload binary zip + uses: actions/upload-artifact@v2 + with: + name: package-amd64-windows + path: package + + package_macos: + needs: fulltest + name: Create packages for MacOS + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install packages needed for build + run: | + brew install automake + + - name: Configure and Build + shell: bash + run: | + ./autogen.sh + ./configure + make + + - name: Create binary dir + shell: bash + run: | + make install DESTDIR=package + + - name: Upload binary zip + uses: actions/upload-artifact@v2 + with: + name: package-amd64-macos + path: package diff --git a/Makefile.in b/Makefile.in index 9e01e7f..aecf67e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -59,7 +59,6 @@ export MKDIR export INSTALL export INSTALL_PROG export INSTALL_DOC -export PREFIX export SBINDIR MKDIR=mkdir -p @@ -188,7 +187,7 @@ install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz $(INSTALL_DOC) edge.8.gz $(MAN8DIR)/ $(INSTALL_DOC) supernode.1.gz $(MAN1DIR)/ $(INSTALL_DOC) n2n.7.gz $(MAN7DIR)/ - $(MAKE) -C tools install + $(MAKE) -C tools install SBINDIR=$(abspath $(SBINDIR)) # Docker builder section DOCKER_IMAGE_NAME=ntop/supernode diff --git a/autogen.sh b/autogen.sh index 1b5701e..a3bdbc0 100755 --- a/autogen.sh +++ b/autogen.sh @@ -8,9 +8,6 @@ N2N_PATCH="0" N2N_VERSION_SHORT="$N2N_MAJOR.$N2N_MINOR.$N2N_PATCH" cat configure.seed | sed \ - -e "s/@N2N_MAJOR@/$N2N_MAJOR/g" \ - -e "s/@N2N_MINOR@/$N2N_MINOR/g" \ - -e "s/@N2N_PATCH@/$N2N_PATCH/g" \ -e "s/@N2N_VERSION_SHORT@/$N2N_VERSION_SHORT/g" \ > configure.ac diff --git a/configure.seed b/configure.seed index 1a4032d..0226d3d 100644 --- a/configure.seed +++ b/configure.seed @@ -124,9 +124,6 @@ AC_SUBST(CC) AC_SUBST(AR) AC_SUBST(CFLAGS) AC_SUBST(LDFLAGS) -AC_SUBST(N2N_MAJOR) -AC_SUBST(N2N_MINOR) -AC_SUBST(N2N_PATCH) AC_SUBST(N2N_VERSION_SHORT) AC_SUBST(GIT_COMMITS) AC_SUBST(GIT_REVISION) diff --git a/packages/debian/Makefile.in b/packages/debian/Makefile.in index a660f6d..bb622f0 100644 --- a/packages/debian/Makefile.in +++ b/packages/debian/Makefile.in @@ -20,7 +20,7 @@ pkg: install -m644 ../../doc/*.md ${N2N_BUILD}/usr/share/doc/n2n/ @/bin/rm -f ../n2n*.deb dpkg-buildpackage -rfakeroot -d -us -uc @BUILDPACKAGE_EXTRA@ - dpkg-sig --sign builder -k D1EB60BE ../n2n_*deb + -dpkg-sig --sign builder -k D1EB60BE ../n2n_*deb @\rm -f ../n2n_*dsc ../n2n_*.gz ../n2n_*changes @/bin/mv ../n2n_*deb . @echo diff --git a/packages/rpm/Makefile.in b/packages/rpm/Makefile.in index d7d677a..68585a5 100644 --- a/packages/rpm/Makefile.in +++ b/packages/rpm/Makefile.in @@ -10,7 +10,7 @@ all: clean pkg pkg: rpmbuild -bb ./n2n.spec - @@RPM_SIGN_CMD@ $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG) + -@@RPM_SIGN_CMD@ $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG) @echo "" @echo "Package contents:" @rpm -qpl $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG)