Skip to content

A GitHub Actions wrapper around running `cbindgen` to generate C/C++ bindings from Rust code.

License

Notifications You must be signed in to change notification settings

Reloaded-Project/devops-rust-cbindgen

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reloaded Logo

Generate bindings with cbindgen

License

This GitHub Action generates C bindings with cbindgen for a Rust project.

Inputs

Input Required Default Description
rust-project-path No . Path to the Rust project
config-file Yes cbindgen.toml Configuration file for cbindgen
output-header-file Yes bindings_c.h Path to the output header file generated by cbindgen
upload-artifact No true Whether to upload the generated header file as an artifact
github-token No A GitHub token for pushing to the repo. Example: ${{ secrets.GITHUB_TOKEN }}
commit-updated-bindings No false Whether to commit the updated bindings

Example Usage

steps:
  - uses: actions/checkout@v4
  - uses: Reloaded-Project/cbindgen-action@v1
    with:
      rust-project-path: '.'
      config-file: 'cbindgen.toml'
      output-header-file: 'bindings_c.h'
      upload-artifact: 'true'
      github-token: ${{ secrets.GITHUB_TOKEN }}
      commit-updated-bindings: 'true'

Getting Artifacts

If the upload-artifact input is set to true, the generated header file will be uploaded as an artifact with the following name format:

C-Bindings-<output-header-file>

For example, if the output-header-file input is set to bindings_c.h, the artifact name will be C-Bindings-bindings_c.h.

If you are not uploading an artifact, the generated header can be found at ${{ inputs.rust-project-path }}/${{ inputs.output-header-file }}.

Purpose

This is part of the release pipeline for Reloaded3 libraries and components.

To make things more maintainable, and better for everyone, the code has been wrapped into an efficient GitHub Action.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A GitHub Actions wrapper around running `cbindgen` to generate C/C++ bindings from Rust code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published