Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 0 additions & 85 deletions .github/actions/setup-msvc-dev-cmd/action.yml

This file was deleted.

56 changes: 0 additions & 56 deletions .github/actions/setup-native-prereqs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,59 +44,3 @@ runs:
brew install "$formula"
fi
done

- name: Install Windows dependencies
if: endsWith(inputs.target, '-pc-windows-msvc')
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'

if ($env:VCPKG_DEFAULT_BINARY_CACHE) {
New-Item -ItemType Directory -Force -Path $env:VCPKG_DEFAULT_BINARY_CACHE | Out-Null
}
if ($env:VCPKG_DOWNLOADS) {
New-Item -ItemType Directory -Force -Path $env:VCPKG_DOWNLOADS | Out-Null
}

$Triplet = switch ("${{ inputs.target }}") {
"x86_64-pc-windows-msvc" { "x64-windows" }
"aarch64-pc-windows-msvc" { "arm64-windows" }
default { throw "unsupported Windows target: ${{ inputs.target }}" }
}

$BundledVcpkg = 'C:\vcpkg\vcpkg.exe'
$ResolvedVcpkg = Get-Command vcpkg -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1
$VcpkgExe = if (Test-Path $BundledVcpkg) {
$BundledVcpkg
} elseif ($ResolvedVcpkg) {
$ResolvedVcpkg.Source
} else {
throw 'vcpkg executable was not found'
}

$VcpkgRoot = Split-Path -Parent $VcpkgExe
$env:VCPKG_ROOT = $VcpkgRoot
$env:VCPKG_INSTALLATION_ROOT = $VcpkgRoot
Write-Host "Using vcpkg at $VcpkgExe"

$Packages = @("glib:$Triplet", "libusb:$Triplet", "fftw3:$Triplet", "pkgconf:$Triplet")
& $VcpkgExe install $Packages
if ($LASTEXITCODE -ne 0) {
throw "vcpkg install failed with exit code $LASTEXITCODE"
}

$PkgConfigExe = "$VcpkgRoot/installed/$Triplet/tools/pkgconf/pkgconf.exe"
$PkgConfigPath = "$VcpkgRoot/installed/$Triplet/lib/pkgconfig;$VcpkgRoot/installed/$Triplet/share/pkgconfig"
$PkgConfigBin = "$VcpkgRoot/installed/$Triplet/tools/pkgconf"
$RuntimeBin = "$VcpkgRoot/installed/$Triplet/bin"
$DebugRuntimeBin = "$VcpkgRoot/installed/$Triplet/debug/bin"

"VCPKG_ROOT=$VcpkgRoot" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"VCPKG_INSTALLATION_ROOT=$VcpkgRoot" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"DSVIEW_VCPKG_ROOT=$VcpkgRoot" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"DSVIEW_VCPKG_TRIPLET=$Triplet" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"CMAKE_TOOLCHAIN_FILE=$VcpkgRoot/scripts/buildsystems/vcpkg.cmake" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"PKG_CONFIG=$PkgConfigExe" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"PKG_CONFIG_PATH=$PkgConfigPath" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"PKG_CONFIG_LIBDIR=$PkgConfigPath" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"PATH=$RuntimeBin;$DebugRuntimeBin;$PkgConfigBin;$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
99 changes: 9 additions & 90 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,76 +29,26 @@ jobs:
- target: aarch64-apple-darwin
runner: macos-15
package_bundle: true
- target: x86_64-pc-windows-msvc
runner: windows-2022
msvc_arch: x64
package_bundle: true
- target: aarch64-pc-windows-msvc
runner: windows-11-arm
msvc_arch: arm64
package_bundle: true

steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: recursive

- name: Apply DSView local patches (Unix)
if: ${{ !contains(matrix.target, 'windows') }}
- name: Apply DSView local patches
shell: bash
run: ./scripts/apply-dsview-patches.sh

- name: Apply DSView local patches (Windows)
if: ${{ contains(matrix.target, 'windows') }}
shell: pwsh
run: ./scripts/apply-dsview-patches.ps1

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Set up Python (Unix)
if: ${{ !contains(matrix.target, 'windows') }}
uses: actions/setup-python@v6
with:
python-version: '3.13'

- name: Set up Python (Windows)
if: contains(matrix.target, 'windows')
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
architecture: ${{ matrix.msvc_arch }}

- name: Initialize MSVC developer command prompt
if: contains(matrix.target, 'windows')
uses: ./.github/actions/setup-msvc-dev-cmd
with:
arch: ${{ matrix.msvc_arch }}

