Fix and improve workflows #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build kaldi on armv6l, armv7l and aarch64 | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
build_openblas: | |
name: "Build OpenBLAS" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [armv6l_raspbian, armv6l_raspios, armv7l_raspios, aarch64_raspios, armv6l_dietpi, armv7l_dietpi, aarch64_dietpi, raspi_1_bullseye, raspi_2_bullseye, raspi_3_bullseye, raspi_4_bullseye] | |
include: | |
- target: armv6l_raspbian | |
cpu: arm1176 | |
base_image: raspbian_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv6l_raspios | |
cpu: arm1176 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_raspios | |
cpu: cortex-a7 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: aarch64_raspios | |
cpu: cortex-a53 | |
base_image: raspios_lite_arm64:latest | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: armv6l_dietpi | |
cpu: arm1176 | |
base_image: dietpi:rpi_armv6_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_dietpi | |
cpu: cortex-a7 | |
base_image: dietpi:rpi_armv7_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w | |
- target: aarch64_dietpi | |
cpu: cortex-a53 | |
base_image: dietpi:rpi_armv8_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: raspi_1_bullseye | |
cpu: arm1176 | |
base_image: raspi_1_bullseye:20220121 | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: raspi_2_bullseye | |
cpu: cortex-a7 | |
base_image: raspi_2_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_3_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_3_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_4_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_4_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
steps: | |
- uses: actions/checkout@v2 | |
- id: define-openblas-archive-name | |
name: Define OpenBLAS archive name | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
OPENBLAS_ARCHIVE_NAME=OpenBLAS-${TARGET}.tar.gz | |
echo "::set-output name=OPENBLAS_ARCHIVE_NAME::${OPENBLAS_ARCHIVE_NAME}" | |
- name: Compile OpenBLAS with arm-runner | |
uses: pguyot/arm-runner-action@main | |
with: | |
base_image: ${{ matrix.base_image }} | |
cpu: ${{ matrix.cpu }} | |
cpu_info: ${{ matrix.cpu_info }} | |
image_additional_mb: 1024 | |
bind_mount_repository: true | |
optimize_image: false | |
copy_repository_path: | |
/opt/kaldi | |
commands: | | |
apt-get update | |
apt-get install -y software-properties-common | |
add-apt-repository ppa:deadsnakes/ppa | |
apt-get update -y --allow-releaseinfo-change | |
apt-get install --no-install-recommends -y subversion gawk python2.7 python3 automake autoconf git sox gfortran libtool make | |
apt-get upgrade -y wget ca-certificates | |
cd tools | |
bash extras/install_openblas.sh | |
- name: Create tarball | |
id: create-tarball | |
shell: bash | |
env: | |
OPENBLAS_ARCHIVE_NAME: ${{ steps.define-openblas-archive-name.outputs.OPENBLAS_ARCHIVE_NAME }} | |
run: | | |
cd tools | |
sudo find OpenBLAS/install -name "*.a" -delete | |
sudo find OpenBLAS/install -type d -empty -delete | |
tar czf ${OPENBLAS_ARCHIVE_NAME} OpenBLAS/install | |
- name: Upload target tarball | |
uses: actions/upload-artifact@v2 | |
with: | |
retention-days: 3 | |
name: ${{ steps.define-openblas-archive-name.outputs.OPENBLAS_ARCHIVE_NAME }} | |
path: tools/${{ steps.define-openblas-archive-name.outputs.OPENBLAS_ARCHIVE_NAME }} | |
build_openfst: | |
name: "Build OpenFST" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [armv6l_raspbian, armv6l_raspios, armv7l_raspios, aarch64_raspios, armv6l_dietpi, armv7l_dietpi, aarch64_dietpi, raspi_1_bullseye, raspi_2_bullseye, raspi_3_bullseye, raspi_4_bullseye] | |
include: | |
- target: armv6l_raspbian | |
cpu: arm1176 | |
base_image: raspbian_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv6l_raspios | |
cpu: arm1176 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_raspios | |
cpu: cortex-a7 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: aarch64_raspios | |
cpu: cortex-a53 | |
base_image: raspios_lite_arm64:latest | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: armv6l_dietpi | |
cpu: arm1176 | |
base_image: dietpi:rpi_armv6_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_dietpi | |
cpu: cortex-a7 | |
base_image: dietpi:rpi_armv7_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w | |
- target: aarch64_dietpi | |
cpu: cortex-a53 | |
base_image: dietpi:rpi_armv8_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: raspi_1_bullseye | |
cpu: arm1176 | |
base_image: raspi_1_bullseye:20220121 | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: raspi_2_bullseye | |
cpu: cortex-a7 | |
base_image: raspi_2_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_3_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_3_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_4_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_4_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
steps: | |
- uses: actions/checkout@v2 | |
- id: get-openfst-version | |
name: Determine OpenFST version | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
OPENFST_VERSION=`grep -E '^OPENFST_VERSION \?= ' tools/Makefile | sed -e 's|OPENFST_VERSION ?= ||g'` | |
OPENFST_ARCHIVE_NAME=openfst-${TARGET}-${OPENFST_VERSION}.tar.gz | |
echo "::set-output name=OPENFST_VERSION::${OPENFST_VERSION}" | |
echo "::set-output name=OPENFST_ARCHIVE_NAME::${OPENFST_ARCHIVE_NAME}" | |
- name: Compile OpenFST with arm-runner | |
uses: pguyot/arm-runner-action@main | |
with: | |
base_image: ${{ matrix.base_image }} | |
cpu: ${{ matrix.cpu }} | |
cpu_info: ${{ matrix.cpu_info }} | |
image_additional_mb: 1024 | |
bind_mount_repository: true | |
optimize_image: false | |
copy_repository_path: | |
/opt/kaldi | |
commands: | | |
apt-get update | |
apt-get install -y software-properties-common | |
add-apt-repository ppa:deadsnakes/ppa | |
apt-get update -y --allow-releaseinfo-change | |
apt-get install --no-install-recommends -y subversion gawk python2.7 python3 automake autoconf git sox gfortran libtool make | |
apt-get upgrade -y wget ca-certificates | |
cd tools | |
OPENFST_CONFIGURE="--enable-shared --with-pic --disable-bin" make openfst_compiled -j 4 | |
- name: Create tarball | |
id: create-tarball | |
shell: bash | |
env: | |
OPENFST_VERSION: ${{ steps.get-openfst-version.outputs.OPENFST_VERSION }} | |
OPENFST_ARCHIVE_NAME: ${{ steps.get-openfst-version.outputs.OPENFST_ARCHIVE_NAME }} | |
run: | | |
cd tools | |
ln -sf openfst-${OPENFST_VERSION} openfst | |
tar czf ${OPENFST_ARCHIVE_NAME} openfst openfst-${OPENFST_VERSION}/lib/libfst.so* openfst-${OPENFST_VERSION}/include | |
- name: Upload target tarball | |
uses: actions/upload-artifact@v2 | |
with: | |
retention-days: 3 | |
name: ${{ steps.get-openfst-version.outputs.OPENFST_ARCHIVE_NAME }} | |
path: tools/${{ steps.get-openfst-version.outputs.OPENFST_ARCHIVE_NAME }} | |
build_tools: | |
name: "Build tools" | |
needs: [build_openblas, build_openfst] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [armv6l_raspbian, armv6l_raspios, armv7l_raspios, aarch64_raspios, armv6l_dietpi, armv7l_dietpi, aarch64_dietpi, raspi_1_bullseye, raspi_2_bullseye, raspi_3_bullseye, raspi_4_bullseye] | |
include: | |
- target: armv6l_raspbian | |
cpu: arm1176 | |
base_image: raspbian_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv6l_raspios | |
cpu: arm1176 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_raspios | |
cpu: cortex-a7 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: aarch64_raspios | |
cpu: cortex-a53 | |
base_image: raspios_lite_arm64:latest | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: armv6l_dietpi | |
cpu: arm1176 | |
base_image: dietpi:rpi_armv6_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_dietpi | |
cpu: cortex-a7 | |
base_image: dietpi:rpi_armv7_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w | |
- target: aarch64_dietpi | |
cpu: cortex-a53 | |
base_image: dietpi:rpi_armv8_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: raspi_1_bullseye | |
cpu: arm1176 | |
base_image: raspi_1_bullseye:20220121 | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: raspi_2_bullseye | |
cpu: cortex-a7 | |
base_image: raspi_2_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_3_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_3_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_4_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_4_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
steps: | |
- uses: actions/checkout@v2 | |
- id: define-tools | |
name: Define tools | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
TOOLS_ARCHIVE_NAME="kaldi-${TARGET}-tools.tar.gz" | |
echo "::set-output name=TOOLS_ARCHIVE_NAME::${TOOLS_ARCHIVE_NAME}" | |
- id: define-openblas-archive-name | |
name: Define OpenBLAS archive name | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
OPENBLAS_ARCHIVE_NAME=OpenBLAS-${TARGET}.tar.gz | |
echo "::set-output name=OPENBLAS_ARCHIVE_NAME::${OPENBLAS_ARCHIVE_NAME}" | |
- id: get-openfst-version | |
name: Determine OpenFST version | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
OPENFST_VERSION=`grep -E '^OPENFST_VERSION \?= ' tools/Makefile | sed -e 's|OPENFST_VERSION ?= ||g'` | |
OPENFST_ARCHIVE_NAME=openfst-${TARGET}-${OPENFST_VERSION}.tar.gz | |
echo "::set-output name=OPENFST_VERSION::${OPENFST_VERSION}" | |
echo "::set-output name=OPENFST_ARCHIVE_NAME::${OPENFST_ARCHIVE_NAME}" | |
- name: Download OpenBLAS | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ steps.define-openblas-archive-name.outputs.OPENBLAS_ARCHIVE_NAME }} | |
- name: Extract OpenBLAS | |
shell: bash | |
env: | |
OPENBLAS_ARCHIVE_NAME: ${{ steps.define-openblas-archive-name.outputs.OPENBLAS_ARCHIVE_NAME }} | |
run: | | |
tar xzf ${OPENBLAS_ARCHIVE_NAME} -C tools | |
rm ${OPENBLAS_ARCHIVE_NAME} | |
- name: Download OpenFST | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ steps.get-openfst-version.outputs.OPENFST_ARCHIVE_NAME }} | |
- name: Extract OpenFST | |
shell: bash | |
env: | |
OPENFST_ARCHIVE_NAME: ${{ steps.get-openfst-version.outputs.OPENFST_ARCHIVE_NAME }} | |
run: | | |
tar xzf ${OPENFST_ARCHIVE_NAME} -C tools | |
rm ${OPENFST_ARCHIVE_NAME} | |
- uses: pguyot/arm-runner-action@main | |
with: | |
base_image: ${{ matrix.base_image }} | |
cpu: ${{ matrix.cpu }} | |
cpu_info: ${{ matrix.cpu_info }} | |
image_additional_mb: 1024 | |
bind_mount_repository: true | |
optimize_image: false | |
copy_repository_path: | |
/opt/kaldi | |
commands: | | |
apt-get update | |
apt-get install -y software-properties-common | |
add-apt-repository ppa:deadsnakes/ppa | |
apt-get update -y --allow-releaseinfo-change | |
apt-get install --no-install-recommends -y subversion gawk python2.7 python3 automake autoconf git sox gfortran libtool | |
cd tools | |
bash extras/check_dependencies.sh | |
make cub sctk_made sph2pipe -j 4 | |
- name: Create tarball for tools | |
shell: bash | |
env: | |
TOOLS_ARCHIVE_NAME: ${{ steps.define-tools.outputs.TOOLS_ARCHIVE_NAME }} | |
run: | | |
tar czf ${TOOLS_ARCHIVE_NAME} tools/ | |
- name: Upload target tarball | |
uses: actions/upload-artifact@v2 | |
with: | |
retention-days: 3 | |
name: ${{ steps.define-tools.outputs.TOOLS_ARCHIVE_NAME }} | |
path: ${{ steps.define-tools.outputs.TOOLS_ARCHIVE_NAME }} | |
build_step1: | |
name: "Build kaldi (step 1)" | |
needs: [build_tools] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [armv6l_raspbian, armv6l_raspios, armv7l_raspios, aarch64_raspios, armv6l_dietpi, armv7l_dietpi, aarch64_dietpi, raspi_1_bullseye, raspi_2_bullseye, raspi_3_bullseye, raspi_4_bullseye] | |
include: | |
- target: armv6l_raspbian | |
cpu: arm1176 | |
base_image: raspbian_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv6l_raspios | |
cpu: arm1176 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_raspios | |
cpu: cortex-a7 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: aarch64_raspios | |
cpu: cortex-a53 | |
base_image: raspios_lite_arm64:latest | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: armv6l_dietpi | |
cpu: arm1176 | |
base_image: dietpi:rpi_armv6_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_dietpi | |
cpu: cortex-a7 | |
base_image: dietpi:rpi_armv7_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w | |
- target: aarch64_dietpi | |
cpu: cortex-a53 | |
base_image: dietpi:rpi_armv8_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: raspi_1_bullseye | |
cpu: arm1176 | |
base_image: raspi_1_bullseye:20220121 | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: raspi_2_bullseye | |
cpu: cortex-a7 | |
base_image: raspi_2_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_3_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_3_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_4_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_4_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
steps: | |
- uses: actions/checkout@v2 | |
- id: define-step1 | |
name: Define step 1 | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
STEP1_ARCHIVE_NAME="kaldi-${TARGET}-step1.tar.gz" | |
echo "::set-output name=STEP1_ARCHIVE_NAME::${STEP1_ARCHIVE_NAME}" | |
- id: get-openfst-version | |
name: Determine OpenFST version | |
shell: bash | |
run: | | |
OPENFST_VERSION=`grep -E '^OPENFST_VERSION \?= ' tools/Makefile | sed -e 's|OPENFST_VERSION ?= ||g'` | |
echo "::set-output name=OPENFST_VERSION::${OPENFST_VERSION}" | |
- id: define-tools | |
name: Define tools | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
TOOLS_ARCHIVE_NAME="kaldi-${TARGET}-tools.tar.gz" | |
echo "::set-output name=TOOLS_ARCHIVE_NAME::${TOOLS_ARCHIVE_NAME}" | |
- name: Download Tools | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ steps.define-tools.outputs.TOOLS_ARCHIVE_NAME }} | |
- name: Extract Tools | |
shell: bash | |
env: | |
TOOLS_ARCHIVE_NAME: ${{ steps.define-tools.outputs.TOOLS_ARCHIVE_NAME }} | |
run: | | |
rm -rf tools/ | |
tar xzf ${TOOLS_ARCHIVE_NAME} | |
rm ${TOOLS_ARCHIVE_NAME} | |
- name: Patch ARM makefile for armv6l | |
if: matrix.arch == 'armv6l' | |
shell: bash | |
run: | | |
sed -i -e 's|-mfpu=neon|-mfpu=vfp|g' src/makefiles/linux_openblas_arm.mk | |
- uses: pguyot/arm-runner-action@main | |
with: | |
base_image: ${{ matrix.base_image }} | |
cpu: ${{ matrix.cpu }} | |
cpu_info: ${{ matrix.cpu_info }} | |
image_additional_mb: 1024 | |
bind_mount_repository: true | |
optimize_image: false | |
copy_repository_path: | |
/opt/kaldi | |
commands: | | |
OPENFST_VERSION=${{ steps.get-openfst-version.outputs.OPENFST_VERSION }} | |
apt-get update | |
apt-get install -y software-properties-common | |
add-apt-repository ppa:deadsnakes/ppa | |
apt-get update -y --allow-releaseinfo-change | |
apt-get install --no-install-recommends -y subversion gawk python2.7 python3 automake autoconf git sox gfortran libtool | |
cd src | |
OPENFST_VER=${OPENFST_VERSION} ./configure --shared | |
make depend -j 4 | |
make bin matrix/test -j 4 | |
- name: Create tarball for step 1 | |
shell: bash | |
env: | |
STEP1_ARCHIVE_NAME: ${{ steps.define-step1.outputs.STEP1_ARCHIVE_NAME }} | |
run: | | |
tar czf ${STEP1_ARCHIVE_NAME} src/ | |
- name: Upload target tarball | |
uses: actions/upload-artifact@v2 | |
with: | |
retention-days: 3 | |
name: ${{ steps.define-step1.outputs.STEP1_ARCHIVE_NAME }} | |
path: ${{ steps.define-step1.outputs.STEP1_ARCHIVE_NAME }} | |
build_step2: | |
name: "Build kaldi (step 2)" | |
needs: [build_step1] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [armv6l_raspbian, armv6l_raspios, armv7l_raspios, aarch64_raspios, armv6l_dietpi, armv7l_dietpi, aarch64_dietpi, raspi_1_bullseye, raspi_2_bullseye, raspi_3_bullseye, raspi_4_bullseye] | |
include: | |
- target: armv6l_raspbian | |
cpu: arm1176 | |
base_image: raspbian_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv6l_raspios | |
cpu: arm1176 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_raspios | |
cpu: cortex-a7 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: aarch64_raspios | |
cpu: cortex-a53 | |
base_image: raspios_lite_arm64:latest | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: armv6l_dietpi | |
cpu: arm1176 | |
base_image: dietpi:rpi_armv6_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_dietpi | |
cpu: cortex-a7 | |
base_image: dietpi:rpi_armv7_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w | |
- target: aarch64_dietpi | |
cpu: cortex-a53 | |
base_image: dietpi:rpi_armv8_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: raspi_1_bullseye | |
cpu: arm1176 | |
base_image: raspi_1_bullseye:20220121 | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: raspi_2_bullseye | |
cpu: cortex-a7 | |
base_image: raspi_2_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_3_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_3_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_4_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_4_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
steps: | |
- uses: actions/checkout@v2 | |
- id: define-step2 | |
name: Define step 2 | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
STEP2_ARCHIVE_NAME="kaldi-${TARGET}-step2.tar.gz" | |
echo "::set-output name=STEP2_ARCHIVE_NAME::${STEP2_ARCHIVE_NAME}" | |
- id: get-openfst-version | |
name: Determine OpenFST version | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
OPENFST_VERSION=`grep -E '^OPENFST_VERSION \?= ' tools/Makefile | sed -e 's|OPENFST_VERSION ?= ||g'` | |
OPENFST_ARCHIVE_NAME=openfst-${TARGET}-${OPENFST_VERSION}.tar.gz | |
echo "::set-output name=OPENFST_VERSION::${OPENFST_VERSION}" | |
echo "::set-output name=OPENFST_ARCHIVE_NAME::${OPENFST_ARCHIVE_NAME}" | |
- id: define-tools | |
name: Define tools | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
TOOLS_ARCHIVE_NAME="kaldi-${TARGET}-tools.tar.gz" | |
echo "::set-output name=TOOLS_ARCHIVE_NAME::${TOOLS_ARCHIVE_NAME}" | |
- name: Download Tools | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ steps.define-tools.outputs.TOOLS_ARCHIVE_NAME }} | |
- name: Extract Tools | |
shell: bash | |
env: | |
TOOLS_ARCHIVE_NAME: ${{ steps.define-tools.outputs.TOOLS_ARCHIVE_NAME }} | |
run: | | |
rm -rf tools/ | |
tar xzf ${TOOLS_ARCHIVE_NAME} | |
rm ${TOOLS_ARCHIVE_NAME} | |
- id: define-step1 | |
name: Define step 1 | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
STEP1_ARCHIVE_NAME="kaldi-${TARGET}-step1.tar.gz" | |
echo "::set-output name=STEP1_ARCHIVE_NAME::${STEP1_ARCHIVE_NAME}" | |
- name: Download Step1 | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ steps.define-step1.outputs.STEP1_ARCHIVE_NAME }} | |
- name: Extract Step1 | |
shell: bash | |
env: | |
STEP1_ARCHIVE_NAME: ${{ steps.define-step1.outputs.STEP1_ARCHIVE_NAME }} | |
run: | | |
rm -rf src/ | |
tar xzf ${STEP1_ARCHIVE_NAME} | |
rm ${STEP1_ARCHIVE_NAME} | |
- uses: pguyot/arm-runner-action@main | |
with: | |
base_image: ${{ matrix.base_image }} | |
cpu: ${{ matrix.cpu }} | |
cpu_info: ${{ matrix.cpu_info }} | |
image_additional_mb: 1024 | |
bind_mount_repository: true | |
optimize_image: false | |
copy_repository_path: | |
/opt/kaldi | |
commands: | | |
apt-get update | |
apt-get install -y software-properties-common | |
add-apt-repository ppa:deadsnakes/ppa | |
apt-get update -y --allow-releaseinfo-change | |
apt-get install --no-install-recommends -y subversion gawk python2.7 python3 automake autoconf git sox gfortran libtool | |
cd src | |
make chainbin featbin fgmmbin fstbin gmmbin ivectorbin kwsbin latbin lmbin -j 4 | |
- name: Create tarball for step 1 | |
shell: bash | |
env: | |
STEP2_ARCHIVE_NAME: ${{ steps.define-step2.outputs.STEP2_ARCHIVE_NAME }} | |
run: | | |
tar czf ${STEP2_ARCHIVE_NAME} src/ | |
- name: Upload target tarball | |
uses: actions/upload-artifact@v2 | |
with: | |
retention-days: 3 | |
name: ${{ steps.define-step2.outputs.STEP2_ARCHIVE_NAME }} | |
path: ${{ steps.define-step2.outputs.STEP2_ARCHIVE_NAME }} | |
build_kaldi: | |
name: "Build kaldi (final step)" | |
needs: [build_tools, build_step2] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [armv6l_raspbian, armv6l_raspios, armv7l_raspios, aarch64_raspios, armv6l_dietpi, armv7l_dietpi, aarch64_dietpi, raspi_1_bullseye, raspi_2_bullseye, raspi_3_bullseye, raspi_4_bullseye] | |
include: | |
- target: armv6l_raspbian | |
cpu: arm1176 | |
base_image: raspbian_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv6l_raspios | |
cpu: arm1176 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_raspios | |
cpu: cortex-a7 | |
base_image: raspios_lite:latest | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: aarch64_raspios | |
cpu: cortex-a53 | |
base_image: raspios_lite_arm64:latest | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: armv6l_dietpi | |
cpu: arm1176 | |
base_image: dietpi:rpi_armv6_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: armv7l_dietpi | |
cpu: cortex-a7 | |
base_image: dietpi:rpi_armv7_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w | |
- target: aarch64_dietpi | |
cpu: cortex-a53 | |
base_image: dietpi:rpi_armv8_bullseye | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
- target: raspi_1_bullseye | |
cpu: arm1176 | |
base_image: raspi_1_bullseye:20220121 | |
cpu_info: cpuinfo/raspberrypi_zero_w | |
- target: raspi_2_bullseye | |
cpu: cortex-a7 | |
base_image: raspi_2_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_3_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_3_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_3b | |
- target: raspi_4_bullseye | |
cpu: cortex-a53 | |
base_image: raspi_4_bullseye:20230102 | |
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Define the release name | |
id: get-release | |
run: | | |
if [ ${GITHUB_REF/refs\/tags\//} != ${GITHUB_REF} ]; then | |
echo ::set-output name=RELEASE::${GITHUB_REF/refs\/tags\//} | |
elif [ ${GITHUB_REF/refs\/heads\//} != "${GITHUB_REF}" ]; then | |
echo ::set-output name=RELEASE::${GITHUB_REF/refs\/heads\//}-`echo ${GITHUB_SHA} | cut -c1-8` | |
else | |
echo ::set-output name=RELEASE::${GITHUB_REF//\//-}-`echo ${GITHUB_SHA} | cut -c1-8` | |
fi | |
- id: get-openfst-version | |
name: Determine OpenFST version | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
OPENFST_VERSION=`grep -E '^OPENFST_VERSION \?= ' tools/Makefile | sed -e 's|OPENFST_VERSION ?= ||g'` | |
OPENFST_ARCHIVE_NAME=openfst-${TARGET}-${OPENFST_VERSION}.tar.gz | |
echo "::set-output name=OPENFST_VERSION::${OPENFST_VERSION}" | |
echo "::set-output name=OPENFST_ARCHIVE_NAME::${OPENFST_ARCHIVE_NAME}" | |
- id: define-tools | |
name: Define tools | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
TOOLS_ARCHIVE_NAME="kaldi-${TARGET}-tools.tar.gz" | |
echo "::set-output name=TOOLS_ARCHIVE_NAME::${TOOLS_ARCHIVE_NAME}" | |
- name: Download Tools | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ steps.define-tools.outputs.TOOLS_ARCHIVE_NAME }} | |
- name: Extract Tools | |
shell: bash | |
env: | |
TOOLS_ARCHIVE_NAME: ${{ steps.define-tools.outputs.TOOLS_ARCHIVE_NAME }} | |
run: | | |
rm -rf tools/ | |
tar xzf ${TOOLS_ARCHIVE_NAME} | |
rm ${TOOLS_ARCHIVE_NAME} | |
- id: define-step2 | |
name: Define step 2 | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
STEP2_ARCHIVE_NAME="kaldi-${TARGET}-step2.tar.gz" | |
echo "::set-output name=STEP2_ARCHIVE_NAME::${STEP2_ARCHIVE_NAME}" | |
- name: Download Step2 | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ steps.define-step2.outputs.STEP2_ARCHIVE_NAME }} | |
- name: Extract Step2 | |
shell: bash | |
env: | |
STEP2_ARCHIVE_NAME: ${{ steps.define-step2.outputs.STEP2_ARCHIVE_NAME }} | |
run: | | |
rm -rf src/ | |
tar xzf ${STEP2_ARCHIVE_NAME} | |
rm ${STEP2_ARCHIVE_NAME} | |
- uses: pguyot/arm-runner-action@main | |
with: | |
base_image: ${{ matrix.base_image }} | |
cpu: ${{ matrix.cpu }} | |
cpu_info: ${{ matrix.cpu_info }} | |
image_additional_mb: 1024 | |
bind_mount_repository: true | |
optimize_image: false | |
copy_repository_path: | |
/opt/kaldi | |
commands: | | |
. /etc/os-release && echo "$ID$VERSION_ID-`uname -m`" > release_name | |
apt-get update | |
apt-get install -y software-properties-common | |
add-apt-repository ppa:deadsnakes/ppa | |
apt-get update -y --allow-releaseinfo-change | |
apt-get install --no-install-recommends -y subversion gawk python2.7 python3 automake autoconf git sox gfortran libtool | |
cd src | |
make -j 4 | |
- name: Create tarballs with files | |
id: create-tarballs | |
shell: bash | |
env: | |
RELEASE: ${{ steps.get-release.outputs.RELEASE }} | |
OPENFST_VERSION: ${{ steps.get-openfst-version.outputs.OPENFST_VERSION }} | |
run: | | |
mkdir -p dist/opt/kaldi | |
sudo cp -a {INSTALL,README.md,COPYING,src} dist/opt/kaldi/ | |
mkdir -p dist/opt/kaldi/tools/OpenBLAS/ | |
sudo cp -a tools/OpenBLAS/install dist/opt/kaldi/tools/OpenBLAS/ | |
sudo cp -a tools/openfst-${OPENFST_VERSION} dist/opt/kaldi/tools | |
sudo cp -a tools/openfst dist/opt/kaldi/tools | |
sudo find dist/opt/kaldi -type f ! -regex '^.*\.\(h\|so.*\)$' -delete | |
sudo find dist/opt/kaldi -type d -empty -delete | |
mkdir -p dist/etc/ld.so.conf.d/ | |
echo "/opt/kaldi/src/lib" > dist/etc/ld.so.conf.d/kaldi.conf | |
echo "/opt/kaldi/tools/openfst/lib/" >> dist/etc/ld.so.conf.d/kaldi.conf | |
echo "/opt/kaldi/tools/OpenBLAS/install/lib/" >> dist/etc/ld.so.conf.d/kaldi.conf | |
mkdir -p dist/usr/lib/pkgconfig/ | |
echo 'kaldi_root=/opt/kaldi' > dist/usr/lib/pkgconfig/kaldi-asr.pc | |
echo '' >> dist/usr/lib/pkgconfig/kaldi-asr.pc | |
echo 'Name: kaldi-asr' >> dist/usr/lib/pkgconfig/kaldi-asr.pc | |
echo 'Description: kaldi-asr speech recognition toolkit' >> dist/usr/lib/pkgconfig/kaldi-asr.pc | |
echo "Version: ${RELEASE}" >> dist/usr/lib/pkgconfig/kaldi-asr.pc | |
echo 'Libs: -L${kaldi_root}/tools/openfst/lib -L${kaldi_root}/src/lib -lkaldi-decoder -lkaldi-lat -lkaldi-fstext -lkaldi-hmm -lkaldi-feat -lkaldi-transform -lkaldi-gmm -lkaldi-tree -lkaldi-util -lkaldi-matrix -lkaldi-base -lkaldi-nnet3 -lkaldi-online2' >> dist/usr/lib/pkgconfig/kaldi-asr.pc | |
echo 'Cflags: -I${kaldi_root}/src -I${kaldi_root}/tools/openfst/include' >> dist/usr/lib/pkgconfig/kaldi-asr.pc | |
sudo chown -R root:root dist | |
release_name=`cat release_name` | |
ARCHIVE_NAME_LIB="kaldi-${RELEASE}-linux_${release_name}.tar.xz" | |
tar cJf ${ARCHIVE_NAME_LIB} -C dist opt etc usr | |
sudo mkdir -p dist/opt/kaldi/src/bin/ | |
sudo cp -a src/bin/* dist/opt/kaldi/src/bin/ | |
sudo find dist/opt/kaldi/src/bin -type f -name '*.o' -delete | |
sudo chown -R root:root dist | |
ARCHIVE_NAME_WITH_BIN="kaldi-${RELEASE}-linux_${release_name}-with-binaries.tar.xz" | |
tar cJf ${ARCHIVE_NAME_WITH_BIN} -C dist opt etc usr | |
echo "::set-output name=ARCHIVE_NAME_LIB::${ARCHIVE_NAME_LIB}" | |
echo "::set-output name=ARCHIVE_NAME_WITH_BIN::${ARCHIVE_NAME_WITH_BIN}" | |
- name: Archive tarball with libaries | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ steps.create-tarballs.outputs.ARCHIVE_NAME_LIB }} | |
path: ${{ steps.create-tarballs.outputs.ARCHIVE_NAME_LIB }} | |
- name: Archive tarball with binaries | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ steps.create-tarballs.outputs.ARCHIVE_NAME_WITH_BIN }} | |
path: ${{ steps.create-tarballs.outputs.ARCHIVE_NAME_WITH_BIN }} |