From b290889ffd39afb6b22cf844465b5ad9c3da7708 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Sun, 21 Sep 2025 18:40:50 +0100 Subject: [PATCH 01/10] misc: Added funding configuration for GH --- .github/FUNDING.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..8158731 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: [esden, dragonmux] +patreon: 1bitsquared From 9dced4bc843f51c064012fee2336c732a231d693 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Sun, 21 Sep 2025 23:44:46 +0100 Subject: [PATCH 02/10] misc: Added Linux-based CI using GHA --- .github/workflows/build-linux.yml | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/build-linux.yml diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 0000000..1fccea0 --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,65 @@ +name: Build Linux + +on: + push: + branches: + - 'main' + pull_request: + branches: + - 'main' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-linux: + name: '${{ matrix.os.id }}' + runs-on: ${{ matrix.os.id }} + defaults: + run: + shell: bash + strategy: + matrix: + os: + - {id: ubuntu-22.04, name: jammy} + - {id: ubuntu-24.04, name: noble} + fail-fast: false + steps: + - name: Runtime environment + env: + WORKSPACE: ${{ github.workspace }} + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV + - name: Checkout bmputil + uses: actions/checkout@v5 + with: + lfs: true + submodules: true + - name: Setup Rust + run: rustup update stable + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@v2 + with: + tool: cargo-llvm-cov + - name: Version tools + run: | + cargo --version + rustc --version + cargo llvm-cov --version + - name: Build + run: cargo b + - name: Test + run: cargo t + - name: Collect code coverage + run: cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json + - name: Codecov + if: success() && github.repository == 'blackmagic-debug/bmputil' + uses: codecov/codecov-action@v5 + with: + files: codecov.json + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} From b6a868326ce13a1167148a57e74c39c327e6ab74 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Mon, 22 Sep 2025 00:04:29 +0100 Subject: [PATCH 03/10] error: Fixed the examples which are being considered doctests so they build correctly and execute cleanly --- src/error.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index 303a2f1..24575df 100644 --- a/src/error.rs +++ b/src/error.rs @@ -49,7 +49,11 @@ impl ErrorKind /// /// Enables convenient code like: /// ``` - /// return Err(ErrorKind::DeviceNotFound.error()); + /// use bmputil::error::{Error, ErrorKind}; + /// fn do_something() -> Result<(), Error> + /// { + /// Err(ErrorKind::DeviceNotFound.error()) + /// } /// ``` #[inline(always)] pub fn error(self) -> Error @@ -61,8 +65,14 @@ impl ErrorKind /// /// Enables convenient code like: /// ``` - /// # let operation = || std::io::Error::from(std::io::ErrorKind::PermissionDenied); - /// operation().map_err(|e| ErrorKind::DeviceNotFound.error_from(e))?; + /// use bmputil::error::{Error, ErrorKind}; + /// fn do_something() -> Result<(), Error> + /// { + /// let operation = + /// || -> Result<(), std::io::Error> { Err(std::io::Error::from(std::io::ErrorKind::PermissionDenied)) }; + /// operation().map_err(|e| ErrorKind::DeviceNotFound.error_from(e))?; + /// Ok(()) + /// } /// ``` #[inline(always)] pub fn error_from(self, source: E) -> Error From f46fc384aea04e7d4b3e903908e6347647e6b27d Mon Sep 17 00:00:00 2001 From: dragonmux Date: Mon, 22 Sep 2025 00:20:35 +0100 Subject: [PATCH 04/10] misc: Added macOS-based CI using GHA and the native compiler --- .github/workflows/build-macos.yml | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/build-macos.yml diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml new file mode 100644 index 0000000..54a1ebb --- /dev/null +++ b/.github/workflows/build-macos.yml @@ -0,0 +1,66 @@ +name: Build MacOS + +on: + push: + branches: + - 'main' + pull_request: + branches: + - 'main' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-macos: + name: '${{ matrix.os }}' + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + strategy: + matrix: + os: + - macos-13 + - macos-14 + - macos-15 + fail-fast: false + steps: + - name: Runtime environment + env: + WORKSPACE: ${{ github.workspace }} + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV + - name: Checkout bmputil + uses: actions/checkout@v5 + with: + lfs: true + submodules: true + - name: Setup Rust + run: rustup update stable + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@v2 + with: + tool: cargo-llvm-cov + - name: Version tools + run: | + cargo --version + rustc --version + cargo llvm-cov --version + - name: Build + run: cargo b + - name: Test + run: cargo t + - name: Collect code coverage + run: cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json + - name: Codecov + if: success() && github.repository == 'blackmagic-debug/bmputil' + uses: codecov/codecov-action@v5 + with: + files: codecov.json + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} From 01c1d76b8cf0bcf3deda86d392aef31a2da706f0 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Mon, 22 Sep 2025 00:27:50 +0100 Subject: [PATCH 05/10] misc: Added Windows-based CI using GHA and the native compiler --- .github/workflows/build-windows.yml | 65 +++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/build-windows.yml diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 0000000..eba19d3 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,65 @@ +name: Build Windows + +on: + push: + branches: + - 'main' + pull_request: + branches: + - 'main' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-windows: + name: '${{ matrix.os }} (msvc)' + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - windows-2022 + - windows-2025 + fail-fast: false + steps: + - name: Runtime environment + env: + WORKSPACE: ${{ github.workspace }} + run: | + echo "$env:HOMEDRIVE$env:HOMEPATH\\.local\\bin" >> $env:GITHUB_PATH + echo "$env:HOMEDRIVE$env:HOMEPATH\\.cargo\\bin" >> $env:GITHUB_PATH + echo "GITHUB_WORKSPACE=$(pwd)" >> $env:GITHUB_ENV + - name: Checkout bmputil + uses: actions/checkout@v5 + with: + lfs: true + submodules: true + - name: Setup Rust + run: | + rustup toolchain install stable-x86_64-pc-windows-msvc + rustup toolchain install stable-aarch64-pc-windows-msvc + rustup default stable-x86_64-pc-windows-msvc + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@v2 + with: + tool: cargo-llvm-cov + - name: Version tools + run: | + cargo --version + rustc --version + cargo llvm-cov --version + - name: Build + run: cargo b + - name: Test + run: cargo t + - name: Collect code coverage + run: cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json + - name: Codecov + if: success() && github.repository == 'blackmagic-debug/bmputil' + uses: codecov/codecov-action@v5 + with: + files: codecov.json + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} From e938756556220a6b1b1acdc7371067fb8bda5f4c Mon Sep 17 00:00:00 2001 From: dragonmux Date: Mon, 22 Sep 2025 00:36:44 +0100 Subject: [PATCH 06/10] misc: Added Windows-based CI using GHA and MSYS2 --- .github/workflows/build-windows.yml | 66 +++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index eba19d3..1a25416 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -63,3 +63,69 @@ jobs: files: codecov.json fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + + build-mingw: + name: '${{ matrix.os }} (${{ matrix.sys }})' + runs-on: ${{ matrix.os }} + defaults: + run: + shell: msys2 {0} + strategy: + matrix: + os: + - windows-2022 + - windows-2025 + sys: + - mingw64 + - ucrt64 + - clang64 + fail-fast: false + steps: + - name: Use MinGW from MSYS + uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.sys }} + update: true + path-type: inherit + pacboy: >- + toolchain:p + rustup:p + - name: Runtime environment + env: + WORKSPACE: ${{ github.workspace }} + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV + - name: Checkout bmputil + uses: actions/checkout@v5 + with: + lfs: true + submodules: true + - name: Setup Rust + run: | + rustup toolchain install stable-x86_64-pc-windows-gnu + rustup toolchain install --force-non-host stable-aarch64-pc-windows-gnu + rustup default stable-x86_64-pc-windows-gnu + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@v2 + with: + tool: cargo-llvm-cov + - name: Version tools + run: | + cargo --version + rustc --version + cargo llvm-cov --version + - name: Build + run: cargo b + - name: Test + run: cargo t + - name: Collect code coverage + run: cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json + - name: Codecov + if: success() && github.repository == 'blackmagic-debug/bmputil' + uses: codecov/codecov-action@v5 + with: + files: codecov.json + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} From 6737d9f0ef75af7348a88560ae49ab0662f32f05 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Mon, 22 Sep 2025 02:08:40 +0100 Subject: [PATCH 07/10] misc: Make sure to install the WDK redistributable we need for the build to succeed on Windows --- .github/workflows/build-windows.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 1a25416..b909650 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -31,6 +31,11 @@ jobs: echo "$env:HOMEDRIVE$env:HOMEPATH\\.local\\bin" >> $env:GITHUB_PATH echo "$env:HOMEDRIVE$env:HOMEPATH\\.cargo\\bin" >> $env:GITHUB_PATH echo "GITHUB_WORKSPACE=$(pwd)" >> $env:GITHUB_ENV + - name: Install WDK redist components + run: | + Invoke-WebRequest https://go.microsoft.com/fwlink/p/?LinkID=253170 -OutFile wdk-redist.msi + Start-Process -FilePath msiexec -Verb Runas -Wait -ArgumentList "/i","$PWD\wdk-redist.msi","/passive","/qn","LicenseAccepted=1" + rm wdk-redist.msi - name: Checkout bmputil uses: actions/checkout@v5 with: From 142e338e4d25674bfd904e1deb50ad1a5b4e7fcd Mon Sep 17 00:00:00 2001 From: dragonmux Date: Tue, 23 Sep 2025 23:45:06 +0100 Subject: [PATCH 08/10] misc: Added macOS-based CI using GHA and homebrew --- .github/workflows/build-macos.yml | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 54a1ebb..6037cb3 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -64,3 +64,53 @@ jobs: files: codecov.json fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + + build-macos-homebrew: + name: '${{ matrix.os }} (homebrew)' + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-14 + fail-fast: false + steps: + - name: Runtime environment + shell: bash + env: + WORKSPACE: ${{ github.workspace }} + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV + - name: Checkout bmputil + uses: actions/checkout@v5 + with: + lfs: true + submodules: true + - name: Setup Rust + run: | + brew install rustup gcc + rustup toolchain install stable + rustup default stable + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@v2 + with: + tool: cargo-llvm-cov + - name: Version tools + run: | + cargo --version + rustc --version + cargo llvm-cov --version + - name: Build + run: cargo b + - name: Test + run: cargo t + - name: Collect code coverage + run: cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json + - name: Codecov + if: success() && github.repository == 'blackmagic-debug/bmputil' + uses: codecov/codecov-action@v5 + with: + files: codecov.json + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} From 65fafd97c3d042e9e183f2bdd5ef1fc5d2ca97e4 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Tue, 23 Sep 2025 23:48:09 +0100 Subject: [PATCH 09/10] misc: Tweaks for the Windows-based CI to ignore MSYS2/MinGW for now --- .github/workflows/build-windows.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index b909650..a155326 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -70,6 +70,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} build-mingw: + # Turn MSYS2/MinGW builds off for now as they're terminally broken till some things are fixed in libwdi-sys + if: false name: '${{ matrix.os }} (${{ matrix.sys }})' runs-on: ${{ matrix.os }} defaults: @@ -102,6 +104,11 @@ jobs: echo "$HOME/.local/bin" >> $GITHUB_PATH echo "$HOME/.cargo/bin" >> $GITHUB_PATH echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV + - name: Install WDK redist components + run: | + curl -Lo wdk-redist.msi https://go.microsoft.com/fwlink/p/?LinkID=253170 + sudo msiexec /i $PWD\wdk-redist.msi /passive /qn LicenseAccepted=1 + rm wdk-redist.msi - name: Checkout bmputil uses: actions/checkout@v5 with: From 4f93ee89a9e8f5f2ed6d18e9bf496515e7f21739 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Wed, 24 Sep 2025 00:05:53 +0100 Subject: [PATCH 10/10] misc: Created build-and-upload style step that triggers when a push to `main` occurs --- .github/workflows/build-linux.yml | 11 +++++++++++ .github/workflows/build-macos.yml | 22 ++++++++++++++++++++++ .github/workflows/build-windows.yml | 22 ++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 1fccea0..929ca13 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -63,3 +63,14 @@ jobs: files: codecov.json fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + - name: Release build + if: success() && github.event_name == 'push' + run: | + cargo b -r + - name: Upload build + if: success() && github.event_name == 'push' + uses: actions/upload-artifact@v4 + with: + name: bmputil-${{ matrix.os.id }} + path: target/release/bmputil-cli + if-no-files-found: error diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 6037cb3..be7a1a2 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -64,6 +64,17 @@ jobs: files: codecov.json fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + - name: Release build + if: success() && github.event_name == 'push' + run: | + cargo b -r + - name: Upload build + if: success() && github.event_name == 'push' + uses: actions/upload-artifact@v4 + with: + name: bmputil-${{ matrix.os }} + path: target/release/bmputil-cli + if-no-files-found: error build-macos-homebrew: name: '${{ matrix.os }} (homebrew)' @@ -114,3 +125,14 @@ jobs: files: codecov.json fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + - name: Release build + if: success() && github.event_name == 'push' + run: | + cargo b -r + - name: Upload build + if: success() && github.event_name == 'push' + uses: actions/upload-artifact@v4 + with: + name: bmputil-${{ matrix.os }}-homebrew + path: target/release/bmputil-cli + if-no-files-found: error diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index a155326..4163c36 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -68,6 +68,17 @@ jobs: files: codecov.json fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + - name: Release build + if: success() && github.event_name == 'push' + run: | + cargo b -r + - name: Upload build + if: success() && github.event_name == 'push' + uses: actions/upload-artifact@v4 + with: + name: bmputil-${{ matrix.os }}-msvc + path: target/release/bmputil-cli + if-no-files-found: error build-mingw: # Turn MSYS2/MinGW builds off for now as they're terminally broken till some things are fixed in libwdi-sys @@ -141,3 +152,14 @@ jobs: files: codecov.json fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + - name: Release build + if: success() && github.event_name == 'push' + run: | + cargo b -r + - name: Upload build + if: success() && github.event_name == 'push' + uses: actions/upload-artifact@v4 + with: + name: bmputil-${{ matrix.os }}-${{ matrix.sys }} + path: target/release/bmputil-cli + if-no-files-found: error