Skip to content

Commit

Permalink
ci: e2e tests workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pr-Mais committed Jan 11, 2023
1 parent f6e3499 commit 381d01b
Show file tree
Hide file tree
Showing 8 changed files with 3,954 additions and 8 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/scripts/e2e_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: e2e

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
paths:
- "firestore-counter/clients/dart"
push:
branches:
- next
paths:
- "firestore-counter/clients/dart"
jobs:
ios:
runs-on: macos-12
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
name: Install Node.js 14
with:
node-version: "14"
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "11"
- uses: hendrikmuhs/ccache-action@v1
name: Xcode Compile Cache
with:
key: ${{ runner.os }}-ios-v3
max-size: 700M
- uses: actions/cache@v2
name: Pods Cache
id: pods-cache
with:
path: tests/ios/Pods
key:
${{ runner.os }}-pods-v3-${{ hashFiles('tests/ios/Podfile.lock') }}
restore-keys: ${{ runner.os }}-ios-pods-v2
- name: Firebase Emulator
run: |
cd ./_emulator
firebase emulators:start
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: "Install Tools"
run: |
sudo npm i -g firebase-tools
- name: "E2E Tests"
working-directory: tests
run: |
# Boot simulator and wait for System app to be ready.
SIMULATOR="iPhone 11"
xcrun simctl bootstatus "$SIMULATOR" -b
xcrun simctl logverbose "$SIMULATOR" enable
# Sleep to allow simulator to settle.
sleep 15
# Uncomment following line to have simulator logs printed out for debugging purposes.
# xcrun simctl spawn booted log stream --predicate 'eventMessage contains "flutter"' &
firebase emulators:exec 'cd ../firestore-counter/clients/dart && flutter test integration_test' -d "$SIMULATOR"
FLUTTER_DRIVE_EXIT_CODE=$?
xcrun simctl shutdown "$SIMULATOR"
exit $FLUTTER_DRIVE_EXIT_CODE
3 changes: 1 addition & 2 deletions _emulator/firebase.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extensions": {
"firestore-send-email": "../firestore-send-email",
"delete-user-data": "../delete-user-data"
"firestore-counter": "../firestore-counter"
},
"storage": {
"rules": "storage.rules"
Expand Down
3 changes: 2 additions & 1 deletion _emulator/firestore.rules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
Expand All @@ -10,7 +11,7 @@ service cloud.firestore {
// Make sure to write security rules for your app before that time, or
// else all client requests to your database will be denied until you
// update your rules.
allow read, write: if request.time < timestamp.date(2022, 7, 2);
allow read, write;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firestore_counter/distributed_counter.dart';
import 'package:firestore_counter/firebase_options.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

Expand All @@ -12,9 +11,7 @@ void main() {
late final DocumentReference document;

setUpAll(() async {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
await Firebase.initializeApp();
firestore = FirebaseFirestore.instance;
firestore.useFirestoreEmulator('localhost', 8080);

Expand Down
36 changes: 36 additions & 0 deletions firestore-counter/clients/dart/ios/Runner/GoogleService-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>794622217280-2lhu4p5nfg179sm11g2vu94hvcj98q6d.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.794622217280-2lhu4p5nfg179sm11g2vu94hvcj98q6d</string>
<key>API_KEY</key>
<string>AIzaSyCC3PxKasFq-2grS3i_uGdsPNf9HE6yvvA</string>
<key>GCM_SENDER_ID</key>
<string>794622217280</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.example.dart</string>
<key>PROJECT_ID</key>
<string>dev-extensions-testing</string>
<key>STORAGE_BUCKET</key>
<string>dev-extensions-testing.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:794622217280:ios:80f7c846781fa3e99aa3a5</string>
<key>DATABASE_URL</key>
<string>https://dev-extensions-testing-default-rtdb.firebaseio.com</string>
</dict>
</plist>
7 changes: 7 additions & 0 deletions firestore-counter/clients/dart/ios/firebase_app_id_file.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"file_generated_by": "FlutterFire CLI",
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
"GOOGLE_APP_ID": "1:219368645393:ios:aca2da97d04ac2d16862b0",
"FIREBASE_PROJECT_ID": "extensions-testing",
"GCM_SENDER_ID": "219368645393"
}
66 changes: 66 additions & 0 deletions firestore-counter/clients/dart/lib/firebase_options.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;

/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for android - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}

static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyCSj2ehVlNDgZPteB17un6ykv4D_FVOeH8',
appId: '1:219368645393:ios:aca2da97d04ac2d16862b0',
messagingSenderId: '219368645393',
projectId: 'extensions-testing',
databaseURL: 'https://extensions-testing.firebaseio.com',
storageBucket: 'extensions-testing.appspot.com',
androidClientId: '219368645393-ph61d2t6kdv6pr0ubr0bppaeh5ngrf9o.apps.googleusercontent.com',
iosClientId: '219368645393-fro323kq92448464rafhesehv2l6n8d0.apps.googleusercontent.com',
iosBundleId: 'com.example.dart',
);
}
Loading

0 comments on commit 381d01b

Please sign in to comment.