-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/rydmike/flex_color_scheme
- Loading branch information
Showing
6 changed files
with
368 additions
and
42 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,42 @@ | ||
# This GitHub action runs on pull request to master, it: | ||
# | ||
# - Installs dart and flutter | ||
# - Uses flutter dev channel for now, will change to stable when web supported on stable. | ||
# - Enables flutter web | ||
# - Gets package dependencies | ||
# - Runs dart analyze, allows deprecation warnings, we on purpose allow use of deprecated features on dev channel, | ||
# as they might not yet be deprecated on stable and we will keep using some of the features that are deprecated | ||
# as long as they are not also deprecated on stable. | ||
# - 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. | ||
# - Install linux rpl tool. It is used to automate the needed 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 CanvasKit 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, | ||
# but runs on release, when it is published, created or edited. | ||
# | ||
# TODO Maybe set this workflow up to also run on a weekly schedule to check that nothing is broken? | ||
# Also planning to setup another matrix test run, but this one is also a nice test | ||
# since it does not just runs tests, but also builds actual Web apps using the package. | ||
# | ||
name: Build Web | ||
on: | ||
pull_request: | ||
branches: [ master ] | ||
jobs: | ||
flutter_tests: | ||
name: Run Flutter analyze and tests | ||
name: Analyze, test and build 5 web apps | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Flutter and Dart SDK | ||
uses: subosito/[email protected] | ||
with: | ||
channel: dev | ||
channel: "dev" | ||
- name: Show Dart SDK version | ||
run: dart --version | ||
|
||
|
@@ -27,49 +52,77 @@ jobs: | |
- name: Analyze Dart source | ||
run: dart analyze | ||
|
||
- name: Test package FlexColorScheme with test coverage | ||
run: flutter test | ||
- name: Show outdated packges | ||
run: flutter pub outdated | ||
|
||
build_web: | ||
name: Build Flutter Web examples | ||
needs: [flutter_tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Flutter and Dart SDK | ||
uses: subosito/flutter-action@v1.4.0 | ||
- 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@v1 | ||
with: | ||
channel: "dev" | ||
- name: Show Dart SDK version | ||
run: dart --version | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: coverage/lcov.info | ||
|
||
- name: Show Flutter SDK version | ||
run: flutter --version | ||
- name: Install rpl | ||
run: sudo apt-get install rpl | ||
|
||
- name: Flutter Enable Web | ||
run: flutter config --enable-web | ||
# Example 1 Build | ||
|
||
- name: Install Flutter package dependencies | ||
run: flutter pub get | ||
- name: EXAMPLE-1 START BUILD - Flutter clean before build | ||
run: flutter clean && cd example && flutter clean | ||
|
||
- name: Install repl | ||
run: apt-get install rpl | ||
- name: EXAMPLE-1 WEB release build using CanvasKit | ||
run: cd example && flutter build web --web-renderer canvaskit --release -t lib/example1/main.dart | ||
|
||
- name: Build Web Example 2 with CanvasKit | ||
run: cd examples && flutter build web --web-renderer canvaskit --release "lib/example2/main.dart" | ||
- name: EXAMPLE-1 FIX href URL reference before publish | ||
run: rpl '<base href="/">' '<base href="/flexcolorscheme1/">' example/build/web/index.html | ||
|
||
- name: Fix URL reference before publish | ||
run: rpl “<base href="/">” “<base href="/flexcolorscheme2/">” build/web/index.html | ||
# Example 2 Build | ||
|
||
- name: Pushes build files | ||
uses: dmnemec/[email protected] | ||
env: | ||
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | ||
with: | ||
source_file: 'build/web/.' | ||
destination_repo: 'rydmike/rydmike.github.io/flexcolorscheme2' | ||
user_email: '[email protected]' | ||
user_name: 'releasebot' | ||
- 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 canvaskit --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 canvaskit --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 canvaskit --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 canvaskit --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 | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: Build Web | ||
on: | ||
pull_request: | ||
branches: [ master ] | ||
jobs: | ||
flutter_tests: | ||
name: Run Flutter analyze and tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Flutter and Dart SDK | ||
uses: subosito/[email protected] | ||
with: | ||
channel: dev | ||
- 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 with fatal-infos, fail if fatal-infos | ||
run: dart analyze --fatal-infos | ||
|
||
- name: Verify that Dart formatting is used, fail if not | ||
run: dart format --output=none --set-exit-if-changed . | ||
|
||
- name: Test package FlexColorScheme with test coverage | ||
run: flutter test | ||
|
||
build_web: | ||
name: Build Flutter Web Example 2 | ||
needs: [flutter_tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Flutter and Dart SDK | ||
uses: subosito/[email protected] | ||
with: | ||
channel: "dev" | ||
- 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: Install repl | ||
run: sudo apt-get install rpl | ||
|
||
- name: Build Web Example 2 with CanvasKit | ||
run: cd example && flutter build web --web-renderer canvaskit --release lib/example2/main.dart | ||
|
||
- name: List files (dir) | ||
run: ls example | ||
|
||
- name: Show content of index.html BEFORE rpl fix href URL | ||
run: cat example/build/web/index.html | ||
|
||
- name: Fix href URL reference before publish | ||
run: rpl '<base href="/">' '<base href="/flexcolorscheme2/">' example/build/web/index.html | ||
|
||
- name: Show content of index.html AFTER rpl fix href URL | ||
run: cat example/build/web/index.html | ||
|
||
- name: Push built Web Example-2 to GitHub Pages repository, site is published on commit. | ||
uses: dmnemec/[email protected] | ||
env: | ||
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | ||
with: | ||
source_file: 'example/build/web/.' | ||
destination_folder: 'flexcolorscheme2' | ||
destination_repo: 'rydmike/rydmike.github.io' | ||
user_email: '[email protected]' | ||
user_name: 'rydmike' | ||
# The commit message is not supported on version 1.0.4, need new release for that. | ||
# commit_message: 'Update FlexColorScheme live Web example2' | ||
|
||
|
||
|
Oops, something went wrong.