|
1 |
| -name: Analyse & Build |
2 |
| -on: [push, workflow_dispatch] |
| 1 | +name: CI/CD |
| 2 | +on: |
| 3 | + push: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} |
| 8 | + cancel-in-progress: true |
3 | 9 |
|
4 | 10 | jobs:
|
5 |
| - package-analysis: |
6 |
| - name: "Analyse Package" |
7 |
| - runs-on: ubuntu-latest |
8 |
| - if: github.event.head_commit.message != 'Built Example Applications' |
9 |
| - steps: |
10 |
| - - name: Checkout Repository |
11 |
| - uses: actions/checkout@v3 |
12 |
| - - name: Run Dart Package Analyser |
13 |
| - uses: axel-op/dart-package-analyzer@v3 |
14 |
| - id: analysis |
15 |
| - with: |
16 |
| - githubToken: ${{ secrets.GITHUB_TOKEN }} |
17 |
| - - name: Check Package Scores |
18 |
| - env: |
19 |
| - TOTAL: ${{ steps.analysis.outputs.total }} |
20 |
| - TOTAL_MAX: ${{ steps.analysis.outputs.total_max }} |
21 |
| - run: | |
22 |
| - if (( $TOTAL < $TOTAL_MAX )) |
23 |
| - then |
24 |
| - echo Total score below expected minimum score. Improve the score! |
25 |
| - exit 1 |
26 |
| - fi |
| 11 | + score-package: |
| 12 | + name: "Score Package" |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout Repository |
| 16 | + uses: actions/checkout@master |
| 17 | + - name: Run Dart Package Analyser |
| 18 | + uses: axel-op/dart-package-analyzer@master |
| 19 | + id: analysis |
| 20 | + with: |
| 21 | + githubToken: ${{ secrets.GITHUB_TOKEN }} |
| 22 | + - name: Check Package Scores |
| 23 | + env: |
| 24 | + TOTAL: ${{ steps.analysis.outputs.total }} |
| 25 | + TOTAL_MAX: ${{ steps.analysis.outputs.total_max }} |
| 26 | + run: | |
| 27 | + if (( $TOTAL < $TOTAL_MAX )) |
| 28 | + then |
| 29 | + echo Package score less than available score. Improve the score! |
| 30 | + exit 1 |
| 31 | + fi |
| 32 | +
|
| 33 | + analyse-code: |
| 34 | + name: "Analyse Code" |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - name: Checkout Repository |
| 38 | + uses: actions/checkout@master |
| 39 | + - name: Setup Flutter Environment |
| 40 | + uses: subosito/flutter-action@main |
| 41 | + with: |
| 42 | + channel: "beta" |
| 43 | + - name: Get Package Dependencies |
| 44 | + run: flutter pub get |
| 45 | + - name: Get Example Dependencies |
| 46 | + run: flutter pub get -C example |
| 47 | + - name: Get Test Tile Server Dependencies |
| 48 | + run: dart pub get -C tile_server |
| 49 | + - name: Check Formatting |
| 50 | + run: dart format --output=none --set-exit-if-changed . |
| 51 | + - name: Check Lints |
| 52 | + run: dart analyze --fatal-warnings |
| 53 | + |
| 54 | + run-tests: |
| 55 | + name: "Run Tests" |
| 56 | + runs-on: ubuntu-latest |
| 57 | + steps: |
| 58 | + - name: Checkout Repository |
| 59 | + uses: actions/checkout@master |
| 60 | + - name: Setup Flutter Environment |
| 61 | + uses: subosito/flutter-action@main |
| 62 | + with: |
| 63 | + channel: "beta" |
| 64 | + - name: Get Dependencies |
| 65 | + run: flutter pub get |
| 66 | + - name: Install ObjectBox Libs For Testing |
| 67 | + run: cd test && bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh) --quiet |
| 68 | + - name: Run Tests |
| 69 | + run: flutter test -r expanded |
27 | 70 |
|
28 |
| - content-analysis: |
29 |
| - name: "Analyse Contents" |
30 |
| - runs-on: ubuntu-latest |
31 |
| - if: github.event.head_commit.message != 'Built Example Applications' |
32 |
| - steps: |
33 |
| - - name: Checkout Repository |
34 |
| - uses: actions/checkout@v3 |
35 |
| - - name: Setup Flutter Environment |
36 |
| - uses: subosito/flutter-action@v2 |
37 |
| - with: |
38 |
| - channel: "stable" |
39 |
| - - name: Get All Dependencies |
40 |
| - run: flutter pub get |
41 |
| - - name: Check Formatting |
42 |
| - run: dart format --output=none --set-exit-if-changed . |
43 |
| - - name: Check Lints |
44 |
| - run: dart analyze --fatal-infos --fatal-warnings |
| 71 | + build-demo-android: |
| 72 | + name: "Build Demo App (Android)" |
| 73 | + runs-on: ubuntu-latest |
| 74 | + needs: [analyse-code, run-tests] |
| 75 | + defaults: |
| 76 | + run: |
| 77 | + working-directory: ./example |
| 78 | + steps: |
| 79 | + - name: Checkout Repository |
| 80 | + uses: actions/checkout@master |
| 81 | + - name: Setup Java 17 Environment |
| 82 | + uses: actions/setup-java@v3 |
| 83 | + with: |
| 84 | + distribution: "temurin" |
| 85 | + java-version: "17" |
| 86 | + - name: Setup Flutter Environment |
| 87 | + uses: subosito/flutter-action@main |
| 88 | + with: |
| 89 | + channel: "beta" |
| 90 | + - name: Build |
| 91 | + run: flutter build apk --obfuscate --split-debug-info=./symbols |
| 92 | + - name: Upload Artifact |
| 93 | + |
| 94 | + with: |
| 95 | + name: android-demo |
| 96 | + path: example/build/app/outputs/apk/release |
| 97 | + if-no-files-found: error |
45 | 98 |
|
46 |
| - build-example: |
47 |
| - name: "Build Example Applications" |
48 |
| - runs-on: windows-latest |
49 |
| - needs: [content-analysis, package-analysis] |
50 |
| - if: github.event.head_commit.message != 'Built Example Applications' |
51 |
| - defaults: |
52 |
| - run: |
53 |
| - working-directory: ./example |
54 |
| - steps: |
55 |
| - - name: Checkout Repository |
56 |
| - uses: actions/checkout@v3 |
57 |
| - - name: Setup Java 17 Environment |
58 |
| - uses: actions/setup-java@v3 |
59 |
| - with: |
60 |
| - distribution: "temurin" |
61 |
| - java-version: "17" |
62 |
| - - name: Setup Flutter Environment |
63 |
| - uses: subosito/flutter-action@v2 |
64 |
| - with: |
65 |
| - channel: "stable" |
66 |
| - - name: Remove Existing Prebuilt Applications |
67 |
| - run: Remove-Item "prebuiltExampleApplications" -Recurse -ErrorAction Ignore |
68 |
| - working-directory: . |
69 |
| - - name: Create Prebuilt Applications (Output) Directory |
70 |
| - run: md prebuiltExampleApplications |
71 |
| - working-directory: . |
72 |
| - - name: Get All Dependencies |
73 |
| - run: flutter pub get |
74 |
| - - name: Build Android Application |
75 |
| - run: flutter build apk --obfuscate --split-debug-info=/symbols |
76 |
| - - name: Move Android Application To Output Directory |
77 |
| - run: move "example\build\app\outputs\flutter-apk\app-release.apk" "prebuiltExampleApplications\AndroidApplication.apk" |
78 |
| - working-directory: . |
79 |
| - - name: Build Windows Application |
80 |
| - run: flutter build windows --obfuscate --split-debug-info=/symbols |
81 |
| - - name: Create Windows Application Installer |
82 |
| - run: iscc "windowsApplicationInstallerSetup.iss" |
83 |
| - working-directory: . |
84 |
| - - name: Commit Output Directory |
85 |
| - |
86 |
| - with: |
87 |
| - message: "Built Example Applications" |
88 |
| - add: "prebuiltExampleApplications/" |
89 |
| - default_author: github_actions |
| 99 | + build-demo-windows: |
| 100 | + name: "Build Demo App (Windows)" |
| 101 | + runs-on: windows-latest |
| 102 | + needs: [analyse-code, run-tests] |
| 103 | + defaults: |
| 104 | + run: |
| 105 | + working-directory: ./example |
| 106 | + steps: |
| 107 | + - name: Checkout Repository |
| 108 | + uses: actions/checkout@master |
| 109 | + - name: Setup Flutter Environment |
| 110 | + uses: subosito/flutter-action@main |
| 111 | + with: |
| 112 | + channel: "beta" |
| 113 | + - name: Build |
| 114 | + run: flutter build windows --obfuscate --split-debug-info=./symbols |
| 115 | + - name: Create Installer |
| 116 | + run: iscc "windowsApplicationInstallerSetup.iss" |
| 117 | + working-directory: . |
| 118 | + - name: Upload Artifact |
| 119 | + |
| 120 | + with: |
| 121 | + name: windows-demo |
| 122 | + path: windowsTemp/WindowsApplication.exe |
| 123 | + if-no-files-found: error |
| 124 | + |
| 125 | + build-tile-server-windows: |
| 126 | + name: "Build Tile Server (Windows)" |
| 127 | + runs-on: windows-latest |
| 128 | + needs: [analyse-code, run-tests] |
| 129 | + defaults: |
| 130 | + run: |
| 131 | + working-directory: ./tile_server |
| 132 | + steps: |
| 133 | + - name: Checkout Repository |
| 134 | + uses: actions/checkout@master |
| 135 | + - name: Setup Dart Environment |
| 136 | + |
| 137 | + - name: Get Dependencies |
| 138 | + run: dart pub get |
| 139 | + - name: Get Dart Dependencies |
| 140 | + run: dart pub get |
| 141 | + - name: Generate Tile Images |
| 142 | + run: dart run bin/generate_dart_images.dart |
| 143 | + - name: Compile |
| 144 | + run: dart compile exe bin/tile_server.dart |
| 145 | + - name: Upload Artifact |
| 146 | + |
| 147 | + with: |
| 148 | + name: windows-ts |
| 149 | + path: tile_server/bin/tile_server.exe |
| 150 | + if-no-files-found: error |
| 151 | + |
| 152 | + build-tile-server-linux: |
| 153 | + name: "Build Tile Server (Linux/Ubuntu)" |
| 154 | + runs-on: ubuntu-latest |
| 155 | + needs: [analyse-code, run-tests] |
| 156 | + defaults: |
| 157 | + run: |
| 158 | + working-directory: ./tile_server |
| 159 | + steps: |
| 160 | + - name: Checkout Repository |
| 161 | + uses: actions/checkout@master |
| 162 | + - name: Setup Dart Environment |
| 163 | + |
| 164 | + - name: Get Dependencies |
| 165 | + run: dart pub get |
| 166 | + - name: Run Pre-Compile Generator |
| 167 | + run: dart run bin/generate_dart_images.dart |
| 168 | + - name: Compile |
| 169 | + run: dart compile exe bin/tile_server.dart |
| 170 | + - name: Upload Artifact |
| 171 | + |
| 172 | + with: |
| 173 | + name: linux-ts |
| 174 | + path: tile_server/bin/tile_server.exe |
| 175 | + if-no-files-found: error |
0 commit comments