skip arm for now #702
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: "cargo" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| bindgen: | |
| defaults: | |
| run: | |
| shell: powershell | |
| strategy: | |
| matrix: | |
| os: [windows-2025] | |
| target: [aarch64-pc-windows-msvc, x86_64-pc-windows-msvc, i686-pc-windows-msvc] | |
| exclude: | |
| - os: windows-11-arm | |
| target: x86_64-pc-windows-msvc | |
| - os: windows-11-arm | |
| target: i686-pc-windows-msvc | |
| - os: windows-2025 | |
| target: aarch64-pc-windows-msvc | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| targets: ${{ matrix.target }} | |
| components: rustfmt | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Run tests and generate bindings | |
| env: | |
| PHNT_VERSION: PHNT_WIN11_24H2 | |
| PHNT_MODE: PHNT_MODE_USER | |
| run: | | |
| cargo test --release -vv -F regenerate --target ${{ matrix.target }} | |
| - name: Extract architecture from target triple and move bindings | |
| run: | | |
| $arch = '${{ matrix.target }}' -split '-' | Select-Object -First 1 | |
| $arch = if ($arch -eq 'i686') { 'x86' } else { $arch } | |
| Add-Content -Path $env:GITHUB_ENV -Value "ARCH=$arch" | |
| $output = Get-ChildItem -Path "target/${{ matrix.target }}/release/build/**/$($arch)_bindgen.rs" -Recurse | Select-Object -First 1 | |
| Copy-Item -Path $output.FullName -Destination "src/ffi/$($arch)_bindgen.rs" | |
| Write-Host "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') [INFO] - Moved $output to src/ffi/$($arch)_bindgen.rs" | |
| - name: Upload generated file as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.ARCH }}_bindgen.rs | |
| path: src/ffi/${{ env.ARCH }}_bindgen.rs | |
| commit-and-push: | |
| runs-on: ubuntu-latest | |
| needs: bindgen | |
| if: success() # Run only if the generate-bindgen job succeeds | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download generated files | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "*bindgen.rs" | |
| path: src/ffi | |
| merge-multiple: true | |
| - name: Commit and push changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add src/ffi | |
| # Check if there are any changes to commit | |
| if git diff --quiet --exit-code --cached; then | |
| echo "No changes to commit." | |
| else | |
| git commit -m "chore: update vendored bindings" | |
| git push --force | |
| fi |