Build 7.0.5 Web apps #36
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 GitHub action is only configured to run on demand by editing "on" | |
# condition as needed, set branch to "none" to never trigger it. | |
# This workflow: | |
# - Installs dart and flutter | |
# - Uses flutter stable channel. | |
# Consider setting up a matrix later with beta and dev included too. | |
# - Enables flutter web | |
# - Gets package dependencies | |
# - Runs dart analyze. | |
# - Show outdated packages, just added for info. | |
# - Verify that dart format is used by all committed code, fails if not. | |
# Controversial but pub.dev penalizes you if dart format is not used. | |
# - Run all tests with coverage. | |
# - Upload code coverage output to Codecov for analysis. | |
# - Install linux rpl tool, used to automate change of a line in index.html. | |
# - Build 5 different WEB example apps using FlexColorScheme. | |
# All examples use these steps: | |
# - Flutter clean. | |
# - Flutter build web app, in release mode and with html renderer. | |
# - Use rpl to fix/modify the index.html file to give it the correct | |
# href deployment sub-folder. | |
# - This CI/CD stops here, it does not deploy, that is done by the "deploy" | |
# workflow, that is otherwise identical, that runs published. | |
name: Build Web | |
on: | |
push: | |
branches: [master] | |
paths-ignore: | |
- "**.md" | |
jobs: | |
flutter_tests: | |
name: "Analyze and test package, then build 5 web example apps" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Install Flutter and Dart SDK" | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
- name: "Show Dart SDK version" | |
run: dart --version | |
- name: "Show Flutter SDK version" | |
run: flutter --version | |
- name: "Flutter Enable Web" | |
run: flutter config --enable-web | |
- name: "Install Flutter package dependencies" | |
run: flutter pub get | |
- name: "Analyze Dart source" | |
run: dart analyze | |
- name: "Show outdated packages" | |
run: flutter pub outdated | |
- name: "Verify that Dart formatting is used, fail if not" | |
run: dart format --output=none --set-exit-if-changed . | |
- name: "Test package FlexColorScheme using test coverage" | |
run: flutter test --coverage | |
- name: "Upload test coverage to Codecov" | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage/lcov.info | |
- name: "Install rpl" | |
run: sudo apt-get install rpl | |
# Example 1 Build | |
- name: "EXAMPLE-1 START BUILD - Flutter clean before build" | |
run: flutter clean && cd example && flutter clean | |
- name: "EXAMPLE-1 WEB release build using CanvasKit" | |
run: cd example && flutter build web --web-renderer html --release -t lib/example1/main.dart | |
- name: "EXAMPLE-1 FIX href URL reference before publish" | |
run: rpl '<base href="/">' '<base href="/flexcolorscheme1/">' example/build/web/index.html | |
# Example 2 Build | |
- name: "EXAMPLE-2 START BUILD - Flutter clean before build" | |
run: flutter clean && cd example && flutter clean | |
- name: "EXAMPLE-2 WEB release build using CanvasKit" | |
run: cd example && flutter build web --web-renderer html --release -t lib/example2/main.dart | |
- name: "EXAMPLE-2 FIX href URL reference before publish" | |
run: rpl '<base href="/">' '<base href="/flexcolorscheme2/">' example/build/web/index.html | |
# Example 3 Build | |
- name: "EXAMPLE-3 START BUILD - Flutter clean before build" | |
run: flutter clean && cd example && flutter clean | |
- name: "EXAMPLE-3 WEB release build using CanvasKit" | |
run: cd example && flutter build web --web-renderer html --release -t lib/example3/main.dart | |
- name: "EXAMPLE-3 FIX href URL reference before publish" | |
run: rpl '<base href="/">' '<base href="/flexcolorscheme3/">' example/build/web/index.html | |
# Example 4 Build | |
- name: "EXAMPLE-4 START BUILD - Flutter clean before build" | |
run: flutter clean && cd example && flutter clean | |
- name: "EXAMPLE-4 WEB release build using CanvasKit" | |
run: cd example && flutter build web --web-renderer html --release -t lib/example4/main.dart | |
- name: "EXAMPLE-4 FIX href URL reference before publish" | |
run: rpl '<base href="/">' '<base href="/flexcolorscheme4/">' example/build/web/index.html | |
# Example 5 Build | |
- name: "EXAMPLE-5 START BUILD - Flutter clean before build" | |
run: flutter clean && cd example && flutter clean | |
- name: "EXAMPLE-5 WEB release build using CanvasKit" | |
run: cd example && flutter build web --web-renderer html --release -t lib/example5/main.dart | |
- name: "EXAMPLE-5 FIX href URL reference before publish" | |
run: rpl '<base href="/">' '<base href="/flexcolorscheme5/">' example/build/web/index.html |