Skip to content

Commit

Permalink
ci: flutter CI now compares produced images against references
Browse files Browse the repository at this point in the history
Automatically creates PR to store them
  • Loading branch information
iamsergio committed Dec 8, 2024
1 parent 9886877 commit 8c4be30
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- src/flutter/**
- tests/flutter/**
- examples/flutter/**
- tests/reference-images/**

branches:
- main
Expand Down
37 changes: 32 additions & 5 deletions .github/workflows/flutter-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only

# Builds the flutter frontend
# Doesn't run tests yet though
# Builds the flutter frontend and runs tests

name: Flutter-dev

Expand Down Expand Up @@ -40,6 +39,7 @@ jobs:
uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.PAT_KDDW_REFERENCE_SCREENSHOTS }}

- name: Install dependencies on Ubuntu
run: |
Expand All @@ -66,9 +66,36 @@ jobs:
run: |
cd ${{ github.workspace }}/src/flutter/dart
flutter pub get
cd ${{ github.workspace }}/tests/flutter/
flutter test
env:
KDDW_BINDINGS_LIB: ${{ github.workspace }}/build-dev-flutter/lib/libkddockwidgets.so

- name: Setup git author name
run: |
git config --global user.email "kddw@actions"
git config --global user.name "KDDW Actions"
# the reference is always latest main, as submodule sha1 might be lagging
# as it's updated nightly
- name: checkout latest main of ref images
run: |
cd tests/reference-images
git checkout main
- name: Run integration tests
run: |
cd tests/flutter/
flutter pub get
cd ${{ github.workspace }}/build-dev-flutter/
ctest --output-on-failure
xvfb-run flutter test -d linux integration_test/ui_test.dart
env:
KDDW_BINDINGS_LIB: ${{ github.workspace }}/build-dev-flutter/lib/libkddockwidgets.so

- name: Compare against reference images
shell: bash
if: github.event_name == 'pull_request'
run: |
./tests/reference-images/compare_images.sh
env:
PAT: ${{ secrets.PAT_KDDW_REFERENCE_SCREENSHOTS }}
GITHUB_EVENT_PATH: ${{ github.event_path }}
GH_TOKEN: ${{ github.token }}
34 changes: 34 additions & 0 deletions .github/workflows/flutter-ref-images-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
#
#
#
name: Nighly bump tests/reference-images submodule

on:
schedule:
- cron: "0 3 * * *"
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true

- name: bump submodule
run: |
cd tests/reference-images/
git checkout main
cd ../..
git add tests/reference-images/
if [ -n "$(git status --porcelain)" ]; then
git commit -m "Bump tests/reference-images/"
gh pr create --base main --title "Bump tests/reference-images/" --body "Automatically created via GH actions."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 6 additions & 2 deletions .github/workflows/valgrind-leakcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ name: Valgrind qtwidgets_leak_test

on:
push:
paths-ignore:
# These are built by another workflow
- src/flutter/**
- tests/flutter/**
- examples/flutter/**
- tests/reference-images/**
branches:
- 2.1
- main
pull_request:
branches:
- 2.1
- main

jobs:
Expand Down
2 changes: 1 addition & 1 deletion tests/reference-images

0 comments on commit 8c4be30

Please sign in to comment.