From 57bb6f13fda0384282d5eed08ee25a262173c4ec Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Tue, 30 Jan 2024 19:49:05 +0100 Subject: [PATCH 1/3] GHA: Add workflow for building and publishing packages. --- .github/workflows/build.yml | 248 ++++++++++++++++++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1bb7912 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,248 @@ +name: Build and Distribute + +on: + pull_request: + push: + branches: + - release + - master + paths: + - "**" + - "!debian/changelog" + workflow_dispatch: + +concurrency: + group: ${{ github.head_ref || github.ref }} + +jobs: + build_rpm: + name: 'Build RPM' + uses: signalwire/actions-template/.github/workflows/ci-rpm-packages.yml@main + with: + PROJECT_NAME: broadvoice # this is khown issue (no `lib` prefix) + RUNNER: ubuntu-latest + PACKAGER: 'packager Andrey Volk ' + PLATFORM: amd64 + secrets: inherit + + build_deb: + name: 'Build DEB' + uses: signalwire/actions-template/.github/workflows/ci-deb-packages-v2.yml@main + strategy: + fail-fast: false + matrix: + codename: + - bookworm + - bullseye + - buster + - stretch + platform: + - amd64 + - armhf + with: + PROJECT_NAME: libbroadvoice + RUNNER: ubuntu-latest + BASE_IMAGE: signalwire/build-deb-action + DISTRO_CODENAME: ${{ matrix.codename }} + PLATFORM: ${{ matrix.platform }} + + generate_meta_rpm: + if: (github.ref_type == 'branch' && github.base_ref == '') + name: 'Meta RPM' + needs: [ build_rpm ] + strategy: + matrix: + os: + - rpm + platform: + - amd64 + uses: signalwire/actions-template/.github/workflows/ci-libs-metadata-v2.yml@main + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-artifact + OS_PLATFORM: ${{ matrix.os }}-${{ matrix.platform }} + RUNNER: ubuntu-latest + FILE_PATH_PREFIX: /var/www/libbroadvoice-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }} + + generate_meta_deb: + if: (github.ref_type == 'branch' && github.base_ref == '') + name: 'Meta DEB' + needs: [ build_deb ] + strategy: + matrix: + os: + - deb + codename: + - bookworm + - bullseye + - buster + - stretch + platform: + - amd64 + - armhf + uses: signalwire/actions-template/.github/workflows/ci-libs-metadata-v2.yml@main + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-artifact + OS_PLATFORM: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }} + RUNNER: ubuntu-latest + FILE_PATH_PREFIX: /var/www/libbroadvoice-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }} + + distribute_matrix_rpm: + if: (github.ref_type == 'branch' && github.base_ref == '') + permissions: write-all + name: 'Copy to remote RPM' + needs: [ build_rpm ] + strategy: + matrix: + os: + - rpm + platform: + - amd64 + uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-artifact + TARGET_FOLDER: /var/www/libbroadvoice-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }} + RUNNER: ubuntu-latest + FILES: '*.tar.gz' + CREATE_DESTINATION_FOLDERS: true + secrets: + # Explicit define secrets for better understanding but it could be just inherit + PROXY_URL: ${{ secrets.PROXY_URL }} + USERNAME: ${{ secrets.USERNAME }} + HOSTNAME: ${{ secrets.HOSTNAME }} + TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }} + + distribute_matrix_deb: + if: (github.ref_type == 'branch' && github.base_ref == '') + permissions: write-all + name: 'Copy to remote DEB' + needs: [ build_deb ] + strategy: + matrix: + os: + - deb + codename: + - bookworm + - bullseye + - buster + - stretch + platform: + - amd64 + - armhf + uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-artifact + TARGET_FOLDER: /var/www/libbroadvoice-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }} + RUNNER: ubuntu-latest + FILES: '*.tar.gz' + CREATE_DESTINATION_FOLDERS: true + secrets: + # Explicit define secrets for better understanding but it could be just inherit + PROXY_URL: ${{ secrets.PROXY_URL }} + USERNAME: ${{ secrets.USERNAME }} + HOSTNAME: ${{ secrets.HOSTNAME }} + TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }} + + distribute_meta_rpm: + if: (github.ref_type == 'branch' && github.base_ref == '') + permissions: write-all + name: 'Copy meta to remote RPM' + needs: [ generate_meta_rpm ] + strategy: + max-parallel: 1 + matrix: + os: + - rpm + platform: + - amd64 + uses: signalwire/actions-template/.github/workflows/cd-libs-metadata.yml@main + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-meta + LIB_NAME: libbroadvoice + SOURCE_BRANCH: ${{ github.ref_name }} + TARGET_OS: ${{ matrix.os }} + TARGET_PLATFORM: ${{ matrix.platform }} + RUNNER: ubuntu-latest + TARGET_REPO: signalwire/bamboo_gha_trigger + secrets: + GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }} + concurrency: + group: libbroadvoice-${{ matrix.os }}-${{ matrix.platform }} + cancel-in-progress: false + + distribute_meta_deb: + if: (github.ref_type == 'branch' && github.base_ref == '') + permissions: write-all + name: 'Copy meta to remote DEB' + needs: [ generate_meta_deb ] + strategy: + max-parallel: 1 + matrix: + os: + - deb + codename: + - bookworm + - bullseye + - buster + - stretch + platform: + - amd64 + - armhf + uses: signalwire/actions-template/.github/workflows/cd-libs-metadata.yml@main + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-meta + LIB_NAME: libbroadvoice + SOURCE_BRANCH: ${{ github.ref_name }} + TARGET_OS: ${{ matrix.os }} + TARGET_PLATFORM: ${{ matrix.platform }} + RUNNER: ubuntu-latest + TARGET_REPO: signalwire/bamboo_gha_trigger + secrets: + GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }} + concurrency: + group: libbroadvoice-${{ matrix.os }}-${{ matrix.platform }} + cancel-in-progress: true + + distribute_hash_rpm: + if: (github.ref_type == 'branch' && github.base_ref == '') + permissions: write-all + name: 'Copy hash to remote RPM' + needs: [ distribute_meta_rpm ] + uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main + strategy: + matrix: + os: + - rpm + platform: + - amd64 + with: + RUNNER: ubuntu-latest + CREATE_DESTINATION_FOLDERS: false + EXEC_COMMANDS: 'echo "${{ github.sha }}" > /var/www/libbroadvoice-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}/hash.txt' + secrets: + PROXY_URL: ${{ secrets.PROXY_URL }} + USERNAME: ${{ secrets.USERNAME }} + HOSTNAME: ${{ secrets.HOSTNAME }} + TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }} + + distribute_hash_deb: + if: (github.ref_type == 'branch' && github.base_ref == '') + permissions: write-all + name: 'Copy hash to remote DEB' + needs: [ distribute_meta_deb ] + uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main + strategy: + matrix: + os: + - deb + platform: + - amd64 + - armhf + with: + RUNNER: ubuntu-latest + CREATE_DESTINATION_FOLDERS: false + EXEC_COMMANDS: 'echo "${{ github.sha }}" > /var/www/libbroadvoice-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}/hash.txt' + secrets: + PROXY_URL: ${{ secrets.PROXY_URL }} + USERNAME: ${{ secrets.USERNAME }} + HOSTNAME: ${{ secrets.HOSTNAME }} + TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }} From 3fd5a865e13afc2a0ee34180290ac957b3e3c627 Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Wed, 31 Jan 2024 17:04:48 +0100 Subject: [PATCH 2/3] Set correct name in `pc` file. --- broadvoice.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/broadvoice.pc.in b/broadvoice.pc.in index 95b058d..a0f5529 100644 --- a/broadvoice.pc.in +++ b/broadvoice.pc.in @@ -3,7 +3,7 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: spandsp +Name: broadvoice Description: A library for the BroadVoice 16 and 32 speech codecs. Requires: Version: @VERSION@ From 01810c46e0e458eb04936fe9505a271d526c2836 Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Wed, 31 Jan 2024 17:18:00 +0100 Subject: [PATCH 3/3] Disable mangling package version in Debian Makefile. --- debian/rules | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/debian/rules b/debian/rules index 1bf4e3f..253ebf5 100755 --- a/debian/rules +++ b/debian/rules @@ -2,11 +2,11 @@ # -*- makefile -*- # get debian distribution codename -DISTRIBUTION=$(shell lsb_release -sc) +#DISTRIBUTION=$(shell lsb_release -sc) # get version from changelog, for string mangling -VERSION=$(shell dpkg-parsechangelog --count 1 --show-field Version) +#VERSION=$(shell dpkg-parsechangelog --count 1 --show-field Version) # add distribution codename to package version -PACKAGEVERSION=$(subst ~,~$(DISTRIBUTION)-,$(VERSION)) +#PACKAGEVERSION=$(subst ~,~$(DISTRIBUTION)-,$(VERSION)) export DH_VERBOSE=1 @@ -18,5 +18,5 @@ override_dh_auto_configure: ./configure --prefix=/usr --disable-doc --enable-static --enable-shared # setting mangled package version -override_dh_gencontrol: - dh_gencontrol -- -v$(PACKAGEVERSION) +#override_dh_gencontrol: +# dh_gencontrol -- -v$(PACKAGEVERSION)