- name: Prepare Windows vcpkg cache directories
if: contains(matrix.target, 'windows')
shell: pwsh
run: |
$BinaryCache = Join-Path $env:GITHUB_WORKSPACE ".cache\vcpkg\binary"
$DownloadsCache = Join-Path $env:GITHUB_WORKSPACE ".cache\vcpkg\downloads"
New-Item -ItemType Directory -Force -Path $BinaryCache | Out-Null
New-Item -ItemType Directory -Force -Path $DownloadsCache | Out-Null
"VCPKG_DEFAULT_BINARY_CACHE=$BinaryCache" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"VCPKG_DOWNLOADS=$DownloadsCache" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

- name: Restore Windows vcpkg cache
if: contains(matrix.target, 'windows')
uses: actions/cache@v5
with:
path: |
.cache/vcpkg/binary
.cache/vcpkg/downloads
key: windows-vcpkg-${{ matrix.target }}-${{ hashFiles('.github/actions/setup-native-prereqs/action.yml', 'crates/dsview-sys/native/CMakeLists.txt') }}
restore-keys: |
windows-vcpkg-${{ matrix.target }}-

- name: Setup native prerequisites
uses: ./.github/actions/setup-native-prereqs
Expand Down Expand Up @@ -137,34 +87,8 @@ jobs:
--test boundary \
-- --nocapture --test-threads=1

- name: Find runtime library (Windows)
if: matrix.package_bundle && contains(matrix.target, 'windows')
id: find-runtime-windows
shell: pwsh
run: |
$runtime = Get-ChildItem "target/${{ matrix.target }}/release/build" -Recurse -Filter "dsview_runtime.dll" -ErrorAction Stop |
Sort-Object FullName |
Select-Object -First 1 -ExpandProperty FullName
if (-not $runtime) {
throw "Windows runtime library was not found under target/${{ matrix.target }}/release/build"
}
"runtime-lib=$runtime" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8

- name: Find decode runtime library (Windows)
if: matrix.package_bundle && contains(matrix.target, 'windows')
id: find-decode-runtime-windows
shell: pwsh
run: |
$runtime = Get-ChildItem "target/${{ matrix.target }}/release/build" -Recurse -Filter "dsview_decode_runtime.dll" -ErrorAction Stop |
Sort-Object FullName |
Select-Object -First 1 -ExpandProperty FullName
if (-not $runtime) {
throw "Windows decode runtime library was not found under target/${{ matrix.target }}/release/build"
}
"runtime-lib=$runtime" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8

- name: Find runtime library (Unix)
if: matrix.package_bundle && !contains(matrix.target, 'windows')
- name: Find runtime library
if: matrix.package_bundle
id: find-runtime-unix
shell: bash
run: |
Expand All @@ -179,8 +103,8 @@ jobs:
fi
echo "runtime-lib=$RUNTIME_LIB" >> "$GITHUB_OUTPUT"

- name: Find decode runtime library (Unix)
if: matrix.package_bundle && !contains(matrix.target, 'windows')
- name: Find decode runtime library
if: matrix.package_bundle
id: find-decode-runtime-unix
shell: bash
run: |
Expand All @@ -199,12 +123,7 @@ jobs:
if: matrix.package_bundle
id: exe-path
shell: bash
run: |
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
echo "exe=target/${{ matrix.target }}/release/dsview-cli.exe" >> $GITHUB_OUTPUT
else
echo "exe=target/${{ matrix.target }}/release/dsview-cli" >> $GITHUB_OUTPUT
fi
run: echo "exe=target/${{ matrix.target }}/release/dsview-cli" >> "$GITHUB_OUTPUT"

- name: Package and validate bundle
if: matrix.package_bundle
Expand All @@ -213,6 +132,6 @@ jobs:
target: ${{ matrix.target }}
version: ${{ steps.version.outputs.version }}
exe-path: ${{ steps.exe-path.outputs.exe }}
runtime-path: ${{ contains(matrix.target, 'windows') && steps.find-runtime-windows.outputs.runtime-lib || steps.find-runtime-unix.outputs.runtime-lib }}
decode-runtime-path: ${{ contains(matrix.target, 'windows') && steps.find-decode-runtime-windows.outputs.runtime-lib || steps.find-decode-runtime-unix.outputs.runtime-lib }}
runtime-path: ${{ steps.find-runtime-unix.outputs.runtime-lib }}
decode-runtime-path: ${{ steps.find-decode-runtime-unix.outputs.runtime-lib }}
decoder-dir: DSView/libsigrokdecode4DSL/decoders
Loading