misc: move usb lifecycle into new IOConfigurator #454
Workflow file for this run
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: libdof | |
| on: | |
| push: | |
| pull_request: | |
| permissions: | |
| contents: write | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| version: | |
| name: Detect version | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| tag: ${{ steps.version.outputs.tag }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - id: version | |
| run: | | |
| VERSION_MAJOR=$(grep -Eo "LIBDOF_VERSION_MAJOR\s+[0-9]+" include/DOF/DOF.h | grep -Eo "[0-9]+") | |
| VERSION_MINOR=$(grep -Eo "LIBDOF_VERSION_MINOR\s+[0-9]+" include/DOF/DOF.h | grep -Eo "[0-9]+") | |
| VERSION_PATCH=$(grep -Eo "LIBDOF_VERSION_PATCH\s+[0-9]+" include/DOF/DOF.h | grep -Eo "[0-9]+") | |
| TAG="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" | |
| echo "${TAG}" | |
| echo "tag=${TAG}" >> $GITHUB_OUTPUT | |
| build: | |
| name: Build libdof-${{ matrix.platform }}-${{ matrix.arch }} | |
| runs-on: ${{ matrix.os }} | |
| needs: [ version ] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { os: windows-2025, platform: win, arch: x64 } | |
| - { os: windows-2025, platform: win, arch: x86 } | |
| - { os: windows-2025, platform: win-mingw, arch: x64 } | |
| - { os: macos-15, platform: macos, arch: arm64 } | |
| - { os: macos-15, platform: macos, arch: x64 } | |
| - { os: ubuntu-24.04, platform: linux, arch: x64 } | |
| - { os: ubuntu-24.04-arm, platform: linux, arch: aarch64 } | |
| - { os: ubuntu-24.04, platform: android, arch: arm64-v8a } | |
| - { os: macos-15, platform: ios, arch: arm64 } | |
| - { os: macos-15, platform: ios-simulator, arch: arm64 } | |
| - { os: macos-15, platform: tvos, arch: arm64 } | |
| steps: | |
| - uses: actions/checkout@v6 | |
| # | |
| # install dependencies | |
| # | |
| - if: (matrix.platform == 'win') | |
| uses: microsoft/setup-msbuild@v3 | |
| - if: (matrix.platform == 'win') | |
| run: | | |
| if [[ "${{ matrix.arch }}" == "x64" ]]; then | |
| /c/msys64/usr/bin/bash.exe -l -c "pacman -S --noconfirm \ | |
| make diffutils \ | |
| mingw-w64-ucrt-x86_64-gcc \ | |
| mingw-w64-ucrt-x86_64-libwinpthread \ | |
| mingw-w64-ucrt-x86_64-cmake" | |
| else | |
| /c/msys64/usr/bin/bash.exe -l -c "pacman -S --noconfirm \ | |
| make diffutils \ | |
| mingw-w64-i686-gcc \ | |
| mingw-w64-i686-libwinpthread \ | |
| mingw-w64-i686-cmake" | |
| fi | |
| - if: (matrix.platform == 'win-mingw') | |
| run: | | |
| /c/msys64/usr/bin/bash.exe -l -c "pacman -S --noconfirm \ | |
| make diffutils autoconf automake libtool \ | |
| mingw-w64-ucrt-x86_64-gcc \ | |
| mingw-w64-ucrt-x86_64-libwinpthread \ | |
| mingw-w64-ucrt-x86_64-cmake" | |
| - if: (matrix.platform == 'macos' || matrix.platform == 'ios' || matrix.platform == 'ios-simulator' || matrix.platform == 'tvos') | |
| run: brew install autoconf automake libtool | |
| - if: (matrix.platform == 'linux') | |
| run: | | |
| sudo apt-get update | |
| sudo apt install libudev-dev autoconf automake libtool pkg-config | |
| # | |
| # build (win) | |
| # | |
| - if: (matrix.platform == 'win') | |
| name: Build (win) | |
| run: | | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | |
| if [[ "${{ matrix.arch }}" == "x64" ]]; then | |
| cmake \ | |
| -G "Visual Studio 17 2022" \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| else | |
| cmake \ | |
| -G "Visual Studio 17 2022" \ | |
| -A Win32 \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| fi | |
| cmake --build build --config Release | |
| # | |
| # build (win-mingw) | |
| # | |
| - if: (matrix.platform == 'win-mingw') | |
| name: Build (win-mingw) | |
| run: | | |
| CURRENT_DIR="$(pwd)" | |
| MSYSTEM=UCRT64 /c/msys64/usr/bin/bash.exe -l -c " | |
| cd \"${CURRENT_DIR}\" && | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh && | |
| cmake \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build && | |
| cmake --build build -- -j\$(nproc) | |
| " | |
| # | |
| # build (macos) | |
| # | |
| - if: (matrix.platform == 'macos') | |
| name: Build (macos) | |
| run: | | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | |
| cmake \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| cmake --build build -- -j$(sysctl -n hw.ncpu) | |
| # | |
| # build (linux) | |
| # | |
| - if: (matrix.platform == 'linux') | |
| name: Build (linux) | |
| run: | | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | |
| cmake \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| cmake --build build -- -j$(nproc) | |
| # | |
| # build (ios/tvos) | |
| # | |
| - if: (matrix.platform == 'ios' || matrix.platform == 'ios-simulator' || matrix.platform == 'tvos') | |
| name: Build (ios/tvos) | |
| run: | | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | |
| cmake \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| cmake --build build -- -j$(sysctl -n hw.ncpu) | |
| # | |
| # build (android) | |
| # | |
| - if: (matrix.platform == 'android') | |
| name: Build (android) | |
| run: | | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | |
| cmake \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| cmake --build build -- -j$(nproc) | |
| # | |
| # prepare artifacts | |
| # | |
| - if: (matrix.platform == 'win') | |
| name: Prepare artifacts (win) | |
| run: | | |
| mkdir tmp | |
| cp build/Release/*.lib tmp/ | |
| cp build/Release/*.dll tmp/ | |
| cp build/Release/*.exe tmp/ | |
| cd tmp && 7z a -r ../libdof-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip * | |
| - if: (matrix.platform == 'win-mingw') | |
| name: Prepare artifacts (win-mingw) | |
| run: | | |
| mkdir tmp | |
| cp build/*.dll tmp/ | |
| cp build/*.dll.a tmp/ | |
| cp build/dof_static.a tmp/ | |
| cp build/*.exe tmp/ | |
| cd tmp && 7z a -r ../libdof-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip * | |
| - if: (matrix.platform == 'macos') | |
| name: Prepare artifacts (macos) | |
| run: | | |
| mkdir tmp | |
| cp build/libdof.a tmp/ | |
| cp -a build/*.dylib tmp/ | |
| cp build/dof_test_s tmp/ | |
| cp build/dof_test tmp/ | |
| cp build/ledwiz_test tmp/ | |
| cp build/pacled64_test tmp/ | |
| cd tmp && tar -czvf ../libdof-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz * | |
| - if: (matrix.platform == 'linux') | |
| name: Prepare artifacts (linux) | |
| run: | | |
| mkdir tmp | |
| cp build/libdof.a tmp/ | |
| cp -a build/*.so tmp/ | |
| cp -a build/*.so.* tmp/ | |
| cp build/dof_test_s tmp/ | |
| cp build/dof_test tmp/ | |
| cp build/ledwiz_test tmp/ | |
| cp build/pacled64_test tmp/ | |
| cd tmp && tar -czvf ../libdof-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz * | |
| - if: (matrix.platform == 'ios' || matrix.platform == 'ios-simulator' || matrix.platform == 'tvos') | |
| name: Prepare artifacts (ios/tvos) | |
| run: | | |
| mkdir tmp | |
| cp build/libdof.a tmp/ | |
| cp -a build/*.dylib tmp/ | |
| cd tmp && tar -czvf ../libdof-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz * | |
| - if: (matrix.platform == 'android') | |
| name: Prepare artifacts (android) | |
| run: | | |
| mkdir tmp | |
| cp build/libdof.a tmp/ | |
| cp build/libdof.so tmp/ | |
| cd tmp && tar -czvf ../libdof-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz * | |
| # | |
| # upload artifacts | |
| # | |
| - if: (matrix.platform == 'win' || matrix.platform == 'win-mingw') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: libdof-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip | |
| path: libdof-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip | |
| archive: false | |
| - if: (matrix.platform != 'win' && matrix.platform != 'win-mingw') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: libdof-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz | |
| path: libdof-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz | |
| archive: false | |
| post-build: | |
| runs-on: macos-15 | |
| needs: [ version, build ] | |
| name: Build libdof-macos | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: libdof-${{ needs.version.outputs.tag }}-macos-x64.tar.gz | |
| skip-decompress: true | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: libdof-${{ needs.version.outputs.tag }}-macos-arm64.tar.gz | |
| skip-decompress: true | |
| - name: Combine macos architectures | |
| run: | | |
| mkdir macos-x64 macos-arm64 | |
| tar -xzvf libdof-${{ needs.version.outputs.tag }}-macos-x64.tar.gz -C macos-x64 | |
| tar -xzvf libdof-${{ needs.version.outputs.tag }}-macos-arm64.tar.gz -C macos-arm64 | |
| mkdir tmp | |
| find macos-arm64 -name "*.dylib" | while read -r file; do | |
| if [ -L "$file" ]; then | |
| cp -a "$file" "tmp/" | |
| elif [ -f "$file" ]; then | |
| filename=$(basename "$file") | |
| lipo -create -output "tmp/$filename" \ | |
| "macos-arm64/$filename" \ | |
| "macos-x64/$filename" | |
| fi | |
| done | |
| cd tmp && tar -czvf ../libdof-${{ needs.version.outputs.tag }}-macos.tar.gz * && cd .. | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: libdof-${{ needs.version.outputs.tag }}-macos.tar.gz | |
| path: libdof-${{ needs.version.outputs.tag }}-macos.tar.gz | |
| archive: false | |
| - if: startsWith(github.ref, 'refs/tags/') | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: release | |
| skip-decompress: true | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| draft: true | |
| files: release/**/* |