vitasdk-sys 0.3.3

Raw bindings to vitasdk
Documentation
name: Create PR to update bindings

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 2 5 *'

env:
  PR_BRANCH: update-bindings
  # If you update LLVM_VERSION, remember to also update `build.yml` and
  # `README.md`
  LLVM_VERSION: "16"

jobs:
  install-vitasdk:
    uses: ./.github/workflows/setup-vitasdk.yml
    with:
      path: /opt/vitasdk

  update-and-regenrate:
    name: Update and regenerate
    runs-on: ubuntu-latest
    needs: install-vitasdk
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: true

      - name: Restore vitasdk cache
        uses: actions/cache/restore@v4
        with:
          path: /opt/vitasdk
          key: ${{ runner.os }}-vitasdk
          fail-on-cache-miss: true

      - name: Cache LLVM and Clang
        id: cache-llvm
        uses: actions/cache@v4
        with:
          path: |
            ${{ runner.temp }}/llvm
          key: llvm

      - name: Install LLVM and Clang
        uses: KyleMayes/install-llvm-action@v1
        with:
          version: ${{ env.LLVM_VERSION }}
          directory: ${{ runner.temp }}/llvm
          cached: ${{ steps.cache-llvm.outputs.cache-hit }}

      - name: Cache build-util dependencies
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo-build-util-${{ hashFiles('Cargo.lock') }}

      - name: Update vita-headers
        run: |
          git submodule update --recursive --remote vita-headers
          echo "VITA_HEADERS_HASH=$(git submodule status | grep vita-headers | cut -d ' ' -f 2)" >> $GITHUB_ENV

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          components: rustfmt
          profile: minimal
          override: true

      - name: Regenerate bindings
        env:
          VITASDK: /opt/vitasdk
          # From clang-sys
          LIBCLANG_PATH: ${{ runner.temp }}/llvm/lib
          LLVM_CONFIG_PATH: ${{ runner.temp }}/llvm/bin/llvm-config
        run: |
          cargo run --profile build-util -p vitasdk-sys-build-util -- bindgen

      - name: Generate GitHub token
        uses: actions/create-github-app-token@v1
        id: generate-token
        with:
          app-id: ${{ secrets.APP_ID }}
          private-key: ${{ secrets.APP_PRIVATE_KEY }}

      - name: Commit and create pull request
        id: create-pull-request
        uses: peter-evans/create-pull-request@v6
        with:
          token: ${{ steps.generate-token.outputs.token }}
          title: Update vita-headers bindings
          body: Created by the action at [.github/workflows/update-bindings.yml](../tree/main/.github/workflows/update-bindings.yml)
          branch: ${{ env.PR_BRANCH }}
          delete-branch: true
          commit-message: Update vita-headers to ${{ env.VITA_HEADERS_HASH }}
          assignees: pheki,ZetaNumbers
          committer: Aphek <bilkow@tutanota.com>
          author: Aphek <bilkow@tutanota.com>