Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: configures main workflow #1

Merged
merged 26 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ddd86f5
ci: start using workflows
Ascenio Jul 7, 2024
07efe7d
ci: run action on PRs
Ascenio Jul 7, 2024
c1fb1ba
ci: move workflow file to its proper location
Ascenio Jul 7, 2024
5a04421
ci: set machine type
Ascenio Jul 7, 2024
8fc8855
ci: remove PR trigger
Ascenio Jul 7, 2024
53128b5
ci: validate code formatting
Ascenio Jul 7, 2024
ea1594b
ci: run unit tests
Ascenio Jul 7, 2024
5b343e4
ci: validate build on Android and iOS
Ascenio Jul 7, 2024
0838b5b
ci: try using secrets
Ascenio Jul 7, 2024
4446642
ci: write env file using printenv
Ascenio Jul 7, 2024
c26f616
ci: testing env with hardcoded value
Ascenio Jul 7, 2024
ab36974
ci: try printing the env file content
Ascenio Jul 7, 2024
cd7f94b
ci: try printing hardcoded env variable
Ascenio Jul 7, 2024
0dc2738
ci: try using from env instead of secrets
Ascenio Jul 7, 2024
af9ea91
ci: print env file
Ascenio Jul 7, 2024
5b7f02f
ci: set env variable from context
Ascenio Jul 7, 2024
4e2b3cc
ci: set environment to Main
Ascenio Jul 7, 2024
68e25f7
ci: run integration tests
Ascenio Jul 7, 2024
dade72c
ci: adds name to simulator step
Ascenio Jul 7, 2024
86fc079
ci: define env variables from file on integration tests
Ascenio Jul 7, 2024
0b60f0a
ci: upload build artifacts
Ascenio Jul 7, 2024
a22b09a
ci: configure artifact names
Ascenio Jul 7, 2024
8e6d18d
docs: mention CI
Ascenio Jul 7, 2024
4def1ec
ci: set iOS as target operating system for simulator
Ascenio Jul 8, 2024
f6ba54b
fix: don't show error icon on videos
Ascenio Jul 8, 2024
5eb8148
test: rename ListView expect to be more explicit about underlying wid…
Ascenio Jul 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading