Skip to content

Commit d2c441a

Browse files
committed
Raw cross-build
1 parent 0ea6760 commit d2c441a

1 file changed

Lines changed: 32 additions & 9 deletions

File tree

.github/workflows/stable.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ jobs:
208208
runs-on: ubuntu-latest
209209
strategy:
210210
matrix:
211-
target: ["aarch64-unknown-linux-gnu","i686-unknown-linux-gnu"]
211+
targets: [
212+
["aarch64-unknown-linux-gnu", "arm64", "aarch64"],
213+
["i686-unknown-linux-gnu", "i386", "i686"],
214+
]
212215
# Only run on "pull_request" event for external PRs. This is to avoid
213216
# duplicate builds for PRs created from internal branches.
214217
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
@@ -222,15 +225,35 @@ jobs:
222225
uses: dtolnay/rust-toolchain@master
223226
with:
224227
toolchain: ${{ env.RUSTTOOLCHAIN }}
228+
targets: ${{ matrix.targets[0] }}
225229

226-
- name: Install cargo-binstall
227-
uses: cargo-bins/cargo-binstall@main
228-
229-
- name: Install cross
230-
run: cargo-binstall -y cross
231-
232-
- name: Run cargo test using cross
233-
run: cross test --target=${{ matrix.target }} --verbose --all-targets ${{ env.NO_BORING_OPTIONS }}
230+
- name: Debian cross setup ${{ matrix.targets[1] }}
231+
run: |
232+
QEMU_PACKAGES=""
233+
if [[ "${{ matrix.targets[1] }}" != "i386" ]]; then
234+
QEMU_PACKAGES="qemu-user libc6:${{ matrix.targets[1] }}"
235+
236+
sudo dpkg --add-architecture ${{ matrix.targets[1] }}
237+
# In Ubuntu only ports have packages for other architectures
238+
THE_ANIMAL_DJ=$(lsb_release -sc)
239+
echo "
240+
deb [arch=${{ matrix.targets[1] }}] http://ports.ubuntu.com/ubuntu-ports/ ${THE_ANIMAL_DJ} main restricted universe multiverse
241+
deb [arch=${{ matrix.targets[1] }}] http://ports.ubuntu.com/ubuntu-ports/ ${THE_ANIMAL_DJ}-updates main restricted universe multiverse
242+
deb [arch=${{ matrix.targets[1] }}] http://ports.ubuntu.com/ubuntu-ports/ ${THE_ANIMAL_DJ}-security main restricted universe multiverse
243+
" | sudo tee /etc/apt/sources.list.d/cross-${{ matrix.targets[1] }}.list
244+
sudo apt-get update || true
245+
246+
echo >> $GITHUB_ENV CARGO_TARGET_$(echo ${{ matrix.targets[0] }} | tr '[:lower:]-' '[:upper:]_')_RUNNER=qemu-${{ matrix.targets[2] }}
247+
fi
248+
249+
sudo apt-get -y --no-install-recommends install crossbuild-essential-${{ matrix.targets[1] }} libclang-dev $QEMU_PACKAGES
250+
251+
echo >> $GITHUB_ENV CC=/usr/bin/${{ matrix.targets[2] }}-linux-gnu-gcc
252+
echo >> $GITHUB_ENV CXX=/usr/bin/${{ matrix.targets[2] }}-linux-gnu-g++
253+
echo >> $GITHUB_ENV CARGO_TARGET_$(echo ${{ matrix.targets[0] }} | tr '[:lower:]-' '[:upper:]_')_LINKER=/usr/bin/${{ matrix.targets[2] }}-linux-gnu-gcc
254+
255+
- name: Run cargo test ${{ matrix.targets[1] }}
256+
run: cargo test --target=${{ matrix.targets[0] }} --verbose --all-targets ${{ env.NO_BORING_OPTIONS }}
234257

235258
http3_test:
236259
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)