Skip to content

Commit 3f63796

Browse files
authored
initial action complete (#2)
* Adds Github Action for CI Co-authored-by: Eric Windmill <[email protected]>
1 parent 37bc19d commit 3f63796

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+490
-18
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
_Description of what this PR is changing or adding, and why:_
1+
_Description of what this PR is changing or adding:_
22

33
_Issues fixed by this PR (if any):_
44

5+
## Risk Level
6+
- [ ] No risk
7+
- [ ] Somewhat Risky
8+
- [ ] High risk
9+
510
## Pre-submit checklist
611
- [ ] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style)
712
- [ ] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks)

.github/workflows/ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Run CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: [opened, reopened, synchronize]
7+
paths:
8+
- "packages/**"
9+
- ".github/workflows"
10+
push:
11+
paths-ignore:
12+
- "**.md"
13+
14+
jobs:
15+
android:
16+
runs-on: macos-latest
17+
timeout-minutes: 30
18+
steps:
19+
20+
- name: "Git Checkout"
21+
uses: actions/checkout@v2
22+
23+
- name: "Install Node"
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: '16'
27+
28+
- uses: actions/setup-java@v2
29+
name: "Install Java"
30+
with:
31+
distribution: 'temurin'
32+
java-version: '11'
33+
34+
- name: "Install Flutter"
35+
run: |
36+
sh .github/workflows/scripts/install-flutter.sh stable
37+
38+
- name: "Install Tools"
39+
run: |
40+
sh ./.github/workflows/scripts/install-tools.sh
41+
flutter config --no-enable-web --no-enable-ios --no-enable-macos-desktop
42+
sudo npm i -g firebase-tools
43+
#
44+
- name: "Start Firebase Emulator"
45+
run: |
46+
sh ./.github/workflows/scripts/start-firebase-emulator.sh
47+
48+
- name: "Drive Example"
49+
uses: reactivecircus/android-emulator-runner@v2
50+
with:
51+
api-level: 28
52+
arch: x86_64
53+
# Firebase Firestore works without Google Play Services, so we don't use the `googleapis`
54+
# emulator target as it's considerably slower on CI.
55+
target: default
56+
profile: Nexus 5X
57+
script: sh ./.github/workflows/scripts/drive-app.sh firebase_snippets_app
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
PROJECT_NAME=$1
4+
TARGET_PATH="packages/$PROJECT_NAME/"
5+
6+
# The && are necessary for some reason when using the Android Emulator action
7+
pushd "$TARGET_PATH" || exit &&
8+
flutter clean &&
9+
flutter pub get &&
10+
flutter format . &&
11+
flutter test integration_test
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
BRANCH=$1
4+
git clone https://github.com/flutter/flutter.git --depth 1 -b $BRANCH "$GITHUB_WORKSPACE/_flutter"
5+
echo "$GITHUB_WORKSPACE/_flutter/bin" >> $GITHUB_PATH
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
flutter config --no-analytics
4+
flutter pub global activate melos 1.1.0
5+
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
6+
echo "$GITHUB_WORKSPACE/_flutter/.pub-cache/bin" >> $GITHUB_PATH
7+
echo "$GITHUB_WORKSPACE/_flutter/bin/cache/dart-sdk/bin" >> $GITHUB_PATH
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
if ! [ -x "$(command -v firebase)" ]; then
3+
echo "❌ Firebase tools CLI is missing."
4+
exit 1
5+
fi
6+
7+
if ! [ -x "$(command -v node)" ]; then
8+
echo "❌ Node.js is missing."
9+
exit 1
10+
fi
11+
12+
if ! [ -x "$(command -v npm)" ]; then
13+
echo "❌ NPM is missing."
14+
exit 1
15+
fi
16+
17+
export STORAGE_EMULATOR_DEBUG=true
18+
EMU_START_COMMAND="firebase emulators:start --only firestore --project flutter-fire-snippets"
19+
20+
MAX_RETRIES=3
21+
MAX_CHECKATTEMPTS=60
22+
CHECKATTEMPTS_WAIT=1
23+
24+
RETRIES=1
25+
while [ $RETRIES -le $MAX_RETRIES ]; do
26+
27+
if [[ -z "${CI}" ]]; then
28+
echo "Starting Firebase Emulator Suite in foreground."
29+
$EMU_START_COMMAND
30+
exit 0
31+
else
32+
echo "Starting Firebase Emulator Suite in background."
33+
$EMU_START_COMMAND &
34+
CHECKATTEMPTS=1
35+
while [ $CHECKATTEMPTS -le $MAX_CHECKATTEMPTS ]; do
36+
sleep $CHECKATTEMPTS_WAIT
37+
if curl --output /dev/null --silent --fail http://localhost:8080; then
38+
# Check again since it can exit before the emulator is ready.
39+
sleep 15
40+
if curl --output /dev/null --silent --fail http://localhost:8080; then
41+
echo "Firebase Emulator Suite is online!"
42+
exit 0
43+
else
44+
echo "❌ Firebase Emulator exited after startup."
45+
exit 1
46+
fi
47+
fi
48+
echo "Waiting for Firebase Emulator Suite to come online, check $CHECKATTEMPTS of $MAX_CHECKATTEMPTS..."
49+
((CHECKATTEMPTS = CHECKATTEMPTS + 1))
50+
done
51+
fi
52+
53+
echo "Firebase Emulator Suite did not come online in $MAX_CHECKATTEMPTS checks. Try $RETRIES of $MAX_RETRIES."
54+
((RETRIES = RETRIES + 1))
55+
56+
done
57+
echo "Firebase Emulator Suite did not come online after $MAX_RETRIES attempts."
58+
exit 1

Makefile

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)