Skip to content

Commit

Permalink
ci: configures main workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Ascenio authored Jul 8, 2024
1 parent 124c4a7 commit 59bb388
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 7 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Main

on: push

jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.19.4
- name: Run analysis
run: flutter analyze

formatting:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.19.4
- name: Check formatting
run: dart format --set-exit-if-changed .

testing:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.19.4
- name: Run tests
run: flutter test

integration-testing:
runs-on: macos-latest
environment: Main
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.19.4
- name: Create env file
env:
ENV_FILE: ${{ secrets.ENV_FILE }}
run: printenv ENV_FILE > env.json
- name: Set up simulator
uses: futureware-tech/simulator-action@v3
with:
model: "iPhone 15"
os: iOS
- name: Run tests
run: flutter test integration_test --dart-define-from-file=env.json

building-android:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.19.4
- name: Generates appbundle
run: flutter build appbundle
- name: Uploads appbundle
uses: actions/upload-artifact@v4
with:
name: appbundle
path: build/app/outputs/bundle/release/app-release.aab

building-ios:
runs-on: macos-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.19.4
- name: Generates ipa
run: flutter build ipa --no-codesign
- name: Uploads ipa
uses: actions/upload-artifact@v4
with:
name: ipa
path: build/ios/archive/Runner.xcarchive/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Contains some goodies such as:
- Offline-first
- Caching
- API keys via environment variables
- CI with [GitHub Actions](https://docs.github.com/en/actions)

https://github.com/Ascenio/nasa_potday/assets/7662016/079d3cba-9222-4d96-b690-bb01a0bb32a9

Expand Down
4 changes: 2 additions & 2 deletions integration_test/picture_of_the_day_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void main() {
testWidgets('should display 7 pictures per page', (tester) async {
await tester.pumpWidget(const MainApp());
await tester.pumpAndSettle();
expectListViewHasNItems(tester: tester, itemCount: 7);
expectListViewSeparatedHasNItems(tester: tester, itemCount: 7);
});

testWidgets('should search by date', (tester) async {
Expand All @@ -50,7 +50,7 @@ void main() {
expect(find.byType(PictureWidget), findsOne);
await tester.tap(find.byIcon(Icons.chevron_left));
await tester.pumpAndSettle();
expectListViewHasNItems(tester: tester, itemCount: 7);
expectListViewSeparatedHasNItems(tester: tester, itemCount: 7);
});

testWidgets(
Expand Down
2 changes: 1 addition & 1 deletion integration_test/scroll_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int listViewChildCount({
return listView.childrenDelegate.estimatedChildCount!;
}

void expectListViewHasNItems({
void expectListViewSeparatedHasNItems({
required WidgetTester tester,
required int itemCount,
}) {
Expand Down
2 changes: 1 addition & 1 deletion integration_test/scroll_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ void main() {
scrollable: find.byType(Scrollable),
);
await tester.pumpAndSettle();
expectListViewHasNItems(tester: tester, itemCount: 14);
expectListViewSeparatedHasNItems(tester: tester, itemCount: 14);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ class ImageOrVideoWidget extends StatelessWidget {
fit: BoxFit.cover,
errorWidget: (context, url, error) => ColoredBox(
color: surfaceColor,
child: const Column(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.error_outline,
size: 64,
color: isVideo ? Colors.transparent : null,
),
SizedBox(height: 16),
Text(
const SizedBox(height: 16),
const Text(
'Could not show the image',
)
],
Expand Down

0 comments on commit 59bb388

Please sign in to comment.