Skip to content

Commit

Permalink
ci: channel compatibility workflow (#123)
Browse files Browse the repository at this point in the history
* ci: add compat job

* add install step

* add comma

* tweak triggers

* separate failures into channel specific uploads

* check all stable versions

* disable fail fast

* check all 3.22.x versions

* use channels

* use channel in flutter step

* add padding

* chore: Updating Goldens

* add flags to flutter --version

* disable analytics on CI

* disable CLI animations

* remove some padding to see if that helps

* add back childKey

* chore: Updating Goldens

* add padding to network image smoke

* Re-run CI after updating goldens

* use TextButton

* chore: Updating Goldens

* Re-run CI after updating goldens

* cleanup

* rm ref to current branch
  • Loading branch information
btrautmann authored Sep 18, 2024
1 parent 5d609ae commit 5139917
Show file tree
Hide file tree
Showing 19 changed files with 94 additions and 33 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/check_compat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Compatibility Check

on:
schedule:
# Run daily at 00:00 UTC
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
channel: ['stable', 'beta']

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
with:
channel: ${{ matrix.channel }}
cache: true

- name: Install Dependencies
run: flutter packages get

- name: Disable animations
run: flutter config --no-cli-animations

- name: Run tests
run: |
flutter test --no-pub --coverage --test-randomize-ordering-seed=random
- name: Upload failures
if: failure()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: "golden_failures_${{ matrix.channel }}"
path: |
**/failures/**/*.png
- name: Notify failure
if: failure()
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 #v1.27.0
with:
payload: |
{
"message": "Heads up! Alchemist smoke tests failed on the ${{ matrix.channel }} channel. Check them out and determine root cause.",
"job_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.MOBILE_OSS_SLACK_WEBHOOK }}
6 changes: 5 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ jobs:
- name: Install Dependencies
run: flutter packages get

- name: Disable animations
run: flutter config --no-cli-animations

- name: Run tests
run: flutter test --no-pub --coverage --test-randomize-ordering-seed=random
run: |
flutter test --no-pub --coverage --test-randomize-ordering-seed=random
- name: Upload failures
if: failure()
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/post_merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ jobs:
- name: Install Dependencies
run: flutter packages get

- name: Disable animations
run: flutter config --no-cli-animations

- name: Run tests
run: flutter test --no-pub --coverage --test-randomize-ordering-seed=random
run: |
flutter test --no-pub --coverage --test-randomize-ordering-seed=random
- uses: codecov/codecov-action@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update_goldens.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ jobs:
channel: 'stable'
cache: true

- name: Disable animations
run: flutter config --no-cli-animations

- name: Update Goldens
run: |
flutter test --update-goldens
Expand Down
7 changes: 2 additions & 5 deletions lib/src/golden_test_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,8 @@ class FlutterGoldenTestAdapter extends GoldenTestAdapter {
maxWidth: constraints.maxWidth,
maxHeight: constraints.maxHeight,
child: Center(
child: Padding(
key: childKey,
padding: const EdgeInsets.all(8),
child: widget,
),
key: childKey,
child: widget,
),
),
);
Expand Down
41 changes: 19 additions & 22 deletions lib/src/golden_test_scenario.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,30 +70,27 @@ class GoldenTestScenario extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
name,
style: const TextStyle(fontSize: 18),
textHeightBehavior: const TextHeightBehavior(
applyHeightToFirstAscent: false,
),
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
name,
style: const TextStyle(fontSize: 18),
textHeightBehavior: const TextHeightBehavior(
applyHeightToFirstAscent: false,
),
const SizedBox(height: 8),
ConstrainedBox(
constraints: constraints ??
GoldenTestScenarioConstraints.maybeOf(context) ??
const BoxConstraints(),
child: Builder(
builder: builder,
),
),
const SizedBox(height: 8),
ConstrainedBox(
constraints: constraints ??
GoldenTestScenarioConstraints.maybeOf(context) ??
const BoxConstraints(),
child: Builder(
builder: builder,
),
],
),
),
],
);
}
}
Expand Down
Binary file modified test/smoke_tests/goldens/3.16.0/ci/asset_image_smoke_test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/smoke_tests/goldens/3.16.0/ci/back_button_smoke_test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/smoke_tests/goldens/3.16.0/ci/constrained_big_smoke_test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/smoke_tests/goldens/3.16.0/ci/error_message_smoke_test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/smoke_tests/goldens/3.16.0/ci/timer_button_smoke_test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/smoke_tests/goldens/3.16.0/ci/unconstrained_smoke_test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions test/smoke_tests/interactions_smoke_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void main() {
),
GoldenTestScenario(
name: 'scenario_button',
child: ElevatedButton(
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
const Color(0xFF2196F3),
Expand Down Expand Up @@ -49,14 +49,14 @@ void main() {
goldenTest(
'succeeds while pressed',
fileName: 'interactions_smoke_test_pressed',
whilePerforming: press(find.byType(ElevatedButton)),
whilePerforming: press(find.byType(TextButton)),
builder: buildSmokeTestGroup,
);

goldenTest(
'succeeds while long pressed',
fileName: 'interactions_smoke_test_long_pressed',
whilePerforming: longPress(find.byType(ElevatedButton)),
whilePerforming: longPress(find.byType(TextButton)),
builder: buildSmokeTestGroup,
);
});
Expand Down
5 changes: 4 additions & 1 deletion test/smoke_tests/network_image_smoke_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ void main() {
pumpWidget: (tester, widget) async {
await mockNetworkImages(() => tester.pumpWidget(widget));
},
builder: () => Image.network('https://fakeurl.com/image.png'),
builder: () => Padding(
padding: const EdgeInsets.all(8),
child: Image.network('https://fakeurl.com/image.png'),
),
);
});
}

0 comments on commit 5139917

Please sign in to comment.