|
| 1 | +name: Interface ON Push & PR DO Code check |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + code-check: |
| 6 | + runs-on: ubuntu-latest |
| 7 | + |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@v1 |
| 10 | + |
| 11 | + - name: Setup flutter |
| 12 | + uses: subosito/flutter-action@v2 |
| 13 | + with: |
| 14 | + channel: 'stable' |
| 15 | + |
| 16 | + - name: Check flutter sdk version |
| 17 | + working-directory: ./flutter_vlc_player_platform_interface |
| 18 | + run: flutter --version |
| 19 | + |
| 20 | + - name: Get dependencies |
| 21 | + working-directory: ./flutter_vlc_player_platform_interface |
| 22 | + run: flutter pub get |
| 23 | + |
| 24 | + - name: Setup Dart Code Metrics |
| 25 | + working-directory: ./flutter_vlc_player_platform_interface |
| 26 | + run: dart pub get dart_code_metrics |
| 27 | + |
| 28 | + - name: Dart Code Metrics |
| 29 | + working-directory: ./flutter_vlc_player_platform_interface |
| 30 | + run: | |
| 31 | + dirs_to_analyze="" |
| 32 | + if [ -d lib ]; then dirs_to_analyze+=" lib"; fi |
| 33 | + if [ -d test ]; then dirs_to_analyze+=" test"; fi |
| 34 | + if [ -d example ]; then dirs_to_analyze+=" example"; fi |
| 35 | + if [ dirs_to_analyze != "" ] |
| 36 | + then |
| 37 | + dart run dart_code_metrics:metrics \ |
| 38 | + analyze \ |
| 39 | + $dirs_to_analyze \ |
| 40 | + --fatal-warnings \ |
| 41 | + --fatal-performance \ |
| 42 | + --fatal-style |
| 43 | + dart run dart_code_metrics:metrics \ |
| 44 | + check-unused-files \ |
| 45 | + $dirs_to_analyze \ |
| 46 | + --fatal-unused |
| 47 | + fi |
| 48 | + - name: Check formatting |
| 49 | + working-directory: ./flutter_vlc_player_platform_interface |
| 50 | + run: dart format . --set-exit-if-changed |
| 51 | + |
| 52 | + - name: Run tests |
| 53 | + working-directory: ./flutter_vlc_player_platform_interface |
| 54 | + run: | |
| 55 | + # run tests if `test` folder exists |
| 56 | + if [ -d test ] |
| 57 | + then |
| 58 | + flutter test -r expanded |
| 59 | + else |
| 60 | + echo "Tests not found." |
| 61 | + fi |
0 commit comments