Skip to content

Commit

Permalink
ci: Add flutter-gen-bindings.yml workflow
Browse files Browse the repository at this point in the history
Seems only workflows in default branch can be triggered on demand.
  • Loading branch information
iamsergio committed Apr 12, 2024
1 parent d365d66 commit e2dd2c0
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/flutter-gen-bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only

# On demand flutter action to trigger binding regeneration

name: Generate Flutter Bindings

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Remove clang 13
run: sudo apt remove clang-13 clang-14 libclang-common-13-dev libclang-common-14-dev -y

- name: Install dependencies on Ubuntu
run: |
sudo apt update -qq
sudo apt install libgtk-3-dev libglib2.0-dev ninja-build libspdlog-dev lld \
python3 python3-dev clang-15 llvm-15 libclang-15-dev libxslt-dev mesa-common-dev libglu1-mesa-dev libglib2.0-dev libfontconfig \
libxkbcommon-dev mesa-utils libgl1-mesa-dev libglu1-mesa-dev nlohmann-json3-dev clang-format-15 qt6-base-dev wget curl \
file unzip zip xz-utils -y
- name: Install Dart SDK
uses: dart-lang/setup-dart@v1

- name: Clone Dartagnan
uses: actions/checkout@v4
with:
repository: "KDABLabs/dartagnan.git"
submodules: true
ref: "main"
path: "${{ github.workspace }}/dartagnan"

- name: Build Dartagnan
run: |
cd dartagnan
cmake --preset=release -DCMAKE_INSTALL_PREFIX=installed
cd build-release
ninja && ninja install
- name: Add Dartagnan to PATH
run: |
echo ${{ github.workspace }}/dartagnan/installed/bin/ >> $GITHUB_PATH
- name: Refresh bindings
run: |
cd src/flutter
dart pub get
dart refresh_bindings.dart
git status
git checkout generated/KDDockWidgetsBindings/dart/lib/LibraryLoader.dart
env:
DARTAGNAN_CLANG_FORMAT: /usr/bin/clang-format

- name: Create PR
run: |
git add .
git commit -m "flutter: regenerate bindings"
git checkout -B flutter/bindings-`git log -1 --pretty=format:"%H"`
git push --set-upstream origin `git branch --show-current`
gh pr create --base main --title "flutter: Regenerate bindings" --body "Automatically created via GH action."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit e2dd2c0

Please sign in to comment.