Skip to content

Commit

Permalink
Add automatic example app deployment to web (fleaflet#1516)
Browse files Browse the repository at this point in the history
Uses Firebase Hosting & https://github.com/FirebaseExtended/action-hosting-deploy to build and deploy the example app on web.
Creates preview sites for PRs, and deploys to the live site on pushes to the master branch.

We're looking for FirebaseExtended/action-hosting-deploy#279 to be merged by 2023/05/31.
We're looking for axel-op/dart-package-analyzer#22 to be resolved by 2023/05/31.
Otherwise, this action will fail (note that the existing action will fail by this date currently anyway).
  • Loading branch information
JaffaKetchup authored May 12, 2023
1 parent 0d522d2 commit 1bbea9d
Show file tree
Hide file tree
Showing 35 changed files with 239 additions and 145 deletions.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "fleaflet-firebase"
}
}
61 changes: 61 additions & 0 deletions .github/workflows/build_io.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build IO Example Apps
on:
workflow_call:

jobs:
build-android:
name: "Android"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./example
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Java 17 Environment
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: Setup Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Build Android Application
run: flutter build apk
- name: Archive Artifact
uses: actions/[email protected]
with:
name: apk-build
path: example/build/app/outputs/apk/release
if-no-files-found: error

build-windows:
name: "Windows"
runs-on: windows-latest
defaults:
run:
working-directory: ./example
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Java 17 Environment
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: Setup Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Build Windows Application
run: flutter build windows
- name: Create Windows Application Installer
run: iscc "windowsApplicationInstallerSetup.iss"
working-directory: .
- name: Archive Artifact
uses: actions/[email protected]
with:
name: exe-build
path: windowsTemp/WindowsApplication.exe
if-no-files-found: error
143 changes: 0 additions & 143 deletions .github/workflows/main.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build (PR)
on:
pull_request:
workflow_dispatch:

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

jobs:
test:
name: "Score, Analyse & Test"
uses: ./.github/workflows/test.yml

build-io:
name: "Build IO Example Apps"
needs: test
uses: ./.github/workflows/build_io.yml

build-web:
name: "Build & Deploy Web Example App"
runs-on: ubuntu-latest
needs: test
defaults:
run:
working-directory: ./example
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Build Web Application
run: flutter build web --web-renderer canvaskit
- name: Archive Artifact
uses: actions/[email protected]
with:
name: web-build
path: example/build/web
if-no-files-found: error
- name: Publish Preview Web App
uses: FirebaseExtended/action-hosting-deploy@main
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_FLEAFLET }}"
expires: 30d
projectId: fleaflet-firebase
50 changes: 50 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build (Push)
on:
push:
branches:
- master
workflow_dispatch:

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

jobs:
test:
name: "Score, Analyse & Test"
uses: ./.github/workflows/test.yml

build-io:
name: "Build IO Example Apps"
needs: test
uses: ./.github/workflows/build_io.yml

build-web:
name: "Build & Deploy Web Example App"
runs-on: ubuntu-latest
needs: test
defaults:
run:
working-directory: ./example
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Build Web Application
run: flutter build web --web-renderer canvaskit
- name: Archive Artifact
uses: actions/[email protected]
with:
name: web-build
path: example/build/web
if-no-files-found: error
- name: Publish Live Web App
uses: FirebaseExtended/action-hosting-deploy@main
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_FLEAFLET }}"
channelId: live
projectId: fleaflet-firebase
57 changes: 57 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Score, Analyse & Test
on:
workflow_call:

jobs:
score-package:
name: "Score Package"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Run Dart Package Analyser
uses: axel-op/dart-package-analyzer@master
id: analysis
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check Package Scores
env:
TOTAL: ${{ steps.analysis.outputs.total }}
TOTAL_MAX: ${{ steps.analysis.outputs.total_max }}
run: |
if (( $TOTAL < $TOTAL_MAX ))
then
echo Package score less than available score. Improve the score!
exit 1
fi
analyse-code:
name: "Analyse Code"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Get All Dependencies
run: flutter pub get
- name: Check Formatting
run: dart format --output=none --set-exit-if-changed .
- name: Check Lints
run: dart analyze --fatal-infos --fatal-warnings

run-tests:
name: "Run Tests"
runs-on: ubuntu-latest
needs: analyse-code
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Run Tests
run: flutter test -r expanded
2 changes: 1 addition & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</intent>
</queries>
<application
android:label="flutter_map_example"
android:label="flutter_map Demo"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down
Binary file modified example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>flutter_map_example</string>
<string>flutter_map Demo</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
Loading

0 comments on commit 1bbea9d

Please sign in to comment.