Skip to content

Add test for octopus observer #33

Add test for octopus observer

Add test for octopus observer #33

name: Example - deploy web on preview channel
on:
pull_request:
branches:
- "master"
- "develop"
- "release/**"
paths:
- "lib/**.dart"
- "test/**.dart"
- "example/**.dart"
- .github/workflows/*.yml
- "pubspec.yaml"
- "example/pubspec.yaml"
workflow_dispatch:
jobs:
build:
#if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
name: "Build"
runs-on: ubuntu-latest
container:
image: plugfox/flutter:stable-web
options: --user root
timeout-minutes: 30
env:
pub-cache-name: pub
working-directory: ./example
steps:
- name: 🚂 Get latest code
id: checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
pubspec.yaml
lib
test
analysis_options.yaml
CHANGELOG.md
example
- name: 📤 Restore Pub modules
id: cache-pub-restore
uses: actions/cache/restore@v4
with:
path: |
$HOME/.pub-cache
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
- name: 🗄️ Export Pub cache directory
id: export-pub-cache
timeout-minutes: 1
run: |
export PUB_CACHE=$PWD/.pub_cache/
export PATH="$PATH":"$HOME/.pub-cache/bin"
echo "${HOME}/.pub-cache/bin" >> $GITHUB_PATH
- name: 👷 Install Dependencies
id: install-dependencies
timeout-minutes: 1
run: |
apt-get update && apt-get install -y lcov
flutter pub get
dart pub global activate intl_utils
dart pub global run intl_utils:generate
- name: 📥 Save Pub modules
id: cache-pub-save
uses: actions/cache/save@v4
with:
path: |
$HOME/.pub-cache
key: ${{ runner.os }}-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
- name: 🖼️ Move images from assets to web
working-directory: ${{ env.working-directory }}
run: |
dart run bin/web_move_images.dart
timeout-minutes: 5
- name: 🏗️ Codegen
working-directory: ${{ env.working-directory }}
run: |
flutter gen-l10n --arb-dir lib/src/common/localization --output-dir lib/src/common/localization/generated --template-arb-file intl_en.arb
dart run build_runner build --delete-conflicting-outputs --release
timeout-minutes: 5
- name: 🌐 Build flutter web
working-directory: ${{ env.working-directory }}
run: |
flutter build web --release --no-source-maps \
--no-tree-shake-icons --pwa-strategy offline-first \
--base-href / \
--dart-define-from-file=config/staging.json
- name: 📁 Upload web build result
uses: actions/upload-artifact@v3
with:
name: web-preview
retention-days: 1
if-no-files-found: error
path: |
example/build/web/
example/.firebaserc
example/firebase.json
firebase.json
# Deploy web on preview / staging channel
web-deploy:
name: "Deploy web on preview channel"
timeout-minutes: 5
runs-on: ubuntu-latest
#defaults:
# run:
# working-directory: ./example
needs: build
steps:
- name: 📦 Download result for web build job
uses: actions/download-artifact@v3
with:
name: web-preview
- name: 📥 List web artifact
run: |
tree
- name: 🔥 Deploy to Firebase preview channel
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_FLUTTER_OCTOPUS_EXAMPLE }}"
expires: 7d
entryPoint: example/
channelId: stage
projectId: flutter-octopus-example
#target: flutter-octopus-example