|
| 1 | +name: build firebase |
| 2 | + |
| 3 | +# Controls when the action will run. Triggers the workflow on push or pull request |
| 4 | +# events but only for the develop branch |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [develop, main] |
| 8 | + paths: |
| 9 | + - "flutter_cache_manager_firebase/**" |
| 10 | + - ".github/workflows/**" |
| 11 | + pull_request: |
| 12 | + branches: [develop] |
| 13 | + paths: |
| 14 | + - "flutter_cache_manager_firebase/**" |
| 15 | + - ".github/workflows/**" |
| 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: ./flutter_cache_manager_firebase_firebase |
| 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@v4 |
| 32 | + |
| 33 | + # Make sure the stable version of Flutter is available |
| 34 | + - name: Set up Flutter |
| 35 | + uses: subosito/flutter-action@v2 |
| 36 | + with: |
| 37 | + channel: "stable" |
| 38 | + architecture: x64 |
| 39 | + cache: true |
| 40 | + |
| 41 | + # Download all Flutter packages |
| 42 | + - name: Download dependencies |
| 43 | + run: flutter pub get |
| 44 | + working-directory: ${{env.source-directory}} |
| 45 | + |
| 46 | + # Run Flutter Format to ensure formatting is valid |
| 47 | + - name: Run Flutter Format |
| 48 | + run: dart format --set-exit-if-changed . |
| 49 | + working-directory: ${{env.source-directory}} |
| 50 | + |
| 51 | + analyze: |
| 52 | + name: Analyze |
| 53 | + |
| 54 | + # The type of runner that the job will run on |
| 55 | + runs-on: ubuntu-latest |
| 56 | + |
| 57 | + env: |
| 58 | + source-directory: ./flutter_cache_manager_firebase |
| 59 | + |
| 60 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 61 | + steps: |
| 62 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + |
| 65 | + # Make sure the stable version of Flutter is available |
| 66 | + - name: Set up Flutter |
| 67 | + uses: subosito/flutter-action@v2 |
| 68 | + with: |
| 69 | + channel: "stable" |
| 70 | + architecture: x64 |
| 71 | + cache: true |
| 72 | + |
| 73 | + # Download all Flutter packages |
| 74 | + - name: Download dependencies |
| 75 | + run: flutter pub get |
| 76 | + working-directory: ${{env.source-directory}} |
| 77 | + |
| 78 | + # Run Flutter Analyzer |
| 79 | + - name: Run Flutter Analyzer |
| 80 | + run: flutter analyze |
| 81 | + working-directory: ${{env.source-directory}} |
| 82 | + |
| 83 | + tests: |
| 84 | + name: Unit-tests |
| 85 | + # The type of runner that the job will run on |
| 86 | + runs-on: ubuntu-latest |
| 87 | + |
| 88 | + env: |
| 89 | + source-directory: ./flutter_cache_manager_firebase |
| 90 | + |
| 91 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 92 | + steps: |
| 93 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 94 | + - uses: actions/checkout@v4 |
| 95 | + |
| 96 | + # Make sure the stable version of Flutter is available |
| 97 | + - name: Set up Flutter |
| 98 | + uses: subosito/flutter-action@v2 |
| 99 | + with: |
| 100 | + channel: "stable" |
| 101 | + architecture: x64 |
| 102 | + cache: true |
| 103 | + |
| 104 | + # Download all Flutter packages |
| 105 | + - name: Download dependencies |
| 106 | + run: flutter pub get |
| 107 | + working-directory: ${{env.source-directory}} |
| 108 | + |
| 109 | + # Run all unit-tests with code coverage |
| 110 | + - name: Run unit tests |
| 111 | + run: flutter test --coverage |
| 112 | + working-directory: ${{env.source-directory}} |
| 113 | + |
| 114 | + # # Upload code coverage information |
| 115 | + # - uses: codecov/codecov-action@v4 |
| 116 | + # env: |
| 117 | + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 118 | + # with: |
| 119 | + # files: ${{env.source-directory}}/coverage/lcov.info |
| 120 | + # name: CacheManager |
| 121 | + # fail_ci_if_error: true |
| 122 | + |
| 123 | + publish_cache_manager_firebase: |
| 124 | + if: ${{ github.ref_type == 'tag' }} |
| 125 | + name: Publish Cache Manager Firebase |
| 126 | + permissions: |
| 127 | + id-token: write |
| 128 | + needs: [format, analyze, tests] |
| 129 | + # The type of runner that the job will run on |
| 130 | + runs-on: ubuntu-latest |
| 131 | + |
| 132 | + env: |
| 133 | + source-directory: ./flutter_cache_manager_firebase |
| 134 | + |
| 135 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 136 | + steps: |
| 137 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 138 | + - uses: actions/checkout@v4 |
| 139 | + |
| 140 | + - name: Set up Dart |
| 141 | + uses: dart-lang/setup-dart@v1 |
| 142 | + |
| 143 | + # Make sure the stable version of Flutter is available |
| 144 | + - name: Set up Flutter |
| 145 | + uses: subosito/flutter-action@v2 |
| 146 | + with: |
| 147 | + channel: "stable" |
| 148 | + architecture: x64 |
| 149 | + cache: true |
| 150 | + |
| 151 | + # Download all Flutter packages |
| 152 | + - name: Download dependencies |
| 153 | + run: flutter pub get |
| 154 | + working-directory: ${{env.source-directory}} |
| 155 | + |
| 156 | + # Publish the package |
| 157 | + - name: Publish package |
| 158 | + run: dart pub publish -v -f |
0 commit comments