Skip to content

Commit

Permalink
github actions: verify schema against generated file
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristramg committed Feb 21, 2024
1 parent 2080352 commit e69243a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,18 @@ jobs:

- name: Run cargo clippy
run: cargo clippy -- -D warnings

flatbuffers:
name: Check FlatBuffers generated file
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install unzip
run: sudo apt update && sudo apt install unzip
- name: Get flatc
run: wget https://github.com/google/flatbuffers/releases/download/v23.5.26/Linux.flatc.binary.g++-10.zip && unzip Linux.flatc.binary.g++-10.zip
- name: Generate rust code from schema
run: ./flatc --rust schema/lrs.fbs
- name: Ensure same output as commited
run: diff src/lrs_generated.rs lrs_generated.rs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ The data that defines an LRS is serialized using the [FlatBuffers format](https:

The schema is described in [schema/lrs.fbs](schema/lrs.fbs). The library is written in rust and the [generated file](src/lrs_generated.rs) is commited. This means there is no need to have the `flatc` executable to build and run this project.

If your contribution changes the schema, you will need to generate the file with
If your contribution changes the schema, you will need to generate the file with flatc. The version must be the release 23.5.26. Do not use a version built from master.

`flatc -o src --rust schema/lrs.fbs`

0 comments on commit e69243a

Please sign in to comment.