-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change to pre-generated bindings, add feature for generating at compi…
…le-time (#21) * Change to pre-generated bindings, use feature for compile-time generated * Fix clippy lints * Ignore bindgen feature on docs.rs * Update generate-bindings.yml * Update build.yml * Fix clippy and missing-libs * Update docs * Add rust-toolchain.toml with nightly as the default * Update CHANGELOG.md * Add rustfmt component to update-bindings * Fix workflow file reference * Run bindgen from crate root on update-bindings CI * Add CI job to check bindings * On the CI to update bindings, get the submodule hash after updating * Bind is_build_rs to a variable to make function argument clearer * Rename sort keys to precedence and ident * When formatting fails, warn if running from build.rs, panic otherwise * Use CargoCallbacks instead of our own ParseCallbacks implementation * Gate env_logger under "log-build" feature To reduce dependencies for vitasdk-sys package * Use "build-util" profile for vitasdk-build-util "build-util" is identical to profile used by build.rs * `cargo update` * Watch DOCS_RS environment variable change * Add all-stubs feature Removes need for bindgen during docs.rs build * rename all_stubs field for serde * Revert adding redundant --missing-features check * Group foreign items by feature and refactor * Use doc_auto_cfg instead of doc_cfg * Link on same foreign mods as external definitions and sort by feature * Sort `impl` blocks by rendering the type using quote * Add note to README.md and comments to workflows about LLVM version used --------- Co-authored-by: Daria Sukhonina <[email protected]>
- Loading branch information
1 parent
4c737c0
commit e357f6e
Showing
20 changed files
with
21,172 additions
and
564 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ on: | |
workflow_dispatch: | ||
|
||
env: | ||
# If you update LLVM_VERSION, remember to also update `update-bindings.yml` | ||
# and `README.md` | ||
LLVM_VERSION: "16" | ||
|
||
jobs: | ||
|
@@ -31,8 +33,6 @@ jobs: | |
sha: ${{ github.sha }} | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Restore vitasdk cache | ||
uses: actions/cache/restore@v3 | ||
|
@@ -41,21 +41,6 @@ jobs: | |
key: ${{ runner.os }}-vitasdk | ||
fail-on-cache-miss: true | ||
|
||
- name: Cache LLVM and Clang | ||
id: cache-llvm | ||
uses: actions/cache@v3 | ||
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 dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
|
@@ -134,8 +119,6 @@ jobs: | |
sha: ${{ github.sha }} | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Restore vitasdk cache | ||
uses: actions/cache/restore@v3 | ||
|
@@ -144,21 +127,6 @@ jobs: | |
key: ${{ runner.os }}-vitasdk | ||
fail-on-cache-miss: true | ||
|
||
- name: Cache LLVM and Clang | ||
id: cache-llvm | ||
uses: actions/cache@v3 | ||
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 }} | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
@@ -234,7 +202,6 @@ jobs: | |
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Restore vitasdk cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
|
@@ -278,26 +245,24 @@ jobs: | |
context: Check missing libs | ||
sha: ${{ github.sha }} | ||
|
||
doc: | ||
name: Doc | ||
# Checks if there's no diff when regenerating bindings | ||
check-bindings: | ||
name: Check bindings | ||
runs-on: ubuntu-latest | ||
needs: install-vitasdk | ||
timeout-minutes: 30 | ||
env: | ||
RUSTDOCFLAGS: -D warnings | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Set commit status as pending | ||
uses: myrotvorets/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
status: pending | ||
context: Doc | ||
context: Check bindings | ||
sha: ${{ github.sha }} | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Restore vitasdk cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
|
@@ -320,6 +285,51 @@ jobs: | |
directory: ${{ runner.temp }}/llvm | ||
cached: ${{ steps.cache-llvm.outputs.cache-hit }} | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
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: Check diff | ||
run: | | ||
git add . && git diff --quiet && git diff --cached --quiet | ||
- name: Set final commit status | ||
uses: myrotvorets/[email protected] | ||
if: always() | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
status: ${{ job.status }} | ||
context: Check bindings | ||
sha: ${{ github.sha }} | ||
|
||
doc: | ||
name: Doc | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
env: | ||
RUSTDOCFLAGS: -D warnings | ||
steps: | ||
- name: Set commit status as pending | ||
uses: myrotvorets/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
status: pending | ||
context: Doc | ||
sha: ${{ github.sha }} | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
|
@@ -330,13 +340,6 @@ jobs: | |
- name: Run cargo doc | ||
run: DOCS_RS=1 RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --target armv7-sony-vita-newlibeabihf -Z build-std | ||
|
||
- name: Upload docs | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: docs | ||
path: target/armv7-sony-vita-newlibeabihf/doc | ||
if-no-files-found: error | ||
|
||
- name: Set final commit status | ||
uses: myrotvorets/[email protected] | ||
if: always() | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,18 @@ on: | |
|
||
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: | ||
name: Update | ||
update-and-regenrate: | ||
name: Update and regenerate | ||
runs-on: ubuntu-latest | ||
needs: install-vitasdk | ||
steps: | ||
|
@@ -30,21 +33,63 @@ jobs: | |
key: ${{ runner.os }}-vitasdk | ||
fail-on-cache-miss: true | ||
|
||
- name: Cache LLVM and Clang | ||
id: cache-llvm | ||
uses: actions/cache@v3 | ||
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@v3 | ||
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: | | ||
echo "VITA_HEADERS_HASH=$(git submodule status | grep vita-headers | cut -d ' ' -f 2)" >> $GITHUB_ENV | ||
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: Commit and create pull request | ||
id: create-pull-request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
title: Update vita-headers | ||
body: Created by the action at [/.workflows/update-bindings.yml](../tree/main/.workflows/update-bindings.yml) | ||
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 | ||
assignees: pheki,ZetaNumbers | ||
committer: Aphek <[email protected]> | ||
author: Aphek <[email protected]> | ||
|
||
|
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
Oops, something went wrong.