2626 type : string
2727jobs :
2828 build-alpine :
29- runs-on : ubuntu-24.04
29+ runs-on : ubuntu-24.04-arm
3030 strategy :
3131 fail-fast : false
3232 matrix :
@@ -48,25 +48,14 @@ jobs:
4848 env :
4949 qbt_build_dir : " qbt-build"
5050 script_name : ${{ inputs.script_name }}
51+ container_name : " multiarch"
5152
5253 steps :
5354 - name : Checkout ${{ inputs.distinct_id }}
5455 uses : actions/checkout@v4
5556 with :
5657 persist-credentials : false
5758
58- - name : Host - phased updates ${{ inputs.distinct_id }}
59- run : printf '%s\n' 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates
60-
61- - name : Host - update ${{ inputs.distinct_id }}
62- run : sudo apt-get update
63-
64- # - name: Host - upgrade ${{ inputs.distinct_id }}
65- # run: sudo apt-get -y upgrade
66-
67- - name : Host - set up qemu-user-static binfmt-support ${{ inputs.distinct_id }}
68- run : sudo apt install libpipeline1 qemu-user-static binfmt-support
69-
7059 - name : Host - Create Docker template env file ${{ inputs.distinct_id }}
7160 env :
7261 set_skip_icu : ${{ inputs.icu }}
@@ -94,71 +83,108 @@ jobs:
9483 printf '%s\n' "qbt_standard=" >> env.custom
9584 printf '%s\n' "qbt_static_ish=" >> env.custom
9685
97- - name : Host - Create docker multiarch container ${{ inputs.distinct_id }}
98- run : docker run --name multiarch -it -d --env-file env.custom -w /root -v ${{ github.workspace }}:/root ${{ matrix.os_id }}:${{ matrix.os_version_id }}
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 }}
93+ 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
102+
103+ - name : Host - update ${{ inputs.distinct_id }}
104+ if : env.disable_qt5 != 'yes'
105+ run : sudo apt-get update
106+
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'
99124
100125 - name : Docker - apk update ${{ inputs.distinct_id }}
101- run : docker exec -w /root multiarch apk update
126+ if : env.disable_qt5 != 'yes'
127+ run : docker exec ${container_name} apk update
102128
103129 - name : Docker - apk install bash ${{ inputs.distinct_id }}
104- run : docker exec -w /root multiarch apk add bash
130+ if : env.disable_qt5 != 'yes'
131+ run : docker exec ${container_name} apk add bash
105132
106- - name : Docker - Bootstrap deps ${{ inputs.distinct_id }}
107- run : docker exec -w /root multiarch bash ${script_name} bootstrap_deps
133+ - name : Docker - Bootstrap test tools ${{ inputs.distinct_id }}
134+ if : env.disable_qt5 != 'yes'
135+ run : docker exec ${container_name} bash ${script_name} update install_test
108136
109- - name : Docker - Bootstrap build ${{ inputs.distinct_id }}
110- run : docker exec -w /root multiarch bash ${script_name} -bs-a
137+ - name : Docker - Bootstrap core deps ${{ inputs.distinct_id }}
138+ if : env.disable_qt5 != 'yes'
139+ run : docker exec ${container_name} bash ${script_name} install_core
111140
112- - name : Host - qBittorrent v5 transition ${{ inputs.distinct_id }}
113- run : |
114- if [[ -f "${qbt_build_dir}/release_info/disable-qt5" ]]; then
115- printf '%s\n' "disable_qt5=yes" >> $GITHUB_ENV
116- printf '%s\n' "Found file: \`disable-qt5\`: settings \`disable_qt5=yes\` to yes" >> $GITHUB_STEP_SUMMARY
117- fi
141+ - name : Docker - Bootstrap build ${{ inputs.distinct_id }}
142+ if : env.disable_qt5 != 'yes'
143+ run : docker exec -u gh:gh ${container_name} bash ${script_name} -bs-a
118144
119145 - name : Docker - zlib-ng ${{ inputs.distinct_id }}
120146 if : env.disable_qt5 != 'yes'
121- run : docker exec -w /root multiarch bash ${script_name} zlib
147+ run : docker exec -u gh:gh ${container_name} bash ${script_name} zlib
122148
123149 - name : Docker - iconv ${{ inputs.distinct_id }}
124150 if : env.disable_qt5 != 'yes'
125- run : docker exec -w /root multiarch bash ${script_name} iconv
151+ run : docker exec -u gh:gh ${container_name} bash ${script_name} iconv
126152
127153 - name : Docker - icu ${{ inputs.distinct_id }}
128154 if : env.disable_qt5 != 'yes'
129- run : docker exec -w /root multiarch bash ${script_name} icu
155+ run : docker exec -u gh:gh ${container_name} bash ${script_name} icu
130156
131157 - name : Docker - openssl ${{ inputs.distinct_id }}
132158 if : env.disable_qt5 != 'yes'
133- run : docker exec -w /root multiarch bash ${script_name} openssl
159+ run : docker exec -u gh:gh ${container_name} bash ${script_name} openssl
134160
135161 - name : Docker - boost ${{ inputs.distinct_id }}
136162 if : env.disable_qt5 != 'yes'
137- run : docker exec -w /root multiarch bash ${script_name} boost
163+ run : docker exec -u gh:gh ${container_name} bash ${script_name} boost
138164
139165 - name : Docker - libtorrent ${{ inputs.distinct_id }}
140166 if : env.disable_qt5 != 'yes'
141- run : docker exec -w /root multiarch bash ${script_name} libtorrent
167+ run : docker exec -u gh:gh ${container_name} bash ${script_name} libtorrent
142168
143169 - name : Docker - double_conversion ${{ inputs.distinct_id }}
144170 if : matrix.qbt_build_tool == '' && env.disable_qt5 != 'yes'
145- run : docker exec -w /root multiarch bash ${script_name} double_conversion
171+ run : docker exec -u gh:gh ${container_name} bash ${script_name} double_conversion
146172
147173 - name : Docker - qtbase ${{ inputs.distinct_id }}
148174 if : env.disable_qt5 != 'yes'
149- run : docker exec -w /root multiarch bash ${script_name} qtbase
175+ run : docker exec -u gh:gh ${container_name} bash ${script_name} qtbase
150176
151177 - name : Docker - qttools ${{ inputs.distinct_id }}
152178 if : env.disable_qt5 != 'yes'
153- run : docker exec -w /root multiarch bash ${script_name} qttools
179+ run : docker exec -u gh:gh ${container_name} bash ${script_name} qttools
154180
155181 - name : Docker - qbittorrent ${{ inputs.distinct_id }}
156182 if : env.disable_qt5 != 'yes'
157- run : docker exec -w /root multiarch bash ${script_name} qbittorrent
183+ run : docker exec -u gh:gh ${container_name} bash ${script_name} qbittorrent
158184
159185 - name : Docker - Set release asset name ${{ inputs.distinct_id }}
160186 if : env.disable_qt5 != 'yes'
161- run : docker exec -w /root/ ${{ env.qbt_build_dir }}/completed multiarch mv -f qbittorrent-nox ${{ matrix.qbt_cross_name }}-${{ matrix.qbt_qt_version_name }}qbittorrent-nox
187+ 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
162188
163189 - name : Generate artifact attestation ${{ inputs.distinct_id }}
164190 if : env.disable_qt5 != 'yes'
@@ -168,7 +194,7 @@ jobs:
168194
169195 - name : Docker - Release Info ${{ inputs.distinct_id }}
170196 if : env.disable_qt5 != 'yes'
171- run : docker exec -w /root/ ${{ env.qbt_build_dir }}/release_info multiarch bash -c 'mv *.md *.json '/root /${{ env.qbt_build_dir }}/completed''
197+ 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''
172198
173199 - name : Host - Upload libtorrent-v${{ matrix.qbt_libtorrent_version }}-qbittorrent-nox and release info artifact ${{ inputs.distinct_id }}
174200 if : success() && env.disable_qt5 != 'yes'
0 commit comments