From 6e46ca3f1bd64d60d1388c48ebd404f682ddaa07 Mon Sep 17 00:00:00 2001 From: Chris Clement Date: Mon, 17 Jul 2023 10:29:32 -0400 Subject: [PATCH 01/11] Update GHA workflow trigger branch from v2.0 to master --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 027a4b2..19e1ada 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,10 +4,10 @@ on: pull_request: types: [synchronize, opened] branches: - - "v2.0" + - "master" push: branches: - - "v2.0" + - "master" jobs: scan_build: From b8c354a5e824f78b112ec606e6076dd55c497e2c Mon Sep 17 00:00:00 2001 From: Aye Min Aung <2681318+ayeminag@users.noreply.github.com> Date: Wed, 2 Aug 2023 22:57:31 +0700 Subject: [PATCH 02/11] build image and push to docker on merge (#113) * build image and push to docker on merge * bug fix * bug fix * fix dockerfile * fix tags * added new line in build.yml Co-authored-by: Ryan Williams * added new line in Dockerfile * remove ref: min/build-image from stack_image job --------- Co-authored-by: Aye Min Aung Co-authored-by: Ryan Williams --- .github/workflows/build.yml | 72 +++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 1 - Dockerfile | 15 ++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml create mode 100644 Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..dd3f2ac --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,72 @@ +name: Build + +on: + push: + branches: + - "master" + - "min/build-image" + workflow_call: + secrets: + # Secrets used to build + DOCKERHUB_USERNAME: + required: true + DOCKERHUB_TOKEN: + required: true + GH_BOT_DEPLOY_KEY: + required: true + +jobs: + hash: + runs-on: ubuntu-latest + outputs: + HASH: ${{ steps.hash.outputs.short }} + steps: + - id: hash + uses: pr-mpt/actions-commit-hash@v2 + with: + # NOTE: since this workflow is only triggered by `push` event + # github.sha have correct commit sha + commit: ${{ github.sha }} + stack_image: + runs-on: ubuntu-latest + outputs: + LIBS10: ${{ steps.image.outputs.IMAGE_LIBS10 }} + LIBS11: ${{ steps.image.outputs.IMAGE_LIBS11 }} + steps: + - uses: actions/checkout@v3 + with: + repository: signalwire/libks + path: /home/runner/work/signalwire-c/signalwire-c/libks + - run: | + cd /home/runner/work/signalwire-c/signalwire-c/libks + export LIBKS_SHA=$(git rev-parse --short HEAD); + export IMAGE_LIBS10="signalwire/freeswitch-libs:libks-libs10-$LIBKS_SHA" + export IMAGE_LIBS11="signalwire/freeswitch-libs:libks-libs11-$LIBKS_SHA" + echo "IMAGE_LIBS10=$IMAGE_LIBS10" >> $GITHUB_OUTPUT + echo "IMAGE_LIBS11=$IMAGE_LIBS11" >> $GITHUB_OUTPUT + id: image + build: + needs: [hash,stack_image] + strategy: + matrix: + include: + - tag: signalwire-c-libs10-${{ needs.hash.outputs.HASH }} + baseimage: signalwire/freeswitch-base:debian-10 + libks_image: ${{ needs.stack_image.outputs.LIBS10 }} + - tag: signalwire-c-libs11-${{ needs.hash.outputs.HASH }} + baseimage: signalwire/freeswitch-base:debian-11 + libks_image: ${{ needs.stack_image.outputs.LIBS11 }} + name: "build signalwire-c" + uses: signalwire/actions-template/.github/workflows/ci-build.yml@main + with: + CONTAINER_SCAN: true + CONTAINER_TEST: false + PROJECT_NAME: "freeswitch-libs" + FILE: ./Dockerfile + PUSH: true + RUNNER: ubuntu-latest + TAG: ${{ matrix.tag }} + BUILD_ARGS: | + BASEIMAGE=${{ matrix.baseimage }} + LIBKS_IMAGE=${{ matrix.libks_image }} + secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19e1ada..cb86ed0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,6 @@ jobs: uses: actions/checkout@v3 with: repository: signalwire/libks - ref: v2.0 path: /__w/signalwire-c/signalwire-c/libks - name: build libks run: cd /__w/signalwire-c/signalwire-c/libks && cmake . -DCMAKE_BUILD_TYPE=Release && make && make install && cd .. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4b1767f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +ARG LIBKS_IMAGE=signalwire/freeswitch-libs:libks-libs10 +ARG BASEIMAGE=signalwire/freeswitch-base:debian-10 +FROM ${LIBKS_IMAGE} as libks +FROM ${BASEIMAGE} + +COPY REVISION /REVISION +COPY --from=libks /usr/lib/libks2.so /usr/lib/libks2.so +COPY --from=libks /usr/lib/libks2.so.2 /usr/lib/libks2.so.2 +COPY --from=libks /usr/lib/pkgconfig/libks2.pc /usr/lib/pkgconfig/libks2.pc +COPY --from=libks /usr/include/libks2 /usr/include/libks2 +RUN mkdir -p /sw/signalwire-c +WORKDIR /sw/signalwire-c +COPY . . + +RUN PKG_CONFIG_PATH=/usr/lib/pkgconfig cmake . -DCMAKE_INSTALL_PREFIX=/usr && make install From 055572cdcaaabd1a178aaa88600e885d38e565d5 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Mon, 28 Aug 2023 19:15:47 -0700 Subject: [PATCH 03/11] Revert "build image and push to docker on merge (#113)" (#114) --- .github/workflows/build.yml | 72 ------------------------------------- .github/workflows/ci.yml | 1 + Dockerfile | 15 -------- 3 files changed, 1 insertion(+), 87 deletions(-) delete mode 100644 .github/workflows/build.yml delete mode 100644 Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index dd3f2ac..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Build - -on: - push: - branches: - - "master" - - "min/build-image" - workflow_call: - secrets: - # Secrets used to build - DOCKERHUB_USERNAME: - required: true - DOCKERHUB_TOKEN: - required: true - GH_BOT_DEPLOY_KEY: - required: true - -jobs: - hash: - runs-on: ubuntu-latest - outputs: - HASH: ${{ steps.hash.outputs.short }} - steps: - - id: hash - uses: pr-mpt/actions-commit-hash@v2 - with: - # NOTE: since this workflow is only triggered by `push` event - # github.sha have correct commit sha - commit: ${{ github.sha }} - stack_image: - runs-on: ubuntu-latest - outputs: - LIBS10: ${{ steps.image.outputs.IMAGE_LIBS10 }} - LIBS11: ${{ steps.image.outputs.IMAGE_LIBS11 }} - steps: - - uses: actions/checkout@v3 - with: - repository: signalwire/libks - path: /home/runner/work/signalwire-c/signalwire-c/libks - - run: | - cd /home/runner/work/signalwire-c/signalwire-c/libks - export LIBKS_SHA=$(git rev-parse --short HEAD); - export IMAGE_LIBS10="signalwire/freeswitch-libs:libks-libs10-$LIBKS_SHA" - export IMAGE_LIBS11="signalwire/freeswitch-libs:libks-libs11-$LIBKS_SHA" - echo "IMAGE_LIBS10=$IMAGE_LIBS10" >> $GITHUB_OUTPUT - echo "IMAGE_LIBS11=$IMAGE_LIBS11" >> $GITHUB_OUTPUT - id: image - build: - needs: [hash,stack_image] - strategy: - matrix: - include: - - tag: signalwire-c-libs10-${{ needs.hash.outputs.HASH }} - baseimage: signalwire/freeswitch-base:debian-10 - libks_image: ${{ needs.stack_image.outputs.LIBS10 }} - - tag: signalwire-c-libs11-${{ needs.hash.outputs.HASH }} - baseimage: signalwire/freeswitch-base:debian-11 - libks_image: ${{ needs.stack_image.outputs.LIBS11 }} - name: "build signalwire-c" - uses: signalwire/actions-template/.github/workflows/ci-build.yml@main - with: - CONTAINER_SCAN: true - CONTAINER_TEST: false - PROJECT_NAME: "freeswitch-libs" - FILE: ./Dockerfile - PUSH: true - RUNNER: ubuntu-latest - TAG: ${{ matrix.tag }} - BUILD_ARGS: | - BASEIMAGE=${{ matrix.baseimage }} - LIBKS_IMAGE=${{ matrix.libks_image }} - secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb86ed0..19e1ada 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,7 @@ jobs: uses: actions/checkout@v3 with: repository: signalwire/libks + ref: v2.0 path: /__w/signalwire-c/signalwire-c/libks - name: build libks run: cd /__w/signalwire-c/signalwire-c/libks && cmake . -DCMAKE_BUILD_TYPE=Release && make && make install && cd .. diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 4b1767f..0000000 --- a/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -ARG LIBKS_IMAGE=signalwire/freeswitch-libs:libks-libs10 -ARG BASEIMAGE=signalwire/freeswitch-base:debian-10 -FROM ${LIBKS_IMAGE} as libks -FROM ${BASEIMAGE} - -COPY REVISION /REVISION -COPY --from=libks /usr/lib/libks2.so /usr/lib/libks2.so -COPY --from=libks /usr/lib/libks2.so.2 /usr/lib/libks2.so.2 -COPY --from=libks /usr/lib/pkgconfig/libks2.pc /usr/lib/pkgconfig/libks2.pc -COPY --from=libks /usr/include/libks2 /usr/include/libks2 -RUN mkdir -p /sw/signalwire-c -WORKDIR /sw/signalwire-c -COPY . . - -RUN PKG_CONFIG_PATH=/usr/lib/pkgconfig cmake . -DCMAKE_INSTALL_PREFIX=/usr && make install From c8d3523be4e1914d05db8cfe0f24de70536427eb Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Fri, 8 Sep 2023 14:06:15 -0500 Subject: [PATCH 04/11] Fix crash caused by TTL tracker being destroyed before websocket and its incoming threads. (#115) --- src/connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connection.c b/src/connection.c index 8065cc0..7946a14 100644 --- a/src/connection.c +++ b/src/connection.c @@ -672,11 +672,11 @@ SWCLT_DECLARE(void) swclt_conn_destroy(swclt_conn_t **conn) if ((*conn)->blade_connect_rpl) { BLADE_CONNECT_RPL_DESTROY(&(*conn)->blade_connect_rpl); } - ttl_tracker_destroy(&(*conn)->ttl); swclt_wss_destroy(&(*conn)->wss); if ((*conn)->incoming_frame_pool) { ks_thread_pool_destroy(&(*conn)->incoming_frame_pool); } + ttl_tracker_destroy(&(*conn)->ttl); ks_hash_destroy(&(*conn)->outstanding_requests); ks_mutex_destroy(&(*conn)->failed_mutex); ks_pool_free(conn); From 5b3b966099e988a9babfcd75479c54e6b6a9ba1b Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Wed, 21 Feb 2024 21:20:58 +0100 Subject: [PATCH 05/11] [cmake] Don't use CPACK_DEBIAN_PACKAGE_RELEASE, set CPACK_DEBIAN_PACKAGE_VERSION directly. --- CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff5d46f..aaa196d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,23 +234,24 @@ if("${CMAKE_OS_NAME}" STREQUAL "Debian") set(CHANGELOG_FOOTER " -- ${CPACK_DEBIAN_PACKAGE_MAINTAINER} ${RFC2822_TIMESTAMP}") endif() - # Set version release from environment variable + # Guess version release from environment variable + # (usage of CPACK_DEBIAN_PACKAGE_RELEASE breaks ability to set CPACK_DEBIAN_PACKAGE_VERSION properly) if (NOT "$ENV{PACKAGE_RELEASE}" STREQUAL "") - set(CPACK_DEBIAN_PACKAGE_RELEASE "$ENV{PACKAGE_RELEASE}") + set(PACKAGE_RELEASE "$ENV{PACKAGE_RELEASE}") else() if(DATE_CMD) execute_process(COMMAND ${DATE_CMD} +%Y%m%d OUTPUT_VARIABLE DATE_YMD) - set(CPACK_DEBIAN_PACKAGE_RELEASE ${DATE_YMD}) + set(PACKAGE_RELEASE ${DATE_YMD}) else() - set(CPACK_DEBIAN_PACKAGE_RELEASE "1") + set(PACKAGE_RELEASE "1") endif() endif() # Set package version - set(CPACK_DEBIAN_PACKAGE_VERSION ${PROJECT_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}~${DISTRO_CODENAME}) + set(CPACK_DEBIAN_PACKAGE_VERSION ${PROJECT_VERSION}-${PACKAGE_RELEASE}~${DISTRO_CODENAME}) # Set debian file name format - set(CPACK_DEBIAN_FILE_NAME "${PACKAGE_NAME}_${PROJECT_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${DISTRO_CODENAME}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") + set(CPACK_DEBIAN_FILE_NAME "${PACKAGE_NAME}_${PROJECT_VERSION}-${PACKAGE_RELEASE}_${DISTRO_CODENAME}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") # Set a Debian compliant changelog header set(CHANGELOG_HEADER "signalwire-client-c2 (${CPACK_DEBIAN_PACKAGE_VERSION}) ${DISTRO_CODENAME}\; urgency=${CPACK_DEBIAN_PACKAGE_PRIORITY}") From e21ee81b89fbce7a66d561fdd26e0b73f5991b1f Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Thu, 22 Feb 2024 01:05:46 +0100 Subject: [PATCH 06/11] [GHA] Add package Build and Distribute workflow. --- .github/workflows/build.yml | 302 ++++++++++++++++++++++++++++++++++++ 1 file changed, 302 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..25a7bf1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,302 @@ +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: signalwire-c + RUNNER: ubuntu-latest + PACKAGER: 'packager Andrey Volk ' + PLATFORM: amd64 + USE_CMAKE: true + CMAKE_BUILD_TYPE: 'Debug' + ADDITIONAL_PACKAGES: 'libks2' + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + SIGNALWIRE_USERNAME: 'signalwire' + SIGNALWIRE_TOKEN: ${{ secrets.REPOTOKEN }} + + 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 + exclude: + - codename: bookworm + platform: armhf + with: + PROJECT_NAME: signalwire-c + RUNNER: ubuntu-latest + BASE_IMAGE: signalwire/build-deb-action + DISTRO_CODENAME: ${{ matrix.codename }} + PLATFORM: ${{ matrix.platform }} + USE_CMAKE: true + CMAKE_BUILD_TYPE: 'Debug' + PREBUILD_SCRIPT: | + if [ -z "\${GENERIC_TOKEN}" ]; then + echo "Error: GENERIC_TOKEN is empty or not set." + exit 1 + fi + + login="signalwire" + domain="freeswitch.signalwire.com" + gpg_key="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + source_list="/etc/apt/sources.list.d/freeswitch.list" + repo_url_amd64="https://\\\${domain}/repo/deb/debian-release" + repo_url_armhf="https://\\\${domain}/repo/deb/rpi/debian-release" + + echo "machine \\\${domain} login \\\${login} password \${GENERIC_TOKEN}" > /root/.netrc + cp -f /root/.netrc /etc/apt/auth.conf + + if [ "${{ matrix.platform }}" == "amd64" ]; then + echo "deb [signed-by=\\\${gpg_key}] \\\${repo_url_amd64}/ ${{ matrix.codename }} main" > \\\${source_list} + echo "deb-src [signed-by=\\\${gpg_key}] \\\${repo_url_amd64}/ ${{ matrix.codename }} main" >> \\\${source_list} + elif [ "${{ matrix.platform }}" == "armhf" ]; then + echo "deb [signed-by=\\\${gpg_key}] \\\${repo_url_armhf}/ ${{ matrix.codename }} main" > \\\${source_list} + echo "deb-src [signed-by=\\\${gpg_key}] \\\${repo_url_armhf}/ ${{ matrix.codename }} main" >> \\\${source_list} + else + echo "Architecture is not supported: ${{ matrix.platform }}" + exit 1 + fi + + echo "cat \\\${source_list}" && cat \\\${source_list} + + curl --netrc -o \\\${gpg_key} \\\${repo_url_amd64}/signalwire-freeswitch-repo.gpg && \ + apt-get -q update && apt-get -y install libks2 + secrets: + GENERIC_TOKEN: ${{ secrets.REPOTOKEN }} + + 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/signalwire-c-${{ 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 + exclude: + - codename: bookworm + platform: 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/signalwire-c-${{ 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/signalwire-c-${{ 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 + exclude: + - codename: bookworm + platform: 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/signalwire-c-${{ 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: signalwire-c + 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: signalwire-c-${{ 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 + exclude: + - codename: bookworm + platform: armhf + uses: signalwire/actions-template/.github/workflows/cd-libs-metadata.yml@main + with: + ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-meta + LIB_NAME: signalwire-c + 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: signalwire-c-${{ 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/signalwire-c-${{ 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/signalwire-c-${{ 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 832a0af5a78e66b37f3440da3e727abffd00e152 Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Thu, 29 Feb 2024 21:51:21 +0100 Subject: [PATCH 07/11] [GHA] Proper location for `.netrc` in PREBUILD_SCRIPT. --- .github/workflows/build.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25a7bf1..2a6751b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,23 +70,26 @@ jobs: repo_url_amd64="https://\\\${domain}/repo/deb/debian-release" repo_url_armhf="https://\\\${domain}/repo/deb/rpi/debian-release" - echo "machine \\\${domain} login \\\${login} password \${GENERIC_TOKEN}" > /root/.netrc - cp -f /root/.netrc /etc/apt/auth.conf + echo "machine \\\${domain} login \\\${login} password \${GENERIC_TOKEN}" > ~/.netrc + cp -f ~/.netrc /etc/apt/auth.conf if [ "${{ matrix.platform }}" == "amd64" ]; then echo "deb [signed-by=\\\${gpg_key}] \\\${repo_url_amd64}/ ${{ matrix.codename }} main" > \\\${source_list} echo "deb-src [signed-by=\\\${gpg_key}] \\\${repo_url_amd64}/ ${{ matrix.codename }} main" >> \\\${source_list} + + curl --netrc -o \\\${gpg_key} \\\${repo_url_amd64}/signalwire-freeswitch-repo.gpg || exit 1 elif [ "${{ matrix.platform }}" == "armhf" ]; then echo "deb [signed-by=\\\${gpg_key}] \\\${repo_url_armhf}/ ${{ matrix.codename }} main" > \\\${source_list} echo "deb-src [signed-by=\\\${gpg_key}] \\\${repo_url_armhf}/ ${{ matrix.codename }} main" >> \\\${source_list} + + curl --netrc -o \\\${gpg_key} \\\${repo_url_armhf}/signalwire-freeswitch-repo.gpg || exit 1 else echo "Architecture is not supported: ${{ matrix.platform }}" exit 1 fi - echo "cat \\\${source_list}" && cat \\\${source_list} + echo "# cat \\\${source_list}" && cat \\\${source_list} - curl --netrc -o \\\${gpg_key} \\\${repo_url_amd64}/signalwire-freeswitch-repo.gpg && \ apt-get -q update && apt-get -y install libks2 secrets: GENERIC_TOKEN: ${{ secrets.REPOTOKEN }} From 63ec7222d4dde47002110f201d0e68afe4a19c09 Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Thu, 11 Apr 2024 23:47:42 +0200 Subject: [PATCH 08/11] [GHA] Use `cicd-docker-build-and-distribute.yml`. --- .github/docker/centos/7/amd64/Dockerfile | 148 +++++++++ .../docker/debian/bookworm/amd64/Dockerfile | 79 +++++ .../docker/debian/bookworm/arm32v7/Dockerfile | 79 +++++ .../docker/debian/bullseye/amd64/Dockerfile | 79 +++++ .../docker/debian/bullseye/arm32v7/Dockerfile | 79 +++++ .github/docker/debian/buster/amd64/Dockerfile | 79 +++++ .../docker/debian/buster/arm32v7/Dockerfile | 79 +++++ .github/workflows/build.yml | 305 ------------------ .github/workflows/cicd.yml | 112 +++++++ 9 files changed, 734 insertions(+), 305 deletions(-) create mode 100644 .github/docker/centos/7/amd64/Dockerfile create mode 100644 .github/docker/debian/bookworm/amd64/Dockerfile create mode 100644 .github/docker/debian/bookworm/arm32v7/Dockerfile create mode 100644 .github/docker/debian/bullseye/amd64/Dockerfile create mode 100644 .github/docker/debian/bullseye/arm32v7/Dockerfile create mode 100644 .github/docker/debian/buster/amd64/Dockerfile create mode 100644 .github/docker/debian/buster/arm32v7/Dockerfile delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/cicd.yml diff --git a/.github/docker/centos/7/amd64/Dockerfile b/.github/docker/centos/7/amd64/Dockerfile new file mode 100644 index 0000000..7144a60 --- /dev/null +++ b/.github/docker/centos/7/amd64/Dockerfile @@ -0,0 +1,148 @@ +ARG BUILDER_IMAGE=centos:7.2.1511 + +FROM ${BUILDER_IMAGE} AS builder + +# Credentials +ARG REPO_DOMAIN=fsa.freeswitch.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG GPG_KEY="/etc/pki/rpm-gpg/RPM-GPG-KEY-FREESWITCH" +ARG GPG_KEY_URL="https://files.freeswitch.org/repo/yum/centos-release/RPM-GPG-KEY-FREESWITCH" + +ARG MAINTAINER="Andrey Volk " +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +MAINTAINER ${MAINTAINER} +ENV MAINTAINER=${MAINTAINER} + +RUN yum -y update && \ + yum install -y \ + audiofile-devel \ + autoconf \ + automake \ + bind-license \ + centos-release-scl \ + cyrus-sasl-lib \ + dbus \ + dbus-libs \ + devtoolset-9-gcc* \ + dos2unix \ + doxygen \ + dpkg-dev \ + dracut \ + epel-release \ + expat \ + gcc \ + gcc-c++ \ + git \ + glib2 \ + glib2-devel \ + gnupg2 \ + gzip \ + krb5-dxevel \ + libatomic \ + libcurl-devel \ + libtool \ + libuuid-devel \ + libxml2 \ + lksctp-tools-devel \ + lsb_release \ + make \ + multilib-rpm-config \ + openssl-devel \ + pkg-config \ + procps-ng \ + python \ + python-libs \ + rpm-build \ + rpmdevtools \ + scl-utils \ + sqlite \ + swig \ + unzip \ + uuid-devel \ + vim-minimal \ + wget \ + which \ + xz \ + xz-libs \ + yum-plugin-fastestmirror \ + yum-plugin-ovl \ + yum-utils \ + zlib-devel && \ + yum -y clean all + +ENV CMAKE_VERSION 3.22.2 + +RUN set -ex \ + && curl -kfsSLO --compressed https://cmake.org/files/v3.22/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz \ + && curl -kfsSLO --compressed https://cmake.org/files/v3.22/cmake-${CMAKE_VERSION}-SHA-256.txt \ + && grep "cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz\$" cmake-${CMAKE_VERSION}-SHA-256.txt | sha256sum -c - \ + && tar xzf cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz -C /usr/local --strip-components=1 --no-same-owner \ + && rm -rf cmake-${CMAKE_VERSION}* \ + && cmake --version + +ENV DATA_DIR=/data +WORKDIR ${DATA_DIR} + +COPY . ${DATA_DIR}/ +RUN cd ${DATA_DIR}/ && \ + git reset --hard HEAD && git clean -xfd && \ + cd ${DATA_DIR} + +RUN cat < /etc/yum.repos.d/freeswitch.repo +[freeswitch] +name=FreeSWITCH Packages for Enterprise Linux \$releasever - \$basearch +baseurl=https://freeswitch.signalwire.com/repo/yum/centos-release/\$releasever/\$basearch +enabled=1 +gpgcheck=0 +gpgkey=file://${GPG_KEY} +username=\$repousername +password=\$repopassword + +[freeswitch-debuginfo] +name=FreeSWITCH Packages for Enterprise Linux \$releasever - \$basearch - Debug +baseurl=https://freeswitch.signalwire.com/repo/yum/centos-release/\$releasever/\$basearch +enabled=1 +gpgkey=file://${GPG_KEY} +gpgcheck=0 +username=\$repousername +password=\$repopassword + +[freeswitch-source] +name=FreeSWITCH Packages for Enterprise Linux \$releasever - \$basearch - Source +baseurl=https://freeswitch.signalwire.com/repo/yum/centos-release/\$releasever/\$basearch +enabled=1 +gpgkey=file://${GPG_KEY} +gpgcheck=0 +username=\$repousername +password=\$repopassword +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + printf "${REPO_USERNAME}" > /etc/yum/vars/repousername && \ + cat /run/secrets/REPO_PASSWORD > /etc/yum/vars/repopassword + +RUN curl --netrc -o ${GPG_KEY} ${GPG_KEY_URL} + +# Bootstrap and Build +RUN yum -y update && \ + yum install -y \ + libks2 \ + && \ + yum -y clean all + +RUN PACKAGE_RELEASE="${BUILD_NUMBER}.${GIT_SHA}" cmake . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="/usr" && \ + make package && mkdir OUT && mv -v *.rpm OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bookworm/amd64/Dockerfile b/.github/docker/debian/bookworm/amd64/Dockerfile new file mode 100644 index 0000000..87b2dfa --- /dev/null +++ b/.github/docker/debian/bookworm/amd64/Dockerfile @@ -0,0 +1,79 @@ +ARG BUILDER_IMAGE=debian:bookworm +ARG MAINTAINER="Andrey Volk " + +FROM ${BUILDER_IMAGE} AS builder + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER ${MAINTAINER} + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +ENV DATA_DIR=/data +WORKDIR ${DATA_DIR} + +COPY . ${DATA_DIR} +RUN git reset --hard HEAD && git clean -xfd + +RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-release/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + libks2 + +RUN PACKAGE_RELEASE="${BUILD_NUMBER}.${GIT_SHA}" cmake . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="/usr" && \ + make package && mkdir OUT && mv -v *.deb OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bookworm/arm32v7/Dockerfile b/.github/docker/debian/bookworm/arm32v7/Dockerfile new file mode 100644 index 0000000..dd7fa63 --- /dev/null +++ b/.github/docker/debian/bookworm/arm32v7/Dockerfile @@ -0,0 +1,79 @@ +ARG BUILDER_IMAGE=arm32v7/debian:bookworm +ARG MAINTAINER="Andrey Volk " + +FROM ${BUILDER_IMAGE} AS builder + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER ${MAINTAINER} + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +ENV DATA_DIR=/data +WORKDIR ${DATA_DIR} + +COPY . ${DATA_DIR} +RUN git reset --hard HEAD && git clean -xfd + +RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-release ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-release ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/rpi/debian-release/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + libks2 + +RUN PACKAGE_RELEASE="${BUILD_NUMBER}.${GIT_SHA}" cmake . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="/usr" && \ + make package && mkdir OUT && mv -v *.deb OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bullseye/amd64/Dockerfile b/.github/docker/debian/bullseye/amd64/Dockerfile new file mode 100644 index 0000000..4e52536 --- /dev/null +++ b/.github/docker/debian/bullseye/amd64/Dockerfile @@ -0,0 +1,79 @@ +ARG BUILDER_IMAGE=debian:bullseye +ARG MAINTAINER="Andrey Volk " + +FROM ${BUILDER_IMAGE} AS builder + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER ${MAINTAINER} + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +ENV DATA_DIR=/data +WORKDIR ${DATA_DIR} + +COPY . ${DATA_DIR} +RUN git reset --hard HEAD && git clean -xfd + +RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-release/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + libks2 + +RUN PACKAGE_RELEASE="${BUILD_NUMBER}.${GIT_SHA}" cmake . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="/usr" && \ + make package && mkdir OUT && mv -v *.deb OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bullseye/arm32v7/Dockerfile b/.github/docker/debian/bullseye/arm32v7/Dockerfile new file mode 100644 index 0000000..d2eb195 --- /dev/null +++ b/.github/docker/debian/bullseye/arm32v7/Dockerfile @@ -0,0 +1,79 @@ +ARG BUILDER_IMAGE=arm32v7/debian:bullseye +ARG MAINTAINER="Andrey Volk " + +FROM ${BUILDER_IMAGE} AS builder + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER ${MAINTAINER} + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +ENV DATA_DIR=/data +WORKDIR ${DATA_DIR} + +COPY . ${DATA_DIR} +RUN git reset --hard HEAD && git clean -xfd + +RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-release ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-release ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/rpi/debian-release/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + libks2 + +RUN PACKAGE_RELEASE="${BUILD_NUMBER}.${GIT_SHA}" cmake . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="/usr" && \ + make package && mkdir OUT && mv -v *.deb OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/buster/amd64/Dockerfile b/.github/docker/debian/buster/amd64/Dockerfile new file mode 100644 index 0000000..6bdea69 --- /dev/null +++ b/.github/docker/debian/buster/amd64/Dockerfile @@ -0,0 +1,79 @@ +ARG BUILDER_IMAGE=debian:buster +ARG MAINTAINER="Andrey Volk " + +FROM ${BUILDER_IMAGE} AS builder + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER ${MAINTAINER} + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +ENV DATA_DIR=/data +WORKDIR ${DATA_DIR} + +COPY . ${DATA_DIR} +RUN git reset --hard HEAD && git clean -xfd + +RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-release/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + libks2 + +RUN PACKAGE_RELEASE="${BUILD_NUMBER}.${GIT_SHA}" cmake . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="/usr" && \ + make package && mkdir OUT && mv -v *.deb OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/buster/arm32v7/Dockerfile b/.github/docker/debian/buster/arm32v7/Dockerfile new file mode 100644 index 0000000..d1c21b4 --- /dev/null +++ b/.github/docker/debian/buster/arm32v7/Dockerfile @@ -0,0 +1,79 @@ +ARG BUILDER_IMAGE=arm32v7/debian:buster +ARG MAINTAINER="Andrey Volk " + +FROM ${BUILDER_IMAGE} AS builder + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER ${MAINTAINER} + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +ENV DATA_DIR=/data +WORKDIR ${DATA_DIR} + +COPY . ${DATA_DIR} +RUN git reset --hard HEAD && git clean -xfd + +RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-release ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-release ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/rpi/debian-release/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + libks2 + +RUN PACKAGE_RELEASE="${BUILD_NUMBER}.${GIT_SHA}" cmake . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="/usr" && \ + make package && mkdir OUT && mv -v *.deb OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 2a6751b..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,305 +0,0 @@ -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: signalwire-c - RUNNER: ubuntu-latest - PACKAGER: 'packager Andrey Volk ' - PLATFORM: amd64 - USE_CMAKE: true - CMAKE_BUILD_TYPE: 'Debug' - ADDITIONAL_PACKAGES: 'libks2' - secrets: - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} - SIGNALWIRE_USERNAME: 'signalwire' - SIGNALWIRE_TOKEN: ${{ secrets.REPOTOKEN }} - - 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 - exclude: - - codename: bookworm - platform: armhf - with: - PROJECT_NAME: signalwire-c - RUNNER: ubuntu-latest - BASE_IMAGE: signalwire/build-deb-action - DISTRO_CODENAME: ${{ matrix.codename }} - PLATFORM: ${{ matrix.platform }} - USE_CMAKE: true - CMAKE_BUILD_TYPE: 'Debug' - PREBUILD_SCRIPT: | - if [ -z "\${GENERIC_TOKEN}" ]; then - echo "Error: GENERIC_TOKEN is empty or not set." - exit 1 - fi - - login="signalwire" - domain="freeswitch.signalwire.com" - gpg_key="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" - source_list="/etc/apt/sources.list.d/freeswitch.list" - repo_url_amd64="https://\\\${domain}/repo/deb/debian-release" - repo_url_armhf="https://\\\${domain}/repo/deb/rpi/debian-release" - - echo "machine \\\${domain} login \\\${login} password \${GENERIC_TOKEN}" > ~/.netrc - cp -f ~/.netrc /etc/apt/auth.conf - - if [ "${{ matrix.platform }}" == "amd64" ]; then - echo "deb [signed-by=\\\${gpg_key}] \\\${repo_url_amd64}/ ${{ matrix.codename }} main" > \\\${source_list} - echo "deb-src [signed-by=\\\${gpg_key}] \\\${repo_url_amd64}/ ${{ matrix.codename }} main" >> \\\${source_list} - - curl --netrc -o \\\${gpg_key} \\\${repo_url_amd64}/signalwire-freeswitch-repo.gpg || exit 1 - elif [ "${{ matrix.platform }}" == "armhf" ]; then - echo "deb [signed-by=\\\${gpg_key}] \\\${repo_url_armhf}/ ${{ matrix.codename }} main" > \\\${source_list} - echo "deb-src [signed-by=\\\${gpg_key}] \\\${repo_url_armhf}/ ${{ matrix.codename }} main" >> \\\${source_list} - - curl --netrc -o \\\${gpg_key} \\\${repo_url_armhf}/signalwire-freeswitch-repo.gpg || exit 1 - else - echo "Architecture is not supported: ${{ matrix.platform }}" - exit 1 - fi - - echo "# cat \\\${source_list}" && cat \\\${source_list} - - apt-get -q update && apt-get -y install libks2 - secrets: - GENERIC_TOKEN: ${{ secrets.REPOTOKEN }} - - 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/signalwire-c-${{ 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 - exclude: - - codename: bookworm - platform: 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/signalwire-c-${{ 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/signalwire-c-${{ 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 - exclude: - - codename: bookworm - platform: 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/signalwire-c-${{ 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: signalwire-c - 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: signalwire-c-${{ 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 - exclude: - - codename: bookworm - platform: armhf - uses: signalwire/actions-template/.github/workflows/cd-libs-metadata.yml@main - with: - ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-meta - LIB_NAME: signalwire-c - 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: signalwire-c-${{ 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/signalwire-c-${{ 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/signalwire-c-${{ 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 }} diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..718871c --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,112 @@ +name: Build and Distribute + +on: + pull_request: + push: + branches: + - release + - master + paths: + - "**" + workflow_dispatch: + +concurrency: + group: ${{ github.head_ref || github.ref }} + +jobs: + deb: + name: 'DEB' + permissions: + id-token: write + contents: read + uses: signalwire/actions-template/.github/workflows/cicd-docker-build-and-distribute.yml@main + strategy: + # max-parallel: 1 + fail-fast: false + matrix: + os: + - debian + version: + - bookworm + - bullseye + - buster + platform: + - name: amd64 + runner: ubuntu-latest + - name: arm32v7 + runner: ubuntu-latest + exclude: + - version: bookworm + platform: + name: arm32v7 + with: + RUNNER: ${{ matrix.platform.runner }} + ARTIFACTS_PATTERN: '.*\.(deb)$' + DOCKERFILE: .github/docker/${{ matrix.os }}/${{ matrix.version }}/${{ matrix.platform.name }}/Dockerfile + MAINTAINER: 'Andrey Volk ' + META_FILE_PATH_PREFIX: /var/www/signalwire-c/${{ github.ref_name }}/${{ matrix.os }}-${{ matrix.platform.name }}/${{ github.run_id }}-${{ github.run_number }} + PLATFORM: ${{ matrix.platform.name }} + REPO_DOMAIN: freeswitch.signalwire.com + TARGET_ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.version }}-${{ matrix.platform.name }}-artifact + UPLOAD_BUILD_ARTIFACTS: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.title, ':upload-artifacts') }} + secrets: + GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }} + HOSTNAME: ${{ secrets.HOSTNAME }} + PROXY_URL: ${{ secrets.PROXY_URL }} + USERNAME: ${{ secrets.USERNAME }} + TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }} + REPO_USERNAME: 'signalwire' + REPO_PASSWORD: ${{ secrets.REPOTOKEN }} + + rpm: + name: 'RPM' + permissions: + id-token: write + contents: read + uses: signalwire/actions-template/.github/workflows/cicd-docker-build-and-distribute.yml@main + strategy: + # max-parallel: 1 + fail-fast: false + matrix: + os: + - centos + version: + - 7 + platform: + - name: amd64 + runner: ubuntu-latest + with: + RUNNER: ${{ matrix.platform.runner }} + ARTIFACTS_PATTERN: '.*\.(rpm)$' + DOCKERFILE: .github/docker/${{ matrix.os }}/${{ matrix.version }}/${{ matrix.platform.name }}/Dockerfile + MAINTAINER: 'Andrey Volk ' + META_FILE_PATH_PREFIX: /var/www/signalwire-c/${{ github.ref_name }}/${{ matrix.os }}-${{ matrix.platform.name }}/${{ github.run_id }}-${{ github.run_number }} + PLATFORM: ${{ matrix.platform.name }} + REPO_DOMAIN: freeswitch.signalwire.com + TARGET_ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.version }}-${{ matrix.platform.name }}-artifact + UPLOAD_BUILD_ARTIFACTS: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.title, ':upload-artifacts') }} + secrets: + GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }} + HOSTNAME: ${{ secrets.HOSTNAME }} + PROXY_URL: ${{ secrets.PROXY_URL }} + USERNAME: ${{ secrets.USERNAME }} + TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }} + REPO_USERNAME: 'signalwire' + REPO_PASSWORD: ${{ secrets.REPOTOKEN }} + + meta: + name: 'Publish build data to meta-repo' + if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.title, ':upload-artifacts') }} + needs: + - deb + - rpm + permissions: + id-token: write + contents: read + uses: signalwire/actions-template/.github/workflows/meta-repo-content.yml@main + with: + META_CONTENT: '/var/www/signalwire-c/${{ github.ref_name }}/*/${{ github.run_id }}-${{ github.run_number }}' + META_REPO: signalwire/bamboo_gha_trigger + META_REPO_BRANCH: trigger/signalwire-c/${{ github.ref_name }} + secrets: + GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }} From d917968276f787f57644d553de50d6ec1cbb8ab7 Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Sun, 14 Apr 2024 15:56:15 +0200 Subject: [PATCH 09/11] [GHA] Shorten artifact path store location. --- .github/workflows/cicd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 718871c..74810f8 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -44,7 +44,7 @@ jobs: ARTIFACTS_PATTERN: '.*\.(deb)$' DOCKERFILE: .github/docker/${{ matrix.os }}/${{ matrix.version }}/${{ matrix.platform.name }}/Dockerfile MAINTAINER: 'Andrey Volk ' - META_FILE_PATH_PREFIX: /var/www/signalwire-c/${{ github.ref_name }}/${{ matrix.os }}-${{ matrix.platform.name }}/${{ github.run_id }}-${{ github.run_number }} + META_FILE_PATH_PREFIX: /var/www/signalwire-c/${{ github.ref_name }}/${{ github.run_id }}-${{ github.run_number }} PLATFORM: ${{ matrix.platform.name }} REPO_DOMAIN: freeswitch.signalwire.com TARGET_ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.version }}-${{ matrix.platform.name }}-artifact @@ -80,7 +80,7 @@ jobs: ARTIFACTS_PATTERN: '.*\.(rpm)$' DOCKERFILE: .github/docker/${{ matrix.os }}/${{ matrix.version }}/${{ matrix.platform.name }}/Dockerfile MAINTAINER: 'Andrey Volk ' - META_FILE_PATH_PREFIX: /var/www/signalwire-c/${{ github.ref_name }}/${{ matrix.os }}-${{ matrix.platform.name }}/${{ github.run_id }}-${{ github.run_number }} + META_FILE_PATH_PREFIX: /var/www/signalwire-c/${{ github.ref_name }}/${{ github.run_id }}-${{ github.run_number }} PLATFORM: ${{ matrix.platform.name }} REPO_DOMAIN: freeswitch.signalwire.com TARGET_ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.version }}-${{ matrix.platform.name }}-artifact @@ -105,7 +105,7 @@ jobs: contents: read uses: signalwire/actions-template/.github/workflows/meta-repo-content.yml@main with: - META_CONTENT: '/var/www/signalwire-c/${{ github.ref_name }}/*/${{ github.run_id }}-${{ github.run_number }}' + META_CONTENT: '/var/www/signalwire-c/${{ github.ref_name }}/${{ github.run_id }}-${{ github.run_number }}' META_REPO: signalwire/bamboo_gha_trigger META_REPO_BRANCH: trigger/signalwire-c/${{ github.ref_name }} secrets: From 6fdb442697d9af3bddf288b55f8a6c6ff7681f73 Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Wed, 24 Apr 2024 22:10:20 +0200 Subject: [PATCH 10/11] [GHA] Add arm64v8 build target. --- .../docker/debian/bookworm/arm64v8/Dockerfile | 79 +++++++++++++++++++ .../docker/debian/bullseye/arm64v8/Dockerfile | 79 +++++++++++++++++++ .../docker/debian/buster/arm64v8/Dockerfile | 79 +++++++++++++++++++ .github/workflows/cicd.yml | 2 + 4 files changed, 239 insertions(+) create mode 100644 .github/docker/debian/bookworm/arm64v8/Dockerfile create mode 100644 .github/docker/debian/bullseye/arm64v8/Dockerfile create mode 100644 .github/docker/debian/buster/arm64v8/Dockerfile diff --git a/.github/docker/debian/bookworm/arm64v8/Dockerfile b/.github/docker/debian/bookworm/arm64v8/Dockerfile new file mode 100644 index 0000000..ca0ec6c --- /dev/null +++ b/.github/docker/debian/bookworm/arm64v8/Dockerfile @@ -0,0 +1,79 @@ +ARG BUILDER_IMAGE=arm64v8/debian:bookworm +ARG MAINTAINER="Andrey Volk " + +FROM ${BUILDER_IMAGE} AS builder + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER ${MAINTAINER} + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +ENV DATA_DIR=/data +WORKDIR ${DATA_DIR} + +COPY . ${DATA_DIR} +RUN git reset --hard HEAD && git clean -xfd + +RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-release/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + libks2 + +RUN PACKAGE_RELEASE="${BUILD_NUMBER}.${GIT_SHA}" cmake . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="/usr" && \ + make package && mkdir OUT && mv -v *.deb OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/bullseye/arm64v8/Dockerfile b/.github/docker/debian/bullseye/arm64v8/Dockerfile new file mode 100644 index 0000000..987b7fa --- /dev/null +++ b/.github/docker/debian/bullseye/arm64v8/Dockerfile @@ -0,0 +1,79 @@ +ARG BUILDER_IMAGE=arm64v8/debian:bullseye +ARG MAINTAINER="Andrey Volk " + +FROM ${BUILDER_IMAGE} AS builder + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER ${MAINTAINER} + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +ENV DATA_DIR=/data +WORKDIR ${DATA_DIR} + +COPY . ${DATA_DIR} +RUN git reset --hard HEAD && git clean -xfd + +RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-release/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + libks2 + +RUN PACKAGE_RELEASE="${BUILD_NUMBER}.${GIT_SHA}" cmake . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="/usr" && \ + make package && mkdir OUT && mv -v *.deb OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/docker/debian/buster/arm64v8/Dockerfile b/.github/docker/debian/buster/arm64v8/Dockerfile new file mode 100644 index 0000000..ffab385 --- /dev/null +++ b/.github/docker/debian/buster/arm64v8/Dockerfile @@ -0,0 +1,79 @@ +ARG BUILDER_IMAGE=arm64v8/debian:buster +ARG MAINTAINER="Andrey Volk " + +FROM ${BUILDER_IMAGE} AS builder + +# Credentials +ARG REPO_DOMAIN=freeswitch.signalwire.com +ARG REPO_USERNAME=user +ARG REPO_PASSWORD=password + +ARG BUILD_NUMBER=42 +ARG GIT_SHA=0000000000 + +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" + +MAINTAINER ${MAINTAINER} + +SHELL ["/bin/bash", "-c"] + +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + apt-transport-https \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + devscripts \ + dh-autoreconf \ + dos2unix \ + doxygen \ + git \ + graphviz \ + libglib2.0-dev \ + libssl-dev \ + lsb-release \ + pkg-config \ + wget + +RUN update-ca-certificates --fresh + +ENV DATA_DIR=/data +WORKDIR ${DATA_DIR} + +COPY . ${DATA_DIR} +RUN git reset --hard HEAD && git clean -xfd + +RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ + chmod +x ~/.env + +RUN . ~/.env && cat < /etc/apt/sources.list.d/freeswitch.list +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main +EOF + +RUN --mount=type=secret,id=REPO_PASSWORD \ + printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ + printf "login ${REPO_USERNAME} " >> ~/.netrc && \ + printf "password " >> ~/.netrc && \ + cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ + cp -f ~/.netrc /etc/apt/auth.conf + +RUN git config --global --add safe.directory '*' + +RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-release/signalwire-freeswitch-repo.gpg + +# Bootstrap and Build +RUN apt-get -q update && \ + DEBIAN_FRONTEND=noninteractive apt-get -yq install \ + libks2 + +RUN PACKAGE_RELEASE="${BUILD_NUMBER}.${GIT_SHA}" cmake . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="/usr" && \ + make package && mkdir OUT && mv -v *.deb OUT/. + +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) +FROM scratch +COPY --from=builder /data/OUT/ / diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 74810f8..89df0a2 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -35,6 +35,8 @@ jobs: runner: ubuntu-latest - name: arm32v7 runner: ubuntu-latest + - name: arm64v8 + runner: ubuntu-latest exclude: - version: bookworm platform: From 65b18e12bc319d4d46ad4eeb74d2a4fd0b77725c Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 26 Apr 2024 17:11:20 +0300 Subject: [PATCH 11/11] version bump to 2.0.1 --- CMakeLists.txt | 2 +- win/signalwire-client-c-version.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aaa196d..6988cdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ if (WIN32) endif() # Declare our project, SignalWire-Client-C2 -project(SignalWire-Client-C2 VERSION 2.0.0 LANGUAGES C) +project(SignalWire-Client-C2 VERSION 2.0.1 LANGUAGES C) message("SignalWire-Client-C2 ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") # Set package version diff --git a/win/signalwire-client-c-version.props b/win/signalwire-client-c-version.props index b7062e6..6929580 100644 --- a/win/signalwire-client-c-version.props +++ b/win/signalwire-client-c-version.props @@ -4,8 +4,8 @@ - 2.0.0 - 1 + 2.0.1 + 0 $(BaseDir)../