Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit 280f272

Browse files
authored
Merge pull request #3639 from lissyx/ga-linux-armv7-aarch64
CI: Linux ARMv7 / Aarch64
2 parents 510d161 + 0068437 commit 280f272

File tree

24 files changed

+1111
-34
lines changed

24 files changed

+1111
-34
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "chroot bind mount"
2+
description: "Bind mount into chroot"
3+
inputs:
4+
mounts:
5+
description: "Path to consider"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- id: install_qemu
11+
run: |
12+
sudo apt-get update -y
13+
sudo apt-get install -y --no-install-recommends qemu-user-static
14+
shell: bash
15+
- id: bind_mount_chroot
16+
run: |
17+
set -xe
18+
19+
# Bind-mount so that we have the same tree inside the chroot
20+
for dev in ${{ github.workspace }} ${{ inputs.mounts }};
21+
do
22+
sudo mount -o bind ${dev} ${{ env.SYSTEM_RASPBIAN }}${dev}
23+
done;
24+
25+
for dev in ${{ inputs.mounts }};
26+
do
27+
sudo mount -o bind /${dev} ${{ env.SYSTEM_RASPBIAN }}/${dev}
28+
done;
29+
shell: bash

.github/actions/get_cache_key/action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ inputs:
44
extras:
55
description: "Extra cache key value"
66
required: true
7+
osarch:
8+
description: "Override automatic OSARCH value"
9+
required: false
710
outputs:
811
key:
912
description: "Computed cache key name"
@@ -16,7 +19,12 @@ runs:
1619
JOB=${{ github.job }}
1720
SUBMODULE=$(echo $JOB | cut -d'-' -f1 | cut -d'_' -f1)
1821
FLAVOR=$(echo $JOB | cut -d'-' -f1 | cut -d'_' -f2)
19-
OSARCH=$(echo $JOB | cut -d'-' -f2)
22+
23+
if [ -z "${{ inputs.osarch }}" ]; then
24+
OSARCH=$(echo $JOB | cut -d'-' -f2)
25+
else
26+
OSARCH=${{ inputs.osarch }}
27+
fi
2028
2129
SHA=$(git submodule status ${SUBMODULE} | sed -e 's/^-//g' -e 's/^+//g' -e 's/^U//g' | awk '{ print $1 }')
2230
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
name: "Host build lib"
2-
description: "Host build of lib"
1+
name: "Run build lib"
2+
description: "Run build of lib"
33
inputs:
4+
arch:
5+
description: "Target arch for loading script (host/armv7/aarch64)"
6+
required: false
7+
default: "host"
48
flavor:
59
description: "Build flavor"
610
required: true
711
runs:
812
using: "composite"
913
steps:
10-
- run: ./ci_scripts/host-build.sh ${{ inputs.flavor }}
14+
- run: ./ci_scripts/${{ inputs.arch }}-build.sh ${{ inputs.flavor }}
1115
shell: bash
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "xldd install"
2+
description: "Install xldd"
3+
inputs:
4+
target:
5+
description: "System target"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- id: install_xldd
11+
run: |
12+
source ./ci_scripts/all-vars.sh
13+
# -s required to avoid the noisy output like "Entering / Leaving directories"
14+
toolchain=$(make -s -C ${DS_DSDIR}/native_client/ TARGET=${{ inputs.target }} TFDIR=${DS_TFDIR} print-toolchain)
15+
if [ ! -x "${toolchain}ldd" ]; then
16+
cp "${DS_DSDIR}/native_client/xldd" "${toolchain}ldd" && chmod +x "${toolchain}ldd"
17+
fi
18+
shell: bash
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: "multistrap install"
2+
description: "Install a system root using multistrap"
3+
inputs:
4+
arch:
5+
description: "Target arch"
6+
required: true
7+
packages:
8+
description: "Extra packages to install"
9+
required: false
10+
default: ""
11+
runs:
12+
using: "composite"
13+
steps:
14+
- id: install_multistrap
15+
run: |
16+
sudo apt-get update -y
17+
sudo apt-get install -y --no-install-recommends multistrap qemu-user-static
18+
shell: bash
19+
- id: create_chroot
20+
run: |
21+
set -xe
22+
23+
multistrap_conf=""
24+
if [ "${{ inputs.arch }}" = "armv7" ]; then
25+
multistrap_conf=multistrap_raspbian_buster.conf
26+
wget http://archive.raspbian.org/raspbian/pool/main/r/raspbian-archive-keyring/raspbian-archive-keyring_20120528.2_all.deb && sudo dpkg -i raspbian-archive-keyring_20120528.2_all.deb
27+
fi
28+
if [ "${{ inputs.arch }}" = "aarch64" ]; then
29+
multistrap_conf=multistrap_armbian64_buster.conf
30+
fi
31+
32+
multistrap -d ${{ env.SYSTEM_RASPBIAN }} -f ${{ github.workspace }}/native_client/${multistrap_conf}
33+
34+
if [ ! -z "${{ inputs.packages }}" ]; then
35+
TO_MOUNT=${{ github.workspace }}
36+
# Prepare target directory to bind-mount the github tree
37+
mkdir -p ${{ env.SYSTEM_RASPBIAN }}/${{ github.workspace }}
38+
39+
# Bind-mount so that we have the same tree inside the chroot
40+
for dev in ${TO_MOUNT};
41+
do
42+
sudo mount -o bind ${dev} ${{ env.SYSTEM_RASPBIAN }}${dev}
43+
done;
44+
45+
# Copy some host data:
46+
# resolv.conf: for getting DNS working
47+
# passwd, group, shadow: to have user accounts and apt-get install working
48+
for ff in resolv.conf passwd group shadow;
49+
do
50+
sudo cp /etc/${ff} ${{ env.SYSTEM_RASPBIAN }}/etc/
51+
done;
52+
53+
# Perform apt steps.
54+
# Preserving the env is required
55+
sudo --preserve-env chroot ${{ env.SYSTEM_RASPBIAN }}/ apt-get update -y
56+
sudo --preserve-env chroot ${{ env.SYSTEM_RASPBIAN }}/ apt-get install -y --no-install-recommends ${{ inputs.packages }}
57+
58+
# Cleanup apt info to save space
59+
sudo --preserve-env chroot ${{ env.SYSTEM_RASPBIAN }}/ rm -fr /var/cache/apt/* /var/lib/apt/lists/*
60+
61+
# Unmount what has been mounted
62+
for dev in ${TO_MOUNT};
63+
do
64+
sudo umount ${{ env.SYSTEM_RASPBIAN }}${dev}
65+
done;
66+
fi
67+
shell: bash

.github/actions/node-build/action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ inputs:
1919
description: "LIBS for NodeJS package"
2020
required: false
2121
default: ""
22+
target:
23+
description: "TARGET value"
24+
required: false
25+
default: "host"
26+
chroot:
27+
description: "RASPBIAN value"
28+
required: false
29+
default: ""
2230
runs:
2331
using: "composite"
2432
steps:
@@ -38,6 +46,8 @@ runs:
3846
EXTRA_LDFLAGS=${{ inputs.local_ldflags }} \
3947
EXTRA_LIBS=${{ inputs.local_libs }} \
4048
make -C native_client/javascript \
49+
TARGET=${{ inputs.target }} \
50+
RASPBIAN=${{ inputs.chroot }} \
4151
NODE_ABI_TARGET=--target=${node} \
4252
NODE_DEVDIR=--devdir=headers/nodejs \
4353
clean node-wrapper
@@ -49,6 +59,8 @@ runs:
4959
EXTRA_LDFLAGS=${{ inputs.local_ldflags }} \
5060
EXTRA_LIBS=${{ inputs.local_libs }} \
5161
make -C native_client/javascript \
62+
TARGET=${{ inputs.target }} \
63+
RASPBIAN=${{ inputs.chroot }} \
5264
NODE_ABI_TARGET=--target=${electron} \
5365
NODE_DIST_URL=--disturl=https://electronjs.org/headers \
5466
NODE_RUNTIME=--runtime=electron \
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "nodejs install"
2+
description: "Install nodejs in a chroot"
3+
inputs:
4+
node:
5+
description: "NodeJS version"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- id: add_apt_source
11+
run: |
12+
set -ex
13+
(echo "Package: nodejs" && echo "Pin: origin deb.nodesource.com" && echo "Pin-Priority: 999") > ${{ env.SYSTEM_RASPBIAN }}/etc/apt/preferences
14+
echo "deb http://deb.nodesource.com/node_${{ inputs.node }}.x buster main" > ${{ env.SYSTEM_RASPBIAN }}/etc/apt/sources.list.d/nodesource.list
15+
wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo --preserve-env chroot ${{ env.SYSTEM_RASPBIAN }}/ apt-key add -
16+
shell: bash
17+
- id: install_nodejs
18+
run: |
19+
set -ex
20+
sudo --preserve-env chroot ${{ env.SYSTEM_RASPBIAN }}/ apt-get update -y
21+
sudo --preserve-env chroot ${{ env.SYSTEM_RASPBIAN }}/ apt-get install -y nodejs
22+
shell: bash

.github/actions/python-build/action.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,53 @@ inputs:
2222
description: "LIBS for Python package"
2323
required: false
2424
default: ""
25+
target:
26+
description: "TARGET value"
27+
required: false
28+
default: "host"
29+
chroot:
30+
description: "RASPBIAN value"
31+
required: false
32+
default: ""
2533
runs:
2634
using: "composite"
2735
steps:
2836
- run: |
2937
python3 --version
3038
pip3 --version
39+
python3 -m pip install virtualenv
40+
python3 -m virtualenv deepspeech-build
3141
shell: bash
3242
- run: |
3343
mkdir -p wheels
3444
shell: bash
3545
- run: |
46+
set -xe
47+
3648
PROJECT_NAME="deepspeech"
3749
if [ "${{ inputs.build_flavor }}" = "tflite" ]; then
3850
PROJECT_NAME="deepspeech-tflite"
3951
fi
4052
53+
OS=$(uname)
54+
if [ "${OS}" = "Linux" ]; then
55+
source deepspeech-build/bin/activate
56+
fi
57+
4158
NUMPY_BUILD_VERSION="${{ inputs.numpy_build }}" \
4259
NUMPY_DEP_VERSION="${{ inputs.numpy_dep }}" \
4360
EXTRA_CFLAGS=${{ inputs.local_cflags }} \
4461
EXTRA_LDFLAGS=${{ inputs.local_ldflags }} \
4562
EXTRA_LIBS=${{ inputs.local_libs }} \
4663
make -C native_client/python/ \
64+
TARGET=${{ inputs.target }} \
65+
RASPBIAN=${{ inputs.chroot }} \
4766
SETUP_FLAGS="--project_name ${PROJECT_NAME}" \
4867
bindings-clean bindings
68+
69+
if [ "${OS}" = "Linux" ]; then
70+
deactivate
71+
fi
4972
shell: bash
5073
- run: |
5174
cp native_client/python/dist/*.whl wheels

.github/actions/run-tests/action.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@ inputs:
1313
bitrate:
1414
description: "Bitrate for testing"
1515
required: true
16+
chroot:
17+
description: "Run using a chroot"
18+
required: false
1619
runs:
1720
using: "composite"
1821
steps:
1922
- run: |
23+
set -xe
24+
2025
build=""
2126
if [ "${{ inputs.build-flavor }}" = "tflite" ]; then
2227
build="_tflite"
@@ -27,5 +32,10 @@ runs:
2732
model_kind="-prod"
2833
fi
2934
30-
./ci_scripts/${{ inputs.runtime }}${build}-tests${model_kind}.sh ${{ inputs.bitrate }}
35+
prefix="."
36+
if [ ! -z "${{ inputs.chroot }}" ]; then
37+
prefix="${{ inputs.chroot }}"
38+
fi
39+
40+
${prefix}/ci_scripts/${{ inputs.runtime }}${build}-tests${model_kind}.sh ${{ inputs.bitrate }}
3141
shell: bash

0 commit comments

Comments
 (0)