aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/push-test.yml
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-02-05 15:53:34 +0100
committerGitHub <noreply@github.com>2023-02-05 15:53:34 +0100
commit802d7dfee77a3f58ee14a7ef6e2454e5aae62cbb (patch)
tree1c63107fafa7b535acd1a31a2e317e7535f85b62 /.github/workflows/push-test.yml
parent24cabc6019e702ac888a33311532a9832863b572 (diff)
downloadFlightCore-802d7dfee77a3f58ee14a7ef6e2454e5aae62cbb.tar.gz
FlightCore-802d7dfee77a3f58ee14a7ef6e2454e5aae62cbb.zip
feat: Auto-generate TS bindings (#140)
* feat: Initial trial to auto-generate TS bindings That way instead of manually duplicating code, we can just run `cargo test` to generate them. * fix: Update forgotten imports * refactor: Move FlightCoreVersion to autogen bind TypeScript binding autogenerated from Rust code * refactor: Move ReleaseInfo to autogen binding TypeScript binding autogenerated from Rust code * docs: Explain how to generate TS binds from Rust * feat: Check for binding changes in CI Checks for uncommitted binding changes in CI and fails if they differ * style: Formatting fixes
Diffstat (limited to '.github/workflows/push-test.yml')
-rw-r--r--.github/workflows/push-test.yml34
1 files changed, 34 insertions, 0 deletions
diff --git a/.github/workflows/push-test.yml b/.github/workflows/push-test.yml
index 5e4597d8..aaad5a6d 100644
--- a/.github/workflows/push-test.yml
+++ b/.github/workflows/push-test.yml
@@ -31,6 +31,40 @@ jobs:
command: fmt
args: --manifest-path src-tauri/Cargo.toml --all -- --check
+ # Ensure committed bindings correct
+ autogen-ts-bindings-check:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ override: true
+ - name: install dependencies (ubuntu only)
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
+
+ - name: Move original TypeScript bindings
+ run: |
+ cp -r src-tauri/bindings original-bindings
+ rm -r src-tauri/bindings
+
+ - name: Create empty dist folder # Otherwise tests fail
+ run: mkdir src-vue/dist
+
+ - name: Run Tests
+ run: cargo test --manifest-path src-tauri/Cargo.toml
+
+ - name: Compare TypeScript Bindings
+ run: |
+ diff -r src-tauri/bindings original-bindings
+ if [[ $? -ne 0 ]]; then
+ echo "Generated bindings are different from committed bindings"
+ exit 1
+ fi
+
test-tauri:
needs: ensure-same-version
strategy: