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

Create GitHub Action to validate PR #15

Merged
merged 27 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7a88181
Create GitHub Action to validate PR
suesitran Sep 29, 2024
55bc2aa
Merge branch 'main' into suesi/add-github-action
suesitran Sep 29, 2024
5e18817
Change flow name
suesitran Sep 29, 2024
8683fb1
Merge branch 'suesi/add-github-action' of https://github.com/suesitra…
suesitran Sep 29, 2024
22f096f
Update job name
suesitran Sep 29, 2024
8d1d02f
Remove intl_utils
suesitran Sep 29, 2024
b1b148e
Add firebase_options.dart to validate build
suesitran Sep 29, 2024
3761221
Add codeowner
suesitran Sep 29, 2024
db62327
Fix bash syntax
suesitran Sep 29, 2024
c82f468
Read secret from env
suesitran Sep 29, 2024
e63130e
fix multi line bash syntax
suesitran Sep 29, 2024
0001257
Ignore lib/firebase_options.dart in analyze
suesitran Sep 29, 2024
7d51125
check content of lib folder
suesitran Sep 29, 2024
00f74d2
check content of lib/firebase_options.dart
suesitran Sep 29, 2024
2f8c2d8
update env param name
suesitran Sep 29, 2024
9dd8ec4
remove checking firebase option content
suesitran Sep 29, 2024
99fdb57
exclude firebase_options.dart from dart format
suesitran Sep 29, 2024
0e963f8
ignore unused_local_variable for web google sign in button
suesitran Sep 29, 2024
5124793
ignore invalid_use_of_protected_member
suesitran Sep 29, 2024
8c5aead
change to import flutter_bloc
suesitran Sep 29, 2024
a480da6
use const for UserDetailState
suesitran Sep 29, 2024
88c603b
update bash command to exclude only lib/firebase_options.dart from da…
suesitran Sep 29, 2024
004a595
add google-services.json for android
suesitran Sep 29, 2024
33305ad
add ios GoogleService-Info.plist
suesitran Sep 29, 2024
02eaf83
update dart format command
suesitran Sep 29, 2024
92df231
update flutter version for ios build
suesitran Sep 29, 2024
98c6031
Add firebase option and google service for iOS build
suesitran Sep 29, 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
109 changes: 109 additions & 0 deletions .github/workflows/pr_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# This is a basic workflow to help you get started with Actions

name: Auto Translated Chat - PR Check

# Controls when the workflow will run
on:
pull_request:
branches:
- main
types:
- opened
- edited
- reopened
- synchronize

pull_request_target:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
validation:
name: 'Run test and build android and web code'
runs-on: ubuntu-latest
concurrency:
cancel-in-progress: true
group: ${{ github.event.pull_request.number || github.event.pull_request_target.number || github.ref }}
steps:
- name: checkout source code
uses: actions/[email protected]
with:
ref: ${{ github.event.pull_request_target.head.ref || github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request_target.head.repo.full_name || github.event.pull_request.head.repo.full_name}}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
- name: setup secrets
run: |
echo "$FIREBASE_OPTION" > lib/firebase_options.dart
echo "$ANDROID_GOOGLE_SERVICE" > android/app/google-services.json
env:
FIREBASE_OPTION: ${{ secrets.FIREBASE_OPTIONS }}
ANDROID_GOOGLE_SERVICE: ${{ secrets.ANDROID_GOOGLE_SERVICE }}
- name: Flutter action
uses: subosito/[email protected]
with:
flutter-version: '3.22.0'
channel: 'stable'
- name: Flutter doctor
run: flutter doctor
- name: Format code
run: |
dart format lib/*/ --fix --set-exit-if-changed
dart format lib/main.dart --fix --set-exit-if-changed
dart format test --fix --set-exit-if-changed
- name: analyse code
run: |
flutter pub get
dart analyze --fatal-infos --fatal-warnings
- name: Run tests
run: |
flutter test --coverage
- name: build apk and web
run: |
flutter build apk --debug
flutter build web
ios_validation:
name: 'iOS validation'
runs-on: macos-latest
concurrency:
cancel-in-progress: true
group: ${{ github.event.pull_request.number || github.event.pull_request_target.number || github.ref }}
needs: validation
steps:
- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ github.event.sha }}
repository: ${{ github.event.pull_request_target.head.repo.full_name || github.event.pull_request.head.repo.full_name}}
fetch-depth: 0
- name: setup secrets
run: |
echo "$FIREBASE_OPTION" > lib/firebase_options.dart
echo "$IOS_GOOGLE_SERVICE" > ios/Runner/GoogleService-Info.plist
env:
FIREBASE_OPTION: ${{ secrets.FIREBASE_OPTIONS }}
IOS_GOOGLE_SERVICE: ${{ secrets.IOS_GOOGLE_SERVICE }}
- name: Install Flutter
uses: subosito/[email protected]
with:
flutter-version: '3.22.0'
channel: 'stable'
- name: setup XCode
uses: maxim-lobanov/[email protected]
with:
xcode-version: 15.4
- name: setup Cocoapod
uses: maxim-lobanov/[email protected]
with:
version: 1.13.0
- name: build iOS no codesign
run: |
flutter pub get
flutter build ipa --no-codesign
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Suesi Tran is required to review all PRs for this project
* @suesitran
6 changes: 6 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- lib/generated/**.dart
- lib/**.g.dart
- lib/firebase_options.dart
- test/**.mocks.dart
2 changes: 1 addition & 1 deletion lib/_shared/bloc/user_manager/user_manager_cubit.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:bloc/bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:equatable/equatable.dart';
import 'package:public_chat/_shared/data/chat_data.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/_shared/bloc/user_manager/user_manager_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class UserDetailState extends UserManagerState {
final String? photoUrl;
final String? displayName;

UserDetailState(
const UserDetailState(
{required this.uid, required this.photoUrl, required this.displayName});

@override
Expand Down
1 change: 1 addition & 0 deletions lib/features/login/ui/widgets/sign_in_button/web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:google_sign_in_web/web_only.dart' as web;

/// Renders a web-only SIGN IN button.
Widget buildSignInButton({required String label, VoidCallback? onPressed}) {
// ignore: unused_local_variable
final GoogleSignIn googleSignIn = GoogleSignIn();

return web.renderButton();
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/bloc_extensions.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: invalid_use_of_visible_for_testing_member
// ignore_for_file: invalid_use_of_visible_for_testing_member, invalid_use_of_protected_member
import 'package:flutter_bloc/flutter_bloc.dart';

extension BlocSafety<Event, State> on Bloc<Event, State> {
Expand Down