(APPLE) Build a Universal Framework, and add code signing and notarization #726
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: C/C++ CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| tags: ['*'] | |
| paths: | |
| - '**' | |
| - '!docs/**' | |
| - '!.github/**' | |
| - '.github/workflows/cppcmake.yml' | |
| pull_request: | |
| release: | |
| types: ['created'] | |
| workflow_dispatch: | |
| inputs: | |
| cmakeextra: | |
| description: 'Extra CMake options' | |
| required: false | |
| default: '' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build: | |
| name: ${{ matrix.config.name }} | |
| runs-on: ${{ matrix.config.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - {name: "ubuntu-22.04", os: "ubuntu-22.04", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF" } | |
| - {name: "ubuntu-24.04", os: "ubuntu-24.04", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF" } | |
| - {name: "windows-x64", os: "windows-latest", cmake_extra: "-T v142,host=x86"} | |
| - {name: "windows-32", os: "windows-latest", cmake_extra: "-T v142,host=x86 -A Win32"} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Configure CMake | |
| run: | | |
| if [[ "${{ matrix.config.name }}" = ubuntu-2* ]]; then | |
| sudo apt-get install -y --no-install-recommends libpugixml-dev | |
| fi | |
| cmake --version | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_INSTALL_PREFIX=${PWD}/install \ | |
| -DLSL_UNITTESTS=ON \ | |
| -DLSL_BENCHMARKS=ON \ | |
| -DCPACK_PACKAGE_DIRECTORY=${PWD}/package \ | |
| -Dlslgitrevision=${{ github.sha }} \ | |
| -Dlslgitbranch=${{ github.ref }} \ | |
| ${{ matrix.config.cmake_extra }} \ | |
| ${{ github.event.inputs.cmakeextra }} | |
| echo ${PWD} | |
| - name: make | |
| run: cmake --build build --config Release -j | |
| - name: make install | |
| run: cmake --build build --config Release --target install | |
| - name: test install using examples | |
| run: | | |
| # Test that the in-tree install was successful by building the examples | |
| cmake -S examples -B examples/build \ | |
| -DLSL_INSTALL_ROOT=${PWD}/install \ | |
| -DCMAKE_INSTALL_PREFIX=examples/build/install \ | |
| -DLSL_COMFY_DEFAULTS=ON \ | |
| ${{ matrix.config.cmake_extra }} \ | |
| ${{ github.event.inputs.cmakeextra }} | |
| cmake --build examples/build --target install --config Release -j | |
| ./examples/build/install/bin/HandleMetaData | |
| - name: package | |
| run: | | |
| echo $GITHUB_REF | |
| cmake --build build --target package --config Release -j | |
| echo $PWD | |
| ls -la | |
| # On Debian / Ubuntu the dependencies can only be resolved for | |
| # already installed packages. Therefore, we have built all | |
| # packages without dependencies in the previous step, | |
| # install them and rebuild them with dependency discovery enabled | |
| if [[ "${{ matrix.config.os }}" == ubuntu-* ]]; then | |
| cmake -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON . | |
| sudo dpkg -i package/*.deb | |
| cmake --build build --target package --config Release -j | |
| dpkg -I package/liblsl*.deb | |
| fi | |
| cmake -E remove_directory package/_CPack_Packages | |
| cp testing/lslcfgs/default.cfg . | |
| - name: upload install dir | |
| uses: actions/upload-artifact@master | |
| with: | |
| name: build-${{ matrix.config.name }} | |
| path: install | |
| - name: upload package | |
| uses: actions/upload-artifact@master | |
| with: | |
| name: pkg-${{ matrix.config.name }} | |
| path: package | |
| - name: print network config | |
| run: | | |
| which ifconfig && ifconfig | |
| if [ `which ip` ]; then | |
| ip link | |
| ip addr | |
| ip route | |
| ip -6 route | |
| fi | |
| # run internal tests | |
| - name: unit tests | |
| run: | | |
| if [[ "${{ matrix.config.name }}" = ubuntu-2* ]]; then | |
| ulimit -c unlimited | |
| echo "$PWD/dumps/corefile-%e-%p-%t" | sudo tee /proc/sys/kernel/core_pattern | |
| fi | |
| mkdir -p dumps | |
| install/bin/lsl_test_internal --order rand --wait-for-keypress never --durations yes | |
| install/bin/lsl_test_exported --order rand --wait-for-keypress never --durations yes | |
| timeout-minutes: 10 | |
| - name: upload dump | |
| if: failure() | |
| uses: actions/upload-artifact@master | |
| with: | |
| name: dumps-${{ matrix.config.name }} | |
| path: dumps | |
| - name: upload to release page | |
| if: github.event_name == 'release' | |
| env: | |
| TOKEN: "token ${{ secrets.GITHUB_TOKEN }}" | |
| TAG: ${{ github.event.release.tag_name }} | |
| UPLOAD_URL: ${{ github.event.release.upload_url }} | |
| run: | | |
| # Do try this at home! The REST API is documented at | |
| # https://docs.github.com/en/free-pro-team@latest/rest and you can get a personal | |
| # access token at https://github.com/settings/tokens | |
| # (set TOKEN to "bearer abcdef1234") | |
| # you can get the UPLOAD_URL with a short bash snippet; make sure to set the env var TAG: | |
| # UPLOAD_URL=$(curl -H 'Accept: application/vnd.github.v3+json' $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/$TAG | jq -r .upload_url) | |
| UPLOAD_URL=${UPLOAD_URL%\{*} # remove "{name,label}" suffix | |
| for pkg in package/*.*; do | |
| NAME=$(basename $pkg) | |
| MIME=$(file --mime-type $pkg|cut -d ' ' -f2) | |
| curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: $TOKEN" -H "Content-Type: $MIME" --data-binary @$pkg $UPLOAD_URL?name=$NAME | |
| done |