|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: geolocator_android |
| 4 | + |
| 5 | +# Controls when the action will run. Triggers the workflow on push or pull request |
| 6 | +# events but only for the develop branch |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: [ master, next ] |
| 10 | + paths: |
| 11 | + - 'geolocator_android/**' |
| 12 | + pull_request: |
| 13 | + branches: [ master, next ] |
| 14 | + paths: |
| 15 | + - 'geolocator_android/**' |
| 16 | + |
| 17 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 18 | +jobs: |
| 19 | + format: |
| 20 | + name: Format |
| 21 | + |
| 22 | + # The type of runner that the job will run on |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + env: |
| 26 | + source-directory: ./geolocator_android |
| 27 | + |
| 28 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 29 | + steps: |
| 30 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + |
| 33 | + # Make sure the stable version of Flutter is available |
| 34 | + - uses: subosito/flutter-action@v1 |
| 35 | + with: |
| 36 | + channel: 'stable' |
| 37 | + |
| 38 | + # Download all Flutter packages |
| 39 | + - name: Download dependencies |
| 40 | + run: flutter pub get |
| 41 | + working-directory: ${{env.source-directory}} |
| 42 | + |
| 43 | + # Run Flutter Format to ensure formatting is valid |
| 44 | + - name: Run Flutter Format |
| 45 | + run: flutter format --set-exit-if-changed . |
| 46 | + working-directory: ${{env.source-directory}} |
| 47 | + |
| 48 | + analyze: |
| 49 | + name: Analyze |
| 50 | + |
| 51 | + # The type of runner that the job will run on |
| 52 | + runs-on: ubuntu-latest |
| 53 | + |
| 54 | + env: |
| 55 | + source-directory: ./geolocator_android |
| 56 | + |
| 57 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 58 | + steps: |
| 59 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 60 | + - uses: actions/checkout@v2 |
| 61 | + |
| 62 | + # Make sure the stable version of Flutter is available |
| 63 | + - uses: subosito/flutter-action@v1 |
| 64 | + with: |
| 65 | + channel: 'stable' |
| 66 | + |
| 67 | + # Download all Flutter packages |
| 68 | + - name: Download dependencies |
| 69 | + run: flutter pub get |
| 70 | + working-directory: ${{env.source-directory}} |
| 71 | + |
| 72 | + # Run Flutter Analyzer |
| 73 | + - name: Run Flutter Analyzer |
| 74 | + run: flutter analyze |
| 75 | + working-directory: ${{env.source-directory}} |
| 76 | + |
| 77 | + build_android: |
| 78 | + name: Build Android App |
| 79 | + |
| 80 | + # The type of runner that the job will run on |
| 81 | + runs-on: ubuntu-latest |
| 82 | + |
| 83 | + env: |
| 84 | + source-directory: ./geolocator_android |
| 85 | + example-directory: ./geolocator_android/example |
| 86 | + |
| 87 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 88 | + steps: |
| 89 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 90 | + - uses: actions/checkout@v2 |
| 91 | + |
| 92 | + # Ensure correct JAVA version is installed. |
| 93 | + - uses: actions/setup-java@v1 |
| 94 | + with: |
| 95 | + java-version: '12.x' |
| 96 | + |
| 97 | + # Make sure the stable version of Flutter is available |
| 98 | + - uses: subosito/flutter-action@v1 |
| 99 | + with: |
| 100 | + channel: 'stable' |
| 101 | + |
| 102 | + # Download all Flutter packages |
| 103 | + - name: Download dependencies |
| 104 | + run: flutter pub get |
| 105 | + working-directory: ${{env.source-directory}} |
| 106 | + |
| 107 | + # Build Android version of the example App |
| 108 | + - name: Run Android build |
| 109 | + run: flutter build apk --release |
| 110 | + working-directory: ${{env.example-directory}} |
| 111 | + |
| 112 | + tests: |
| 113 | + name: Unit-tests |
| 114 | + # The type of runner that the job will run on |
| 115 | + runs-on: ubuntu-latest |
| 116 | + |
| 117 | + env: |
| 118 | + source-directory: ./geolocator_android |
| 119 | + |
| 120 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 121 | + steps: |
| 122 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 123 | + - uses: actions/checkout@v2 |
| 124 | + |
| 125 | + # Make sure the stable version of Flutter is available |
| 126 | + - uses: subosito/flutter-action@v1 |
| 127 | + with: |
| 128 | + channel: 'stable' |
| 129 | + |
| 130 | + # Download all Flutter packages |
| 131 | + - name: Download dependencies |
| 132 | + run: flutter pub get |
| 133 | + working-directory: ${{env.source-directory}} |
| 134 | + |
| 135 | + # Run all unit-tests with code coverage |
| 136 | + - name: Run unit tests |
| 137 | + run: flutter test --coverage |
| 138 | + working-directory: ${{env.source-directory}} |
| 139 | + |
| 140 | + # Upload code coverage information |
| 141 | + - uses: codecov/codecov-action@v1 |
| 142 | + with: |
| 143 | + file: ${{env.source-directory}}/coverage/lcov.info # optional |
| 144 | + name: Geolocator (App Facing Package) # optional |
| 145 | + fail_ci_if_error: true |
0 commit comments