trigger-workflow #18
This file contains hidden or 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 regmsg binaries | |
| on: | |
| workflow_dispatch: | |
| repository_dispatch: | |
| types: [trigger-workflow] | |
| concurrency: | |
| group: ${{ github.repository }}-${{ github.workflow }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| actions: write | |
| jobs: | |
| compile-regmsg: | |
| name: Compile regmsg | |
| runs-on: ubuntu-latest | |
| outputs: | |
| regmsgversion: ${{ steps.compile_regmsg_step.outputs.regmsgversion }} | |
| dorelease: ${{ steps.compile_regmsg_step.outputs.dorelease }} | |
| strategy: | |
| matrix: | |
| #cpu: [arm1176jzf_s, cortex_a7, cortex_a9, cortex_a15_a7, cortex_a17, cortex_a35, cortex_a53, jz4770, cortex_a55, cortex_a72, cortex_a72_a53, cortex_a73_a53, cortex_a75_a55, cortex_a76, cortex_a76_a55, riscv, saphira, x86_64, x86_64_v3] | |
| cpu: [arm1176jzf_s, cortex_a7, cortex_a9, cortex_a17, cortex_a35, cortex_a53, cortex_a55, cortex_a72, cortex_a72_a53, cortex_a73_a53, cortex_a75_a55, cortex_a76, cortex_a76_a55, riscv, saphira, x86_64, x86_64_v3] | |
| include: | |
| # MUSL 32 bit | |
| - target: bcm2835 | |
| cpu: arm1176jzf_s | |
| # arch: armhf-musl | |
| - target: h3 | |
| cpu: cortex_a7 | |
| # arch: armv7-musl | |
| - target: s812 | |
| cpu: cortex_a9 | |
| # arch: armv7-musl | |
| ##- target: odroidxu4 | |
| ## cpu: cortex_a15_a7 | |
| ### arch: armv7-musl | |
| - target: rk3288 | |
| cpu: cortex_a17 | |
| # arch: armv7-musl | |
| # MUSL 64 bit | |
| - target: rk3326 | |
| cpu: cortex_a35 | |
| # arch: aarch64-musl | |
| - target: h616 | |
| cpu: cortex_a53 | |
| # arch: aarch64-musl | |
| ##- target: jz4770 | |
| ## cpu: jz4770 | |
| ### arch: mips-musl | |
| # GLIBC | |
| - target: rk3568 | |
| cpu: cortex_a55 | |
| # arch: aarch64-glibc | |
| - target: bcm2711 | |
| cpu: cortex_a72 | |
| # arch: aarch64-glibc | |
| - target: rk3399 | |
| cpu: cortex_a72_a53 | |
| # arch: aarch64-glibc | |
| - target: s922x | |
| cpu: cortex_a73_a53 | |
| # arch: aarch64-glibc | |
| - target: sdm845 | |
| cpu: cortex_a75_a55 | |
| # arch: aarch64-glibc | |
| - target: bcm2712 | |
| cpu: cortex_a76 | |
| # arch: aarch64-glibc | |
| - target: sm8250 | |
| cpu: cortex_a76_a55 | |
| # arch: aarch64-glibc | |
| - target: jh7110 | |
| cpu: riscv | |
| # arch: riscv-glibc | |
| - target: asahi | |
| cpu: saphira | |
| # arch: asahi-glibc | |
| - target: x86_64 | |
| cpu: x86_64 | |
| # arch: x86_64-glibc | |
| - target: x86_64_v3 | |
| cpu: x86_64_v3 | |
| # arch: x86_64-glibc | |
| fail-fast: false | |
| steps: | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| - name: Clone repository | |
| id: clone_step | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: REG-Linux/REG-WIP | |
| token: ${{ secrets.REG_TOKEN }} | |
| submodules: true | |
| - name: Compile regmsg | |
| id: compile_regmsg_step | |
| env: | |
| GH_TOKEN: ${{ secrets.REG_TOKEN }} | |
| run: | | |
| git config user.name "${{ github.repository_owner }}" | |
| git config user.email "${{ github.repository_owner }}@users.noreply.github.com" | |
| git config --local user.password ${{ github.token }} | |
| regmsgversion="$(sed -n 's/^REGLINUX_MSG_VERSION[[:space:]]*=[[:space:]]*\([0-9a-fA-F]\{7\}\).*/\1/p' package/system/reglinux-msg/reglinux-msg.mk)" | |
| echo "regmsgversion=$regmsgversion" | |
| echo "regmsgversion=$regmsgversion" >> "$GITHUB_OUTPUT" | |
| [ "$(curl -o /dev/null -s -Iw '%{http_code}' -L "https://github.com/REG-Linux/regmsg-binaries/releases/download/${regmsgversion}/reglinux-msg-${regmsgversion}-${{ matrix.cpu }}.tar.xz")" -eq 200 ] && skip=y | |
| if [ -z "$skip" ]; then | |
| # Patch Makefile to use 'reglinux-build:latest' docker image from ghcr.io | |
| sed -i '/^DOCKER_REPO/ s|reglinux|ghcr.io/reg-linux|' Makefile | |
| sed -i '/ build . -t /d' Makefile | |
| # Disable CCACHE | |
| sed -i '/BR2_CCACHE/d' configs/reglinux-board.common | |
| # After each package is installed, delete downloaded files | |
| sed -i '/stamp_installed\:/,/stamp_dircleaned\:/ s:^$:\trm -rfv "\$(\$(PKG)_DL_DIR)"\n:' buildroot/package/pkg-generic.mk | |
| # Temp fix for riscv64 | |
| # sed -i 's/ -mabi=lp64d -mcpu=sifive-u74//' configs/reglinux-jh7110.board || : | |
| # Hack needed to retrieve the proper staging name directory when packaging | |
| #sed -i '/stamp_staging_installed\:/,/stamp_images_installed\:/ s:^$:\techo "host/\$(GNU_TARGET_NAME)/sysroot" > "\$(BUILD_DIR)/staging.dir"\n:' buildroot/package/pkg-generic.mk | |
| # Enable the flag and token to build regmsg from source | |
| sed -i 's/#BR2_PACKAGE_REGLINUX_MSG_BUILD_FROM_SOURCE=y/BR2_PACKAGE_REGLINUX_MSG_BUILD_FROM_SOURCE=y/' configs/reglinux-board.common | |
| echo "${GH_TOKEN}" > ./gh_token | |
| # Use cached toolchain if available from REG-Linux/REG-llvm-binaries | |
| cacheHASHshort="${{ hashFiles('custom/package/*llvm*/**', '.gitmodules') }}" | |
| cacheHASHshort="${cacheHASHshort:0:7}" | |
| if curl -s -L "https://github.com/REG-Linux/REG-llvm-binaries/releases/download/toolchain-${{ matrix.cpu }}/toolchain-${{ matrix.cpu }}-${cacheHASHshort}.tar.xz" | tar -xJf - 2>/dev/null | |
| then | |
| echo "toolchain-${{ matrix.cpu }}-${cacheHASHshort}.tar.xz extracted" | |
| else | |
| echo "toolchain-${{ matrix.cpu }}-${cacheHASHshort}.tar.xz not found" | |
| jobsandload="-j$(( $(nproc) - 1 ))" | |
| # Build with 2 trials in case of download failure that sometimes happens | |
| PARALLEL_BUILD=n DEBUG_BUILD=n CCACHE_DISABLE=1 make ${jobsandload} PKG=alsa-lib ${{ matrix.target }}-pkg || { | |
| echo "Retrying build after failure..." | |
| sleep 60 | |
| cd "${{ github.workspace }}" | |
| PARALLEL_BUILD=n DEBUG_BUILD=n CCACHE_DISABLE=1 make ${jobsandload} PKG=alsa-lib ${{ matrix.target }}-pkg | |
| } | |
| XZ_OPT=-9 tar --ignore-failed-read -cJf "toolchain-${{ matrix.cpu }}-${cacheHASHshort}.tar.xz" output/ | |
| gh release delete toolchain-${{ matrix.cpu }} --cleanup-tag -y --repo REG-Linux/REG-llvm-binaries || : | |
| gh release create toolchain-${{ matrix.cpu }} --repo REG-Linux/REG-llvm-binaries --latest=false --title "Toolchain cache for ${{ matrix.cpu }} targets" "toolchain-${{ matrix.cpu }}-${cacheHASHshort}.tar.xz" | |
| echo "Toolchain cache created" | |
| rm "toolchain-${{ matrix.cpu }}-${cacheHASHshort}.tar.xz" | |
| fi | |
| jobsandload="-j$(( $(nproc) - 1 ))" | |
| # Build with 2 trials in case of download failure that sometimes happens | |
| PARALLEL_BUILD=n DEBUG_BUILD=n CCACHE_DISABLE=1 make ${jobsandload} PKG=reglinux-msg ${{ matrix.target }}-pkg || { | |
| echo "Retrying build after failure..." | |
| sleep 60 | |
| cd "${{ github.workspace }}" | |
| PARALLEL_BUILD=n DEBUG_BUILD=n CCACHE_DISABLE=1 make ${jobsandload} PKG=reglinux-msg ${{ matrix.target }}-pkg | |
| } | |
| cd "${{ github.workspace }}/output/${{ matrix.target }}" || exit 1 | |
| cat build/reglinux-msg*/.files-list.txt | cut -d ',' -f 2 | sed -e 's+^./+target/+g' >>reglinux-msg-filelist.txt | |
| XZ_OPT=-9 tar -cJf "${{ github.workspace }}/reglinux-msg-${regmsgversion}-${{ matrix.cpu }}.tar.xz" --verbatim-files-from -T reglinux-msg-filelist.txt || : | |
| echo "dorelease=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Upload artifacts | |
| if: ${{ steps.compile_regmsg_step.outputs.dorelease == 'true' && ! cancelled() }} | |
| id: upload_artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: reglinux-msg-${{ steps.compile_regmsg_step.outputs.regmsgversion }}-${{ matrix.cpu }} | |
| compression-level: 0 | |
| path: reglinux-msg-${{ steps.compile_regmsg_step.outputs.regmsgversion }}-* | |
| create_release: | |
| name: Create release | |
| needs: compile-regmsg | |
| if: ${{ needs.compile-regmsg.outputs.dorelease == 'true' && ! cancelled() }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| pattern: reglinux-msg-${{ needs.compile-regmsg.outputs.regmsgversion }}-* | |
| path: ./ | |
| merge-multiple: true | |
| - name: Create release | |
| uses: softprops/action-gh-release@master | |
| with: | |
| repository: REG-Linux/regmsg-binaries | |
| token: ${{ secrets.REG_TOKEN }} | |
| files: reglinux-msg-${{ needs.compile-regmsg.outputs.regmsgversion }}-* | |
| tag_name: ${{ needs.compile-regmsg.outputs.regmsgversion }} | |
| prerelease: false | |
| make_latest: true | |
| generate_release_notes: true | |
| name: regmsg binaries (${{ needs.compile-regmsg.outputs.regmsgversion }}) |