1- # @credits https://github.com/c0re100/qBittorrent-Enhanced-Edition
21name : ci - alpine build
32
43on :
@@ -24,184 +23,160 @@ on:
2423 description : " script name"
2524 required : true
2625 type : string
26+
2727jobs :
28- build-alpine :
29- runs-on : ubuntu-24.04-arm
28+ build :
29+ runs-on : ${{ matrix.runs_on }}
3030 strategy :
3131 fail-fast : false
3232 matrix :
33+ runs_on : ["ubuntu-24.04-arm"]
3334 os_id : [alpine]
3435 os_version_id : [edge]
3536 qbt_cross_name : ["armhf", "armv7", "aarch64", "riscv64", "x86_64", "x86"]
3637 qbt_libtorrent_version : ["1.2", "2.0"]
37- qbt_build_tool : ["", "qmake"]
38+ qbt_build_tool : [""]
39+ qbt_qbittorrent_tag : [""]
3840 include :
39- - qbt_build_tool : " qmake"
40- qbt_qt_version_name : " qt5-"
41- qbt_qt_version : " 5"
4241 - qbt_build_tool : " "
4342 qbt_qt_version_name : " "
44- qbt_qt_version : " 6"
4543
4644 name : " ${{ matrix.qbt_cross_name }}-${{ matrix.qbt_qt_version_name }}libtorrent-v${{ matrix.qbt_libtorrent_version }}"
4745
4846 env :
4947 qbt_build_dir : " qbt-build"
50- script_name : ${{ inputs.script_name }}
5148 container_name : " multiarch"
49+ script_name : ${{ inputs.script_name }}
50+ set_skip_icu : ${{ inputs.icu }}
51+ set_workflow_files : ${{ inputs.workflow-files }}
52+ set_build_debug : ${{ inputs.debug }}
53+ set_qbt_mcm_url : " " # default is userdocs/qbt-musl-cross-make
54+ set_qbt_with_qemu : " " # default is yes
55+ set_qbt_host_deps : " " # default is no
56+ set_qbt_host_deps_repo : " " # default is userdocs/qbt-host-deps
5257
5358 steps :
5459 - name : Checkout ${{ inputs.distinct_id }}
5560 uses : actions/checkout@v4
5661 with :
5762 persist-credentials : false
5863
64+ # - name: Download qbt-nox-static.bash
65+ # run: |
66+ # # Make sure the branch is set to master for qbittorrent-nox-static and main qbittorrent-nox-static-test
67+ # curl -LO "https://raw.githubusercontent.com/userdocs/qbittorrent-nox-static/refs/heads/master/${script_name}"
68+ # chmod +x "${script_name}"
69+
5970 - name : Host - Create Docker template env file ${{ inputs.distinct_id }}
60- env :
61- set_skip_icu : ${{ inputs.icu }}
62- set_workflow_files : ${{ inputs.workflow-files }}
63- set_build_debug : ${{ inputs.debug }}
6471 run : |
65- printf '%s\n' "qbt_build_dir=${{ env.qbt_build_dir }}" > env.custom
66- printf '%s\n' "qbt_libtorrent_version=${{ matrix.qbt_libtorrent_version }}" >> env.custom
67- printf '%s\n' "qbt_qt_version=${{ matrix.qbt_qt_version }}" >> env.custom
68- printf '%s\n' "qbt_build_tool=${{ matrix.qbt_build_tool }}" >> env.custom
69- printf '%s\n' "qbt_cross_name=${{ matrix.qbt_cross_name }}" >> env.custom
70- printf '%s\n' "qbt_patches_url=${{ github.repository }}" >> env.custom
72+ printf '%s\n' "qbt_revision_url=${{ github.repository }}" > env.custom
73+ printf '%s\n' "qbt_zlib_type=zlib" >> env.custom
7174 printf '%s\n' "qbt_skip_icu=${set_skip_icu}" >> env.custom
7275 printf '%s\n' "qbt_boost_tag=${{ matrix.qbt_boost_tag }}" >> env.custom
76+ printf '%s\n' "qbt_libtorrent_version=${{ matrix.qbt_libtorrent_version }}" >> env.custom
7377 printf '%s\n' "qbt_libtorrent_tag=${{ matrix.qbt_libtorrent_tag }}" >> env.custom
78+ printf '%s\n' "qbt_libtorrent_master_jamfile=" >> env.custom
79+ printf '%s\n' "qbt_qt_version=${{ matrix.qbt_qt_version }}" >> env.custom
7480 printf '%s\n' "qbt_qt_tag=${{ matrix.qbt_qt_tag }}" >> env.custom
7581 printf '%s\n' "qbt_qbittorrent_tag=${{ matrix.qbt_qbittorrent_tag }}" >> env.custom
76- printf '%s\n' "qbt_libtorrent_master_jamfile=" >> env.custom
82+ printf '%s\n' "qbt_build_dir=${{ env.qbt_build_dir }}" >> env.custom
83+ printf '%s\n' "qbt_build_tool=${{ matrix.qbt_build_tool }}" >> env.custom
84+ printf '%s\n' "qbt_cross_name=${{ matrix.qbt_cross_name }}" >> env.custom
85+ printf '%s\n' "qbt_mcm_url=${set_qbt_mcm_url}" >> env.custom
86+ printf '%s\n' "qbt_patches_url=${{ github.repository }}" >> env.custom
7787 printf '%s\n' "qbt_workflow_files=${set_workflow_files}" >> env.custom
78- printf '%s\n' "qbt_workflow_artifacts=" >> env.custom
7988 printf '%s\n' "qbt_cache_dir=" >> env.custom
8089 printf '%s\n' "qbt_optimise_strip=" >> env.custom
8190 printf '%s\n' "qbt_build_debug=${set_build_debug}" >> env.custom
82- printf '%s\n' "qbt_revision_url=${{ github.repository }}" >> env.custom
8391 printf '%s\n' "qbt_standard=" >> env.custom
8492 printf '%s\n' "qbt_static_ish=" >> env.custom
93+ printf '%s\n' "qbt_optimise=${qbt_optimise}" >> env.custom
94+ printf '%s\n' "qbt_with_qemu=${set_qbt_with_qemu}" >> env.custom
95+ printf '%s\n' "qbt_host_deps=${set_qbt_host_deps}" >> env.custom
96+ printf '%s\n\n' "qbt_host_deps_repo=${set_qbt_host_deps_repo}" >> env.custom
8597
86- # - name: Host - Github env to container ${{ inputs.distinct_id }}
87- # run: env >> env.custom
88-
89- - name : Host - check stuff ${{ inputs.distinct_id }}
90- run : export $(cat env.custom) && bash ${script_name}
91-
92- - name : Host - qBittorrent v5 transition ${{ inputs.distinct_id }}
98+ - name : Host - Debian based specific env ${{ inputs.distinct_id }}
99+ if : matrix.os_id != 'alpine'
93100 run : |
94- if [[ -f "${qbt_build_dir}/release_info/disable-qt5" || -f "disable-qt5" ]]; then
95- printf '%s\n' "disable_qt5=yes" >> $GITHUB_ENV
96- printf '%s\n' "Found file: \`disable-qt5\` -> setting env: \`disable_qt5=yes\`" >> $GITHUB_STEP_SUMMARY
97- fi
98-
99- - name : Host - phased updates ${{ inputs.distinct_id }}
100- if : env.disable_qt5 != 'yes'
101- run : printf '%s\n' 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates
101+ printf '%s\n' "LANG=C.UTF-8" >> env.custom
102+ printf '%s\n' "LC_ALL=C.UTF-8" >> env.custom
103+ printf '%s\n\n' "DEBIAN_FRONTEND=noninteractive" >> env.custom
102104
103- - name : Host - update ${{ inputs.distinct_id }}
104- if : env.disable_qt5 != 'yes'
105- run : sudo apt-get update
105+ - name : Host - Bootstrap qemu
106+ uses : userdocs/actions/qemu@main
106107
107- # - name: Host - upgrade ${{ inputs.distinct_id }}
108- # run: sudo apt-get -y upgrade
109-
110- - name : Host - set up qemu-user-static binfmt-support ${{ inputs.distinct_id }}
111- if : env.disable_qt5 != 'yes'
112- run : sudo apt install libpipeline1 qemu-user-static binfmt-support
113-
114- - name : Host - Create docker ${{ env.multiarch }} container ${{ inputs.distinct_id }}
115- if : env.disable_qt5 != 'yes'
116- run : |
117- # 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
118- # This way we can run commands as a non-root user, avoiding permission issues on host runner. Switching between user and root as needed.
119- 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 }}
120- # Create the user gh with the id 1001:1001 which is the same as the runner user id and group id.
121- docker exec ${container_name} sh -c 'adduser -h /home/gh -Ds /bin/bash -u 1001 gh && apk add sudo'
122- # Allow the user gh to run sudo without password prompt: docker exec -u gh:gh ${container_name} sudo ls
123- docker exec ${container_name} sh -c 'printf "%s" "gh ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/gh'
108+ - uses : userdocs/actions/qbt_docker@main
109+ with :
110+ # if the env.custom file exists, it will be used to pass environment
111+ distinct_id : ${{ inputs.distinct_id }}
112+ use_host_env : " false"
113+ container_name : ${{ env.container_name }}
114+ os_id : ${{ matrix.os_id }}
115+ os_version_id : ${{ matrix.os_version_id }}
116+ custom_docker_commands : " "
117+ additional_alpine_apps : " bash curl git"
118+ additional_debian_apps : " bash curl git"
124119
125120 - name : Host - patches ${{ inputs.distinct_id }}
126- if : env.disable_qt5 != 'yes'
127121 run : mkdir -p ${qbt_build_dir}/patches && cp -r patches/* ${qbt_build_dir}/patches/
128122
129- - name : Docker - apk update ${{ inputs.distinct_id }}
130- if : env.disable_qt5 != 'yes'
131- run : docker exec ${container_name} apk update
132-
133- - name : Docker - apk install bash ${{ inputs.distinct_id }}
134- if : env.disable_qt5 != 'yes'
135- run : docker exec ${container_name} apk add bash
136-
137- - name : Docker - Bootstrap test tools ${{ inputs.distinct_id }}
138- if : env.disable_qt5 != 'yes'
139- run : docker exec ${container_name} bash ${script_name} update install_test
140-
141- - name : Docker - Bootstrap core deps ${{ inputs.distinct_id }}
142- if : env.disable_qt5 != 'yes'
143- run : docker exec ${container_name} bash ${script_name} install_core
123+ - name : Docker - bootstrap_deps ${{ inputs.distinct_id }}
124+ if : inputs.script_name == 'qbt-nox-static.bash'
125+ run : docker exec -u gh:gh ${container_name} bash ${script_name} bootstrap_deps
144126
145127 - name : Docker - Bootstrap build ${{ inputs.distinct_id }}
146- if : env.disable_qt5 != 'yes'
147128 run : docker exec -u gh:gh ${container_name} bash ${script_name} -bs-a
148129
149- - name : Docker - zlib-ng ${{ inputs.distinct_id }}
150- if : env.disable_qt5 != 'yes'
130+ - name : Docker - glibc ${{ inputs.distinct_id }}
131+ if : matrix.os_id != 'alpine'
132+ run : docker exec -u gh:gh ${container_name} bash ${script_name} glibc
133+
134+ - name : Docker - zlib ${{ inputs.distinct_id }}
151135 run : docker exec -u gh:gh ${container_name} bash ${script_name} zlib
152136
153137 - name : Docker - iconv ${{ inputs.distinct_id }}
154- if : env.disable_qt5 != 'yes '
138+ if : matrix.qbt_libtorrent_version == '1.2 '
155139 run : docker exec -u gh:gh ${container_name} bash ${script_name} iconv
156140
157141 - name : Docker - icu ${{ inputs.distinct_id }}
158- if : env.disable_qt5 != 'yes '
142+ if : env.set_skip_icu == 'no '
159143 run : docker exec -u gh:gh ${container_name} bash ${script_name} icu
160144
161145 - name : Docker - openssl ${{ inputs.distinct_id }}
162- if : env.disable_qt5 != 'yes'
163146 run : docker exec -u gh:gh ${container_name} bash ${script_name} openssl
164147
165148 - name : Docker - boost ${{ inputs.distinct_id }}
166- if : env.disable_qt5 != 'yes'
167149 run : docker exec -u gh:gh ${container_name} bash ${script_name} boost
168150
169151 - name : Docker - libtorrent ${{ inputs.distinct_id }}
170- if : env.disable_qt5 != 'yes'
171152 run : docker exec -u gh:gh ${container_name} bash ${script_name} libtorrent
172153
173154 - name : Docker - double_conversion ${{ inputs.distinct_id }}
174- if : matrix.qbt_build_tool == '' && env.disable_qt5 != 'yes'
155+ if : matrix.qbt_build_tool == ''
175156 run : docker exec -u gh:gh ${container_name} bash ${script_name} double_conversion
176157
177158 - name : Docker - qtbase ${{ inputs.distinct_id }}
178- if : env.disable_qt5 != 'yes'
179159 run : docker exec -u gh:gh ${container_name} bash ${script_name} qtbase
180160
181161 - name : Docker - qttools ${{ inputs.distinct_id }}
182- if : env.disable_qt5 != 'yes'
183162 run : docker exec -u gh:gh ${container_name} bash ${script_name} qttools
184163
185164 - name : Docker - qbittorrent ${{ inputs.distinct_id }}
186- if : env.disable_qt5 != 'yes'
187165 run : docker exec -u gh:gh ${container_name} bash ${script_name} qbittorrent
188166
189167 - name : Docker - Set release asset name ${{ inputs.distinct_id }}
190- if : env.disable_qt5 != 'yes'
191168 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
192169
193170 - name : Generate artifact attestation ${{ inputs.distinct_id }}
194- if : env.disable_qt5 != 'yes'
195171 uses : actions/attest-build-provenance@v2
196172 with :
197173 subject-path : " ${{ env.qbt_build_dir }}/completed/${{ matrix.qbt_cross_name }}-${{ matrix.qbt_qt_version_name }}qbittorrent-nox"
198174
199175 - name : Docker - Release Info ${{ inputs.distinct_id }}
200- if : env.disable_qt5 != 'yes'
201176 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''
202177
203178 - name : Host - Upload libtorrent-v${{ matrix.qbt_libtorrent_version }}-qbittorrent-nox and release info artifact ${{ inputs.distinct_id }}
204- if : success() && env.disable_qt5 != 'yes'
179+ if : success()
205180 uses : actions/upload-artifact@v4
206181 with :
207182 name : libtorrent-v${{ matrix.qbt_libtorrent_version }}-${{ matrix.qbt_cross_name }}-${{ matrix.qbt_qt_version_name }}qbittorrent-nox
@@ -210,15 +185,15 @@ jobs:
210185 !${{ env.qbt_build_dir }}/completed/*.png
211186
212187 - name : Host - Upload cmake graphs artifact ${{ inputs.distinct_id }}
213- if : success() && matrix.qbt_build_tool == '' && env.disable_qt5 != 'yes'
188+ if : success() && matrix.qbt_build_tool == ''
214189 uses : actions/upload-artifact@v4
215190 with :
216191 name : " ${{ matrix.qbt_cross_name }}-libtorrent-v${{ matrix.qbt_libtorrent_version }}-graphs"
217192 path : " ${{ env.qbt_build_dir }}/completed/*.png"
218193
219- - name : Host - Upload logs on error
220- if : failure() && env.disable_qt5 != 'yes'
221- uses : actions/upload-artifact@v4
222- with :
223- name : " ${{ matrix.qbt_cross_name }}-libtorrent-v${{ matrix.qbt_libtorrent_version }}-logs"
224- path : " ${{ env.qbt_build_dir }}/logs/* "
194+ # - name: Host - Upload build dir on error or cancel
195+ # if: ( cancelled() || failure() )
196+ # uses: actions/upload-artifact@v4
197+ # with:
198+ # name: "${{ matrix.qbt_cross_name }}-libtorrent-v${{ matrix.qbt_libtorrent_version }}-logs"
199+ # path: "${{ env.qbt_build_dir }}"
0 commit comments