Prevent data loss if shared_preferences.json is corrupted #172
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Elastic | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
workflow_dispatch: | |
env: | |
FLUTTER_VERSION: 3.13.1 | |
jobs: | |
formatting-analysis: | |
name: "Check Formatting & Analyze" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Flutter | |
uses: subosito/[email protected] | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
cache-path: ${{ runner.tool_cache }}/flutter/linux | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Generate mocks | |
run: dart run build_runner build | |
- name: Verify formatting | |
run: dart format --output=none --set-exit-if-changed lib/* test/* | |
- name: Analyze project source | |
run: flutter analyze --no-fatal-infos --no-fatal-warnings | |
test: | |
name: "Run Tests" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Flutter | |
uses: subosito/[email protected] | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
cache-path: ${{ runner.tool_cache }}/flutter/linux | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Generate mocks | |
run: dart run build_runner build | |
- name: Run tests | |
run: flutter test --coverage | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
build-option: "windows" | |
artifact-path: "build/windows/runner/Release" | |
artifact-name: Elastic-Windows | |
- os: macos-latest | |
build-option: "macos" | |
artifact-path: "build/macos/Build/Products/Release/Elastic-macOS.zip" | |
artifact-name: Elastic-macOS | |
- os: ubuntu-latest | |
build-option: "linux" | |
artifact-path: "build/linux/x64/release/bundle" | |
artifact-name: Elastic-Linux | |
name: "Build - ${{ matrix.artifact-name }}" | |
needs: [formatting-analysis, test] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Install flutter dependencies | |
if: ${{ matrix.build-option == 'linux' }} | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y ninja-build libgtk-3-dev | |
- name: Setup flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
cache-path: ${{ runner.tool_cache }}/flutter/${{ matrix.build-option }} | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Build app | |
run: flutter build ${{ matrix.build-option }} | |
- name: Zip release | |
if: ${{ matrix.build-option == 'macos' }} | |
run: | | |
cd build/macos/Build/Products/Release | |
zip -r Elastic-macOS.zip elastic_dashboard.app --symlinks | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.artifact-name }} | |
path: ${{ matrix.artifact-path }} |