ci: remove diff to fix error code 128 #87
This file contains 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" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: windows-2025 | |
strategy: | |
matrix: | |
target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, aarch64-pc-windows-msvc] | |
steps: | |
- uses: actions/checkout@v4 | |
with: { submodules: recursive } | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
targets: ${{ matrix.target }} | |
components: rustfmt | |
- name: Build | |
run: cargo build -v -F regenerate --target ${{ matrix.target }} | |
- name: Extract architecture from target triple and move bindings | |
shell: bash | |
run: | | |
# Extract architecture (i686, x86_64 or aarch64) from target triple | |
ARCH=$(echo "${{ matrix.target }}" | cut -d'-' -f1) | |
echo "Extracted architecture: $ARCH" | |
# Map i686 to x86 | |
if [ "$ARCH" == "i686" ]; then | |
ARCH="x86" | |
fi | |
# Set the architecture as an environment variable | |
echo "ARCH=$ARCH" >> $GITHUB_ENV | |
# Path to the generated binding | |
GENERATED_BINDING=$(find target/${{ matrix.target }}/debug/build -type f -name "${ARCH}_bindgen.rs") | |
if [ -z "$GENERATED_BINDING" ]; then | |
echo "Error: Generated binding file not found for $ARCH." | |
exit 1 | |
fi | |
# Move the generated file to the repository directory | |
cp "$GENERATED_BINDING" "src/ffi/${ARCH}_bindgen.rs" | |
echo "Moved $GENERATED_BINDING to src/ffi/${ARCH}_bindgen.rs" | |
- name: Run tests | |
run: cargo test --verbose | |
- 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: build | |
if: success() # Run only if the generate-bindgen job succeeds | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Download generated files | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "*bindgen.rs" | |
path: src/ffi | |
merge-multiple: true | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git add src/ffi | |
git commit -m "Update bindgen files" | |
git push |