|
| 1 | +name: Raspberry Pi Build |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + - dev |
| 7 | + tags: ['*'] |
| 8 | + paths: |
| 9 | + - '**' |
| 10 | + - '!docs/**' |
| 11 | + - '!.github/**' |
| 12 | + - '.github/workflows/raspberry_pi.yml' |
| 13 | + pull_request: |
| 14 | + release: |
| 15 | + types: ['created'] |
| 16 | + workflow_dispatch: |
| 17 | + inputs: |
| 18 | + cmakeextra: |
| 19 | + description: 'Extra CMake options' |
| 20 | + required: false |
| 21 | + default: '' |
| 22 | +concurrency: |
| 23 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 24 | + cancel-in-progress: true |
| 25 | + |
| 26 | +defaults: |
| 27 | + run: |
| 28 | + shell: bash |
| 29 | + |
| 30 | +jobs: |
| 31 | + build: |
| 32 | + name: Raspberry Pi ${{ matrix.config.name }} |
| 33 | + runs-on: ubuntu-latest |
| 34 | + timeout-minutes: 30 |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + config: |
| 39 | + # cortex-a7 -> RPi 3+, if we need 1,2,zero, needs to use arm1176 |
| 40 | + # see: https://github.com/marketplace/actions/arm-runner |
| 41 | + # adapted from: https://github.com/castle-engine/castle-engine/blob/master/.github/workflows/test-and-pack-arm-runner.yml |
| 42 | + - {name: "rpi-armv71", os: "raspios_lite:latest", arch: "armv71", cpu: "cortex-a7", cmake_extra: "-DLSL_UNITTESTS=ON -DLSL_BENCHMARKS=ON" } |
| 43 | + - {name: "rpi-aarch64", os: "raspios_lite_arm64:latest", arch: "aarch64", cpu: "cortex-a53", cmake_extra: "-DLSL_UNITTESTS=ON -DLSL_BENCHMARKS=ON" } |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v5 |
| 46 | + - uses: pguyot/arm-runner-action@v2 |
| 47 | + with: |
| 48 | + base_image: ${{ matrix.config.os }} |
| 49 | + arch: ${{ matrix.config.arch }} |
| 50 | + cpu: ${{ matrix.config.cpu }} |
| 51 | + shell: /bin/bash -eo pipefail |
| 52 | + image_additional_mb: 1024 |
| 53 | + bind_mount_repository: true |
| 54 | + - name: Configure CMake |
| 55 | + run: | |
| 56 | + cmake --version |
| 57 | + cmake -S . -B build \ |
| 58 | + -DCMAKE_BUILD_TYPE=Release \ |
| 59 | + -DCMAKE_INSTALL_PREFIX=${PWD}/install \ |
| 60 | + -DLSL_UNITTESTS=ON \ |
| 61 | + -DLSL_BENCHMARKS=ON \ |
| 62 | + -Dlslgitrevision=${{ github.sha }} \ |
| 63 | + -Dlslgitbranch=${{ github.ref }} \ |
| 64 | + ${{ matrix.config.cmake_extra }} |
| 65 | +
|
| 66 | + - name: make |
| 67 | + run: cmake --build build --config Release -j |
| 68 | + |
| 69 | + - name: make install |
| 70 | + run: cmake --build build --config Release --target install -j |
| 71 | + |
| 72 | + - name: test install using examples |
| 73 | + run: | |
| 74 | + # Test that the in-tree install was successful by building the examples |
| 75 | + cmake -S examples -B examples/build \ |
| 76 | + -DLSL_INSTALL_ROOT=${PWD}/install \ |
| 77 | + -DCMAKE_INSTALL_PREFIX=examples/build/install \ |
| 78 | + -DLSL_COMFY_DEFAULTS=ON \ |
| 79 | + ${{ matrix.config.cmake_extra }} \ |
| 80 | + ${{ github.event.inputs.cmakeextra }} |
| 81 | + cmake --build examples/build --target install --config Release -j |
| 82 | + ./examples/build/install/bin/HandleMetaData |
| 83 | +
|
| 84 | + - name: package |
| 85 | + run: | |
| 86 | + echo $GITHUB_REF |
| 87 | + cmake --build build --target package --config Release -j |
| 88 | + echo $PWD |
| 89 | + ls -la |
| 90 | + cmake -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON . |
| 91 | + sudo dpkg -i package/*.deb |
| 92 | + cmake --build build --target package --config Release -j |
| 93 | + dpkg -I package/liblsl*.deb |
| 94 | + cmake -E remove_directory package/_CPack_Packages |
| 95 | + cp testing/lslcfgs/default.cfg . |
| 96 | +
|
| 97 | + - name: upload install dir |
| 98 | + uses: actions/upload-artifact@master |
| 99 | + with: |
| 100 | + name: build-${{ matrix.config.name }} |
| 101 | + path: install |
| 102 | + - name: upload package |
| 103 | + uses: actions/upload-artifact@master |
| 104 | + with: |
| 105 | + name: pkg-${{ matrix.config.name }} |
| 106 | + path: package |
| 107 | + |
| 108 | + # Run tests |
| 109 | + - name: unit tests |
| 110 | + run: | |
| 111 | + if [[ "${{ matrix.config.name }}" = ubuntu-2* ]]; then |
| 112 | + ulimit -c unlimited |
| 113 | + echo "$PWD/dumps/corefile-%e-%p-%t" | sudo tee /proc/sys/kernel/core_pattern |
| 114 | + fi |
| 115 | + mkdir -p dumps |
| 116 | + install/bin/lsl_test_internal --order rand --wait-for-keypress never --durations yes |
| 117 | + install/bin/lsl_test_exported --order rand --wait-for-keypress never --durations yes |
| 118 | + timeout-minutes: 10 |
| 119 | + |
| 120 | + - name: upload dump |
| 121 | + if: failure() |
| 122 | + uses: actions/upload-artifact@master |
| 123 | + with: |
| 124 | + name: dumps-${{ matrix.config.name }} |
| 125 | + path: dumps |
| 126 | + |
| 127 | + - name: upload to release page |
| 128 | + if: github.event_name == 'release' |
| 129 | + env: |
| 130 | + TOKEN: "token ${{ secrets.GITHUB_TOKEN }}" |
| 131 | + TAG: ${{ github.event.release.tag_name }} |
| 132 | + UPLOAD_URL: ${{ github.event.release.upload_url }} |
| 133 | + run: | |
| 134 | + # Do try this at home! The REST API is documented at |
| 135 | + # https://docs.github.com/en/free-pro-team@latest/rest and you can get a personal |
| 136 | + # access token at https://github.com/settings/tokens |
| 137 | + # (set TOKEN to "bearer abcdef1234") |
| 138 | + # you can get the UPLOAD_URL with a short bash snippet; make sure to set the env var TAG: |
| 139 | + # UPLOAD_URL=$(curl -H 'Accept: application/vnd.github.v3+json' $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/$TAG | jq -r .upload_url) |
| 140 | + UPLOAD_URL=${UPLOAD_URL%\{*} # remove "{name,label}" suffix |
| 141 | + for pkg in package/*.*; do |
| 142 | + NAME=$(basename $pkg) |
| 143 | + MIME=$(file --mime-type $pkg|cut -d ' ' -f2) |
| 144 | + curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: $TOKEN" -H "Content-Type: $MIME" --data-binary @$pkg $UPLOAD_URL?name=$NAME |
| 145 | + done |
0 commit comments