# @credits https://github.com/c0re100/qBittorrent-Enhanced-Edition
description: "Distinct id"
description: "Alpine: workflow-files files"
description: "enable icu"
description: "debug builds"
description: "script name"
runs-on: ubuntu-24.04-arm
qbt_cross_name: ["armhf", "armv7", "aarch64", "x86_64", "x86"]
qbt_libtorrent_version: ["1.2", "2.0"]
qbt_build_tool: ["", "qmake"]
- qbt_build_tool: "qmake"
qbt_qt_version_name: "qt5-"
name: "${{ matrix.qbt_cross_name }}-${{ matrix.qbt_qt_version_name }}libtorrent-v${{ matrix.qbt_libtorrent_version }}"
qbt_build_dir: "qbt-build"
script_name: ${{ inputs.script_name }}
container_name: "multiarch"
- name: Checkout ${{ inputs.distinct_id }}
uses: actions/checkout@v4
persist-credentials: false
- name: Host - Create Docker template env file ${{ inputs.distinct_id }}
set_skip_icu: ${{ inputs.icu }}
set_workflow_files: ${{ inputs.workflow-files }}
set_build_debug: ${{ inputs.debug }}
printf '%s\n' "qbt_build_dir=${{ env.qbt_build_dir }}" > env.custom
printf '%s\n' "qbt_libtorrent_version=${{ matrix.qbt_libtorrent_version }}" >> env.custom
printf '%s\n' "qbt_qt_version=${{ matrix.qbt_qt_version }}" >> env.custom
printf '%s\n' "qbt_build_tool=${{ matrix.qbt_build_tool }}" >> env.custom
printf '%s\n' "qbt_cross_name=${{ matrix.qbt_cross_name }}" >> env.custom
printf '%s\n' "qbt_patches_url=${{ github.repository }}" >> env.custom
printf '%s\n' "qbt_skip_icu=${set_skip_icu}" >> env.custom
printf '%s\n' "qbt_boost_tag=${{ matrix.qbt_boost_tag }}" >> env.custom
printf '%s\n' "qbt_libtorrent_tag=${{ matrix.qbt_libtorrent_tag }}" >> env.custom
printf '%s\n' "qbt_qt_tag=${{ matrix.qbt_qt_tag }}" >> env.custom
printf '%s\n' "qbt_qbittorrent_tag=${{ matrix.qbt_qbittorrent_tag }}" >> env.custom
printf '%s\n' "qbt_libtorrent_master_jamfile=" >> env.custom
printf '%s\n' "qbt_workflow_files=${set_workflow_files}" >> env.custom
printf '%s\n' "qbt_workflow_artifacts=" >> env.custom
printf '%s\n' "qbt_cache_dir=" >> env.custom
printf '%s\n' "qbt_optimise_strip=" >> env.custom
printf '%s\n' "qbt_build_debug=${set_build_debug}" >> env.custom
printf '%s\n' "qbt_revision_url=${{ github.repository }}" >> env.custom
printf '%s\n' "qbt_standard=" >> env.custom
printf '%s\n' "qbt_static_ish=" >> env.custom
# - name: Host - Github env to container ${{ inputs.distinct_id }}
- name: Host - check stuff ${{ inputs.distinct_id }}
run: export $(cat env.custom) && bash ${script_name}
- name: Host - qBittorrent v5 transition ${{ inputs.distinct_id }}
if [[ -f "${qbt_build_dir}/release_info/disable-qt5" || -f "disable-qt5" ]]; then
printf '%s\n' "disable_qt5=yes" >> $GITHUB_ENV
printf '%s\n' "Found file: \`disable-qt5\` -> setting env: \`disable_qt5=yes\`" >> $GITHUB_STEP_SUMMARY
- name: Host - phased updates ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: printf '%s\n' 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates
- name: Host - update ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
# - name: Host - upgrade ${{ inputs.distinct_id }}
# run: sudo apt-get -y upgrade
- name: Host - set up qemu-user-static binfmt-support ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: sudo apt install libpipeline1 qemu-user-static binfmt-support
- name: Host - Create docker ${{ env.multiarch }} container ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
# We create an Alpine edge container for cross-compilation with a user named gh which has same id as runner 1001 and provide sudo access
# This way we can run commands as a non-root user, avoiding permission issues on host runner. Switching between user and root as needed.
docker run --name ${container_name} -it -d --env-file env.custom -w /home/gh -v ${{ github.workspace }}:/home/gh ${{ matrix.os_id }}:${{ matrix.os_version_id }}
# Create the user gh with the id 1001:1001 which is the same as the runner user id and group id.
docker exec ${container_name} sh -c 'adduser -h /home/gh -Ds /bin/bash -u 1001 gh && apk add sudo'
# Allow the user gh to run sudo without password prompt: docker exec -u gh:gh ${container_name} sudo ls
docker exec ${container_name} sh -c 'printf "%s" "gh ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/gh'
- name: Docker - apk update ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec ${container_name} apk update
- name: Docker - apk install bash ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec ${container_name} apk add bash
- name: Docker - Bootstrap test tools ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec ${container_name} bash ${script_name} update install_test
- name: Docker - Bootstrap core deps ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec ${container_name} bash ${script_name} install_core
- name: Docker - Bootstrap build ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh ${container_name} bash ${script_name} -bs-a
- name: Docker - zlib-ng ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh ${container_name} bash ${script_name} zlib
- name: Docker - iconv ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh ${container_name} bash ${script_name} iconv
- name: Docker - icu ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh ${container_name} bash ${script_name} icu
- name: Docker - openssl ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh ${container_name} bash ${script_name} openssl
- name: Docker - boost ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh ${container_name} bash ${script_name} boost
- name: Docker - libtorrent ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh ${container_name} bash ${script_name} libtorrent
- name: Docker - double_conversion ${{ inputs.distinct_id }}
if: matrix.qbt_build_tool == '' && env.disable_qt5 != 'yes'
run: docker exec -u gh:gh ${container_name} bash ${script_name} double_conversion
- name: Docker - qtbase ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh ${container_name} bash ${script_name} qtbase
- name: Docker - qttools ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh ${container_name} bash ${script_name} qttools
- name: Docker - qbittorrent ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh ${container_name} bash ${script_name} qbittorrent
- name: Docker - Set release asset name ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh -w /home/gh/${{ env.qbt_build_dir }}/completed ${container_name} mv -f qbittorrent-nox ${{ matrix.qbt_cross_name }}-${{ matrix.qbt_qt_version_name }}qbittorrent-nox
- name: Generate artifact attestation ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
uses: actions/attest-build-provenance@v2
subject-path: "${{ env.qbt_build_dir }}/completed/${{ matrix.qbt_cross_name }}-${{ matrix.qbt_qt_version_name }}qbittorrent-nox"
- name: Docker - Release Info ${{ inputs.distinct_id }}
if: env.disable_qt5 != 'yes'
run: docker exec -u gh:gh -w /home/gh/${{ env.qbt_build_dir }}/release_info ${container_name} bash -c 'mv *.md *.json '/home/gh/${{ env.qbt_build_dir }}/completed''
- name: Host - Upload libtorrent-v${{ matrix.qbt_libtorrent_version }}-qbittorrent-nox and release info artifact ${{ inputs.distinct_id }}
if: success() && env.disable_qt5 != 'yes'
uses: actions/upload-artifact@v4
name: libtorrent-v${{ matrix.qbt_libtorrent_version }}-${{ matrix.qbt_cross_name }}-${{ matrix.qbt_qt_version_name }}qbittorrent-nox
${{ env.qbt_build_dir }}/completed/*
!${{ env.qbt_build_dir }}/completed/*.png
- name: Host - Upload cmake graphs artifact ${{ inputs.distinct_id }}
if: success() && matrix.qbt_build_tool == '' && env.disable_qt5 != 'yes'
uses: actions/upload-artifact@v4
name: "${{ matrix.qbt_cross_name }}-libtorrent-v${{ matrix.qbt_libtorrent_version }}-graphs"
path: "${{ env.qbt_build_dir }}/completed/*.png"
- name: Host - Upload logs on error
if: failure() && env.disable_qt5 != 'yes'
uses: actions/upload-artifact@v4
name: "${{ matrix.qbt_cross_name }}-libtorrent-v${{ matrix.qbt_libtorrent_version }}-logs"
path: "${{ env.qbt_build_dir }}/logs/*"