fix(gen2): resolve flann/defines.h for installed-tree OpenCV layouts #1144
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: nerves-build | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled, unlabeled] | |
| paths-ignore: | |
| - 'assets/**' | |
| - '*.md' | |
| - '**/*.md' | |
| - 'LICENSE*' | |
| - 'examples/**' | |
| - 'test/**' | |
| - 'Makefile.win' | |
| - 'cc_toolchain/**' | |
| - 'c_src/windows_fix/windows_fix.cpp' | |
| - 'checksum.exs' | |
| - 'do_release.sh' | |
| - '.github/FUNDING.yml' | |
| - '.github/scripts/script-to-build-freebsd.sh' | |
| - '.github/workflows/linux-*' | |
| - '.github/workflows/macos-*' | |
| - '.github/workflows/windows-*' | |
| - '.github/workflows/freebsd-*' | |
| - '.github/workflows/test-*.yml' | |
| - '.github/workflows/opencv-js-*.yml' | |
| - '.github/*manylinux*.sh' | |
| push: | |
| tags: | |
| - 'v*' | |
| branches: | |
| - main | |
| - nerves-* | |
| paths-ignore: | |
| - 'assets/**' | |
| - '*.md' | |
| - '**/*.md' | |
| - 'LICENSE*' | |
| - 'examples/**' | |
| - 'Makefile.win' | |
| - 'cc_toolchain/**' | |
| - 'c_src/windows_fix/windows_fix.cpp' | |
| - 'checksum.exs' | |
| - '.github/FUNDING.yml' | |
| - '.github/scripts/script-to-build-freebsd.sh' | |
| - '.github/workflows/linux-*' | |
| - '.github/workflows/macos-*' | |
| - '.github/workflows/windows-*' | |
| - '.github/workflows/test-*.yml' | |
| - '.github/workflows/freebsd-*.yml' | |
| - '.github/workflows/opencv-js-*.yml' | |
| - '.github/*manylinux*.sh' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| mix_compile: | |
| # nerves-build is heavy and rarely affected by most PRs, so it is | |
| # skipped on PRs by default. Add the `nerves-build` label to a PR to | |
| # run it. push/tag/workflow_dispatch events always run it. | |
| # The `skip-ci` label skips it everywhere, like the other workflows. | |
| if: >- | |
| ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') | |
| && (github.event_name != 'pull_request' | |
| || contains(github.event.pull_request.labels.*.name, 'nerves-build')) }} | |
| runs-on: ubuntu-22.04 | |
| env: | |
| MIX_ENV: prod | |
| NERVES_PROJ_NAME: nerves_evision | |
| OPENCV_VER: "5.0.0" | |
| NERVES_LIVEBOOK_VER: "v0.19.0" | |
| ELIXIR_VERSION: "1.19.5" | |
| EVISION_PREFER_PRECOMPILED: "false" | |
| strategy: | |
| matrix: | |
| include: | |
| - pair: | |
| target: rpi0_2 | |
| otp_version: "28" | |
| - pair: | |
| target: rpi5 | |
| otp_version: "28" | |
| - pair: | |
| target: rpi4 | |
| otp_version: "28" | |
| - pair: | |
| target: rpi3a | |
| otp_version: "28" | |
| - pair: | |
| target: rpi3 | |
| otp_version: "28" | |
| - pair: | |
| target: rpi2 | |
| otp_version: "28" | |
| - pair: | |
| target: rpi0 | |
| otp_version: "28" | |
| - pair: | |
| target: rpi | |
| otp_version: "28" | |
| - pair: | |
| target: bbb | |
| otp_version: "28" | |
| - pair: | |
| target: osd32mp1 | |
| otp_version: "28" | |
| - pair: | |
| target: npi_imx6ull | |
| otp_version: "28" | |
| - pair: | |
| target: grisp2 | |
| otp_version: "28" | |
| - pair: | |
| target: mangopi_mq_pro | |
| otp_version: "28" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: ${{ matrix.pair.otp_version }} | |
| elixir-version: ${{ env.ELIXIR_VERSION }} | |
| - name: Install nerves and system dependencies | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCulZpVE/JdpWX53C35n45RSIMtaIIiTMnmRo5oDEMbyh0NnKI5byikkOvGnGLOO2KTlq4We+MF5iKx72B1Ixl8RY7L6Kc/h3R6jG4uOWBhw/WBhIebteJVYDzrlU8fHTewquWYT6tJ7v7g54Qe5vofsDeKBDqTJqJPlwNSxP8AjPZ0vQ4O4IhG0CXaDzU/G50sqzquKckgGWURLN9LcsA+kzciKJRhKw4Q7kpOiTNG/fzYxBpgpNrnyyr7bhj0jdOsg9KoG57aLSqbmEVCOyWa6yh6lOTp37S6ijBfQORxUu3I+6B04zUBSEvN4wgqslHU9pbIio8Szz1vbnlqsgO0tG1yqALfs6RVSjW81AujKefeH/8seE7q0yiHJXkE4tejIcewJT+2e6p/fP2pVSwyRqZ1bObtRUCMG3Pwdi0IpfsyBSa02Qc7eT9VB1WN7XD1vpfMDQ/nIWmoA40VkX3F3v5Mht5PZwVmlRyM8BrLtCYTreUP5xl6ZZCSX2IfOI8= nerves-ci-build' > ~/.ssh/id_rsa.pub | |
| sudo apt-get update && sudo apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip curl git libssl-dev libncurses5-dev python3 ca-certificates squashfs-tools ssh-askpass libmnl-dev libeigen3-dev | |
| mix local.hex --force | |
| mix local.rebar --force | |
| - name: Cache mix packages | |
| id: cache-mix-deps | |
| uses: actions/cache@v6 | |
| with: | |
| key: deps-${{ hashFiles('mix.lock') }}-${{ matrix.pair.otp_version }}-${{ env.ELIXIR_VERSION }} | |
| path: | | |
| ./deps | |
| - name: Get mix deps | |
| if: steps.cache-mix-deps.outputs.cache-hit != 'true' | |
| run: | | |
| mix deps.get | |
| - name: Cache OpenCV | |
| id: cache-opencv | |
| uses: actions/cache@v6 | |
| with: | |
| key: opencv-${{ env.OPENCV_VER }}-${{ hashFiles('patches/**') }} | |
| path: | | |
| ./3rd_party | |
| - name: Download OpenCV | |
| if: steps.cache-opencv.outputs.cache-hit != 'true' | |
| run: | | |
| bash scripts/download_opencv.sh ${OPENCV_VER} 3rd_party/cache 3rd_party/opencv/ | |
| - name: Make a nerves project | |
| run: | | |
| # nerves_bootstrap comes from Hex; retry to ride out transient registry timeouts | |
| n=0 | |
| until mix archive.install hex nerves_bootstrap --force; do | |
| n=$((n + 1)) | |
| if [ "$n" -ge 5 ]; then | |
| echo "nerves_bootstrap archive.install failed after $n attempts" | |
| exit 1 | |
| fi | |
| echo "archive.install failed, retrying ($n)..." | |
| sleep 10 | |
| done | |
| wget -k https://github.com/fwup-home/fwup/releases/download/v1.16.0/fwup_1.16.0_amd64.deb -O ./fwup_1.16.0_amd64.deb | |
| sudo dpkg -i ./fwup_1.16.0_amd64.deb | |
| cd ../ | |
| git clone https://github.com/livebook-dev/nerves_livebook.git | |
| cd nerves_livebook | |
| git checkout "${NERVES_LIVEBOOK_VER}" | |
| git checkout mix.exs | |
| LINE="$(grep -n 'toolshed' mix.exs | awk -F: '{print $1+1}')" | |
| head -n "${LINE}" mix.exs > mix.exs.tmp | |
| echo ' {:evision, path: "../evision"},' >> mix.exs.tmp | |
| tail -n "+${LINE}" mix.exs >> mix.exs.tmp | |
| mv mix.exs.tmp mix.exs | |
| # nerves_livebook pins an older nx than evision (dev) needs; force evision's version | |
| sed -i -E 's/\{:nx, "~> [0-9.]+"\}/{:nx, "~> 0.12.1", override: true}/' mix.exs | |
| cat mix.exs | |
| export MIX_TARGET=${{ matrix.pair.target }} | |
| mix deps.get | |
| mix deps.update nx | |
| mix deps.update kino | |
| cp -a ../evision/examples ./priv/evision_examples | |
| sed -i 's/"welcome.livemd"\,/"welcome.livemd"\, "evision_examples",/g' lib/nerves_livebook/application.ex | |
| export MAKE_BUILD_FLAGS="-j$(nproc)" | |
| mix deps.compile | |
| export PRIV_DIR="_build/${MIX_TARGET}_${MIX_ENV}/lib/evision/priv" | |
| rm -rf "${PRIV_DIR}/include" | |
| mix firmware | |
| mkdir -p "/tmp/firmware" | |
| cp "./_build/${MIX_TARGET}_${MIX_ENV}/nerves/images/nerves_livebook.fw" "/tmp/firmware/${NERVES_PROJ_NAME}_${{ matrix.pair.target }}_${MIX_ENV}.fw" | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.NERVES_PROJ_NAME }}_${{ matrix.pair.target }}_${{ env.MIX_ENV }}.fw | |
| path: /tmp/firmware/${{ env.NERVES_PROJ_NAME }}_${{ matrix.pair.target }}_${{ env.MIX_ENV }}.fw | |
| - uses: ./.github/actions/upload-release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: /tmp/firmware/${{ env.NERVES_PROJ_NAME }}_${{ matrix.pair.target }}_${{ env.MIX_ENV }}.fw |