Skip to content

feat: improve codegen crate calculation, separate bindings into crates #184

feat: improve codegen crate calculation, separate bindings into crates

feat: improve codegen crate calculation, separate bindings into crates #184

on:
pull_request:
types: [opened, reopened, edited, synchronize]
name: Synchronize Bindings
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
generate_bindings:
name: Generate Diff
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rust Cache
uses: Swatinem/[email protected]
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
cache-all-crates: true
- name: Setup
run: |
cargo xtask init
- name: Generate Bindings
run: |
cargo xtask codegen
- name: Check for changes and create diff
id: check_changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "changes=true" >> "$GITHUB_OUTPUT"
git diff > bindings.diff
echo "Diff created:"
cat bindings.diff
else
echo "changes=false" >> "$GITHUB_OUTPUT"
fi
- name: Upload Diff Artifact
if: steps.check_changes.outputs.changes == 'true'
uses: actions/upload-artifact@v4
with:
name: bindings.diff
path: bindings.diff
retention-days: 1
- name: Upload GitHub Pull Request Event
uses: actions/upload-artifact@v4
with:
name: event-bindings.json
path: ${{ github.event_path }}