From d5863ed74b14cb6888c56788fc967874f1105739 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 21 May 2020 15:46:50 +0200 Subject: [PATCH] TT#82051 Support GitHub actions + workflows using Debian package builds + shellcheck While at it, provide README file for better visibility at https://github.com/sipwise/ngcpcfg, now also providing build status information. Change-Id: Ia25dd9577205336abfb9169e259f3f2cbdb76b35 --- .github/actions/debpkg-buster/Dockerfile | 13 +++++ .github/actions/debpkg-buster/action.yml | 6 +++ .github/actions/debpkg-buster/entrypoint.sh | 16 ++++++ .github/actions/debpkg-sid/Dockerfile | 13 +++++ .github/actions/debpkg-sid/action.yml | 6 +++ .github/actions/debpkg-sid/entrypoint.sh | 16 ++++++ .github/workflows/debpkg.yml | 54 +++++++++++++++++++++ .github/workflows/tests.yml | 30 ++++++++++++ README.md | 13 +++++ 9 files changed, 167 insertions(+) create mode 100644 .github/actions/debpkg-buster/Dockerfile create mode 100644 .github/actions/debpkg-buster/action.yml create mode 100755 .github/actions/debpkg-buster/entrypoint.sh create mode 100644 .github/actions/debpkg-sid/Dockerfile create mode 100644 .github/actions/debpkg-sid/action.yml create mode 100755 .github/actions/debpkg-sid/entrypoint.sh create mode 100644 .github/workflows/debpkg.yml create mode 100644 .github/workflows/tests.yml create mode 100644 README.md diff --git a/.github/actions/debpkg-buster/Dockerfile b/.github/actions/debpkg-buster/Dockerfile new file mode 100644 index 00000000..19322a6a --- /dev/null +++ b/.github/actions/debpkg-buster/Dockerfile @@ -0,0 +1,13 @@ +FROM debian:buster + +COPY entrypoint.sh /entrypoint.sh + +# avoid "debconf: (TERM is not set, so the dialog frontend is not usable.)" +ENV DEBIAN_FRONTEND noninteractive + +# disable man-db to speed up builds +RUN echo 'man-db man-db/auto-update boolean false' | debconf-set-selections + +RUN apt-get update && apt-get -y install build-essential + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/debpkg-buster/action.yml b/.github/actions/debpkg-buster/action.yml new file mode 100644 index 00000000..087b58f5 --- /dev/null +++ b/.github/actions/debpkg-buster/action.yml @@ -0,0 +1,6 @@ +name: "Build Docker image based on Debian/buster" +description: "Build Docker image based on Debian/buster" + +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/.github/actions/debpkg-buster/entrypoint.sh b/.github/actions/debpkg-buster/entrypoint.sh new file mode 100755 index 00000000..1abab9ad --- /dev/null +++ b/.github/actions/debpkg-buster/entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -eu -o pipefail + +echo "*** Starting execution of '$0' ***" + +echo "** Installing build dependencies **" +apt-get -y build-dep . + +echo "** Building Debian package **" +dpkg-buildpackage + +# We're inside /github/workspace/ +echo "** Copying Debian package files to workspace **" +cp ../*.deb ../*.buildinfo ../workspace/ + +echo "*** Finished execution of '$0' ***" diff --git a/.github/actions/debpkg-sid/Dockerfile b/.github/actions/debpkg-sid/Dockerfile new file mode 100644 index 00000000..375b766c --- /dev/null +++ b/.github/actions/debpkg-sid/Dockerfile @@ -0,0 +1,13 @@ +FROM debian:sid + +COPY entrypoint.sh /entrypoint.sh + +# avoid "debconf: (TERM is not set, so the dialog frontend is not usable.)" +ENV DEBIAN_FRONTEND noninteractive + +# disable man-db to speed up builds +RUN echo 'man-db man-db/auto-update boolean false' | debconf-set-selections + +RUN apt-get update && apt-get -y install build-essential + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/debpkg-sid/action.yml b/.github/actions/debpkg-sid/action.yml new file mode 100644 index 00000000..1ec396a3 --- /dev/null +++ b/.github/actions/debpkg-sid/action.yml @@ -0,0 +1,6 @@ +name: "Build Docker image based on Debian/sid" +description: "Build Docker image based on Debian/sid" + +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/.github/actions/debpkg-sid/entrypoint.sh b/.github/actions/debpkg-sid/entrypoint.sh new file mode 100755 index 00000000..1abab9ad --- /dev/null +++ b/.github/actions/debpkg-sid/entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -eu -o pipefail + +echo "*** Starting execution of '$0' ***" + +echo "** Installing build dependencies **" +apt-get -y build-dep . + +echo "** Building Debian package **" +dpkg-buildpackage + +# We're inside /github/workspace/ +echo "** Copying Debian package files to workspace **" +cp ../*.deb ../*.buildinfo ../workspace/ + +echo "*** Finished execution of '$0' ***" diff --git a/.github/workflows/debpkg.yml b/.github/workflows/debpkg.yml new file mode 100644 index 00000000..8bf4c9cd --- /dev/null +++ b/.github/workflows/debpkg.yml @@ -0,0 +1,54 @@ +name: Debian Packaging + +on: + push: + pull_request: + schedule: + - cron: '0 8 * * *' + +jobs: + build-deb-buster: + runs-on: ubuntu-latest + name: Debian pipeline for buster + + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: Execute Docker debpkg action + uses: ./.github/actions/debpkg-buster + + - name: Store Debian package artifacts + uses: actions/upload-artifact@v2 + with: + name: Debian binary package files + path: '*.deb' + + - name: Store Debian package build info + uses: actions/upload-artifact@v2 + with: + name: Debian buildinfo file + path: '*.buildinfo' + + build-deb-sid: + runs-on: ubuntu-latest + name: Debian pipeline for sid + + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: Execute Docker debpkg action + uses: ./.github/actions/debpkg-sid + + - name: Store Debian package artifacts + uses: actions/upload-artifact@v2 + with: + name: Debian binary package files + path: '*.deb' + + - name: Store Debian package build info + uses: actions/upload-artifact@v2 + with: + name: Debian buildinfo file + path: '*.buildinfo' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..b760c366 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,30 @@ +name: Code Testing + +on: + push: + pull_request: + schedule: + - cron: '0 8 * * *' + +jobs: + shellcheck: + runs-on: ubuntu-latest + name: Run shellcheck + + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: Display original shellcheck version + run: shellcheck --version + + - name: Update shellcheck to latest stable version + run: | + wget -qO- https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz | tar -xJv + sudo cp shellcheck-stable/shellcheck /usr/bin/ + + - name: Display current shellcheck version + run: shellcheck --version + + - name: Shellcheck execution + run: shellcheck scripts/* functions/* etc/ngcp-config/ngcpcfg.cfg sbin/ngcpcfg diff --git a/README.md b/README.md new file mode 100644 index 00000000..d1c499ae --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# ngcpcfg - central and templated based Configuration Management System for NGCP + +![Debian Package CI](https://github.com/sipwise/ngcpcfg/workflows/Debian%20Package%20CI/badge.svg) + +![Code Testing](https://github.com/sipwise/ngcpcfg/workflows/Code%20Testing/badge.svg) + +ngcp-ngcpcfg is a Configuration Management System providing central +configuration and template based handling of configuration +files, featuring handling of local configuration changes and +updates as well as synchronisation between servers. + +NGCP is the Sipwise NGCP (Sipwise Next Generation Communication Platform), +visit [Sipwise.org](https://www.sipwise.org/) for further information.