Skip to content

Commit

Permalink
fix: retrieve dependencies from cache in sonar_analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
smallTrogdor committed Dec 10, 2024
1 parent 0890383 commit a7c6c50
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 23 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/nightly_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
- uses: subosito/flutter-action@v2
with:
channel: stable
cache: true

- name: Get dependencies
run: flutter pub get

- name: Download gen srcs and coverage
uses: actions/download-artifact@v4
with:
name: gen_srcs-and-coverage

Expand Down
44 changes: 29 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
- name: format check
run: dart format -l 120 -o none --set-exit-if-changed .

- name: test
- name: test # takes ~ 60s, hence we store the artifact for sonar
run: |
dart run build_runner build --delete-conflicting-outputs
flutter test --coverage
flutter test --coverage
- uses: actions/upload-artifact@v4
with:
Expand All @@ -46,15 +46,38 @@ jobs:
**/*.g.dart
**/*.mocks.dart
package_scorer:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: axel-op/dart-package-analyzer@v3
id: analysis
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}


### FROM HERE: ALL DONE AFTER VALIDATION SUCCEEDS

sonar_analysis:
name: SonarScanning on SonarCloud
runs-on: ubuntu-latest
needs: [validation]
needs: [ validation ]

steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
- uses: subosito/flutter-action@v2
with:
channel: stable
cache: true

- name: Get dependencies
run: flutter pub get

- name: Download gen srcs and coverage
uses: actions/download-artifact@v4
with:
name: gen_srcs-and-coverage

Expand All @@ -63,21 +86,12 @@ jobs:
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

package_scorer:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: axel-op/dart-package-analyzer@v3
id: analysis
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}

build-android:
name: Build Android
runs-on: ubuntu-latest
needs: [validation]
needs: [ validation ]
defaults:
run:
working-directory: example
Expand Down Expand Up @@ -113,7 +127,7 @@ jobs:
build-iOS:
name: Build iOS package
runs-on: macos-latest
needs: [validation]
needs: [ validation ]
defaults:
run:
working-directory: example
Expand Down
15 changes: 8 additions & 7 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
sonar.projectKey=SchweizerischeBundesbahnen_journey-maps-client-flutter
sonar.organization=schweizerischebundesbahnen

# Encoding of the source code. Default is default system encoding.
sonar.sourceEncoding=UTF-8

# Code location. Path is relative to the sonar-project.properties file. Defaults to .
# Use commas to specify more than one folder.
sonar.sources=lib
sonar.exclusions=lib/src/fonts/**,lib/src/sbb_map/sbb_map.dart
sonar.tests=test
sonar.exclusions=lib/src/fonts/**,lib/src/sbb_map/sbb_map.dart,**/*.g.dart

# Encoding of the source code. Default is default system encoding.
sonar.sourceEncoding=UTF-8

# Use existing options to perform dartanalyzer analysis
sonar.dart.analysis.useExistingOptions=true
# Dart / Flutter setup
sonar.flutter.enabled=true
sonar.language=dart

# Path to coverage file
# Coverage (if testing with coverage reports)
sonar.dart.lcov.reportPaths=coverage/lcov.info

0 comments on commit a7c6c50

Please sign in to comment.