From 2f9171575268904d9f64d253f9ce54da54a36a30 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Thu, 28 Apr 2022 10:19:41 -0400 Subject: [PATCH] add support to make directly to a tarball package; add .github workflow YAML files; --- .github/workflows/dpkg.yml | 64 +++++++++++++++++++++++++++++++++++ .github/workflows/tarball.yml | 62 +++++++++++++++++++++++++++++++++ Makefile | 19 ++++++++++- 3 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/dpkg.yml create mode 100644 .github/workflows/tarball.yml diff --git a/.github/workflows/dpkg.yml b/.github/workflows/dpkg.yml new file mode 100644 index 00000000..6b5c90a1 --- /dev/null +++ b/.github/workflows/dpkg.yml @@ -0,0 +1,64 @@ +name: dvmhost-build-dpkg + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: +# branches: [ master ] + pull_request: +# branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + runs-on: ubuntu-latest + steps: + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v5.1 + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Dependencies + run: sudo apt-get install -y gcc-arm-none-eabi build-essential devscripts debhelper + + - name: Sync Git Submodules + run: git submodule init && git submodule update + + - name: Change /opt Permissions + run: sudo chmod 777 /opt + + - name: Build Debian Package + run: make dpkg + + - name: Package Hash + run: | + echo "BRANCH: ${{steps.branch-name.outputs.current_branch}}" >> release.txt + echo "COMMIT: ${{github.sha}}" >> release.txt + echo >> release.txt + echo '```' >> release.txt + cat << EOF >> release.txt + dvmhost_1.0.0-1_amd64.deb + size : $(wc -c dvmhost_1.0.0-1_amd64.deb) + md5 : $(md5sum dvmhost_1.0.0-1_amd64.deb) + sha1 : $(sha1sum dvmhost_1.0.0-1_amd64.deb) + sha256: $(sha256sum dvmhost_1.0.0-1_amd64.deb) + EOF + echo '```' >> release.txt + + - name: Release Artifacts + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{steps.date.outputs.date}} + body_path: release.txt + files: | + dvmhost_1.0.0-1_amd64.deb diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml new file mode 100644 index 00000000..ccfe709b --- /dev/null +++ b/.github/workflows/tarball.yml @@ -0,0 +1,62 @@ +name: dvmhost-build-tarball + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + pull_request: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + runs-on: ubuntu-latest + steps: + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v5.1 + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Dependencies + run: sudo apt-get install -y gcc-arm-none-eabi build-essential devscripts debhelper + + - name: Sync Git Submodules + run: git submodule init && git submodule update + + - name: Change /opt Permissions + run: sudo chmod 777 /opt + + - name: Build Debian Package + run: make tarball + + - name: Package Hash + run: | + echo "BRANCH: ${{steps.branch-name.outputs.current_branch}}" >> release.txt + echo "COMMIT: ${{github.sha}}" >> release.txt + echo >> release.txt + echo '```' >> release.txt + cat << EOF >> release.txt + dvmhost_1.0.0.tar.gz + size : $(wc -c dvmhost_1.0.0.tar.gz) + md5 : $(md5sum dvmhost_1.0.0.tar.gz) + sha1 : $(sha1sum dvmhost_1.0.0.tar.gz) + sha256: $(sha256sum dvmhost_1.0.0.tar.gz) + EOF + echo '```' >> release.txt + + - name: Release Artifacts + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{steps.date.outputs.date}} + body_path: release.txt + files: | + dvmhost_1.0.0.tar.gz diff --git a/Makefile b/Makefile index 4ea7381e..00e5dd03 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,11 @@ EXTFLAGS= LIBS = -lpthread -lutil LDFLAGS = -g +TAR_ARCH = +ifneq ($(ARCH),) +TAR_ARCH = "_$(ARCH)" +endif + HOST_BIN = dvmhost HOST_OBJECTS = \ edac/AMBEFEC.o \ @@ -98,6 +103,8 @@ CMD_OBJECTS = \ network/UDPSocket.cmd.o \ Log.cmd.o +.PHONY: dvmhost dvmcmd all strip clean install dpkg tarball + all: dvmhost dvmcmd dvmhost: $(HOST_OBJECTS) $($(ARCH)CXX) $(HOST_OBJECTS) $(CFLAGS) $(EXTFLAGS) $(LIBS) -o $(HOST_BIN) @@ -112,7 +119,7 @@ strip: -$($(ARCH)STRIP) $(CMD_BIN) clean: $(RM) $(HOST_BIN) $(HOST_OBJECTS) $(CMD_BIN) $(CMD_OBJECTS) *.o *.d *.bak *~ - $(RM) -r dpkg_build + $(RM) -r dpkg_build tar_build $(RM) dvmhost_1.0.0* dvmhost-dbgsym*.deb install: all @@ -142,6 +149,16 @@ dpkg: clean mv ../dvmhost_1.0.0.orig.tar.gz . mkdir -p dpkg_build cd dpkg_build; tar xvf ../dvmhost_1.0.0.orig.tar.gz .; debuild -us -uc +tarball: clean dvmhost dvmcmd strip + mkdir -p tar_build/dvm + mkdir -p tar_build/dvm/bin + cp -v $(HOST_BIN) tar_build/dvm/bin + cp -v $(CMD_BIN) tar_build/dvm/bin + cp *.sh tar_build/dvm + chmod +x tar_build/dvm/*.sh + cp -v config*.yml tar_build/dvm + cp -v *.dat tar_build/dvm + cd tar_build; tar czvf ../dvmhost_1.0.0$(TAR_ARCH).tar.gz * install-service: install @useradd --user-group -M --system dvmhost --shell /bin/false || true