|
| 1 | +name: logging |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + pull_request: |
| 7 | +defaults: |
| 8 | + run: |
| 9 | + shell: bash |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: Build ${{matrix.sdk}} on ${{matrix.os}} |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + timeout-minutes: 20 |
| 15 | + defaults: |
| 16 | + run: |
| 17 | + working-directory: ./logging |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 22 | + sdk: [stable, beta, dev] |
| 23 | + exclude: |
| 24 | + # Bad state: Could not run tests with Observatory enabled. Try setting a different port with --port option. |
| 25 | + - os: ubuntu-latest |
| 26 | + sdk: beta |
| 27 | + # hanging often |
| 28 | + - os: ubuntu-latest |
| 29 | + sdk: dev |
| 30 | + - os: macos-latest |
| 31 | + sdk: beta |
| 32 | + # macos-latest is taking hours due to limited resources |
| 33 | + - os: macos-latest |
| 34 | + sdk: dev |
| 35 | + |
| 36 | + steps: |
| 37 | + - uses: dart-lang/setup-dart@v1 |
| 38 | + with: |
| 39 | + sdk: ${{ matrix.sdk }} |
| 40 | + - uses: actions/checkout@v2 |
| 41 | + # coverage with 'chrome' platform hangs the build |
| 42 | + - name: Test (VM and browser) |
| 43 | + run: | |
| 44 | + dart pub get |
| 45 | + dart test -p chrome |
| 46 | + dart test -p vm --coverage=coverage |
| 47 | + dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.packages --report-on=lib |
| 48 | +
|
| 49 | + - uses: codecov/codecov-action@v1 |
| 50 | + if: runner.os == 'Linux' |
| 51 | + with: |
| 52 | + name: sentry |
| 53 | + file: ./logging/coverage/lcov.info |
| 54 | + |
| 55 | + - uses: VeryGoodOpenSource/[email protected] |
| 56 | + if: runner.os == 'Linux' |
| 57 | + with: |
| 58 | + path: "./logging/coverage/lcov.info" |
| 59 | + min_coverage: 90 |
| 60 | + |
| 61 | + analyze: |
| 62 | + runs-on: ubuntu-latest |
| 63 | + timeout-minutes: 20 |
| 64 | + defaults: |
| 65 | + run: |
| 66 | + working-directory: ./dart |
| 67 | + steps: |
| 68 | + - uses: dart-lang/setup-dart@v1 |
| 69 | + with: |
| 70 | + sdk: stable |
| 71 | + - uses: actions/checkout@v2 |
| 72 | + - run: | |
| 73 | + dart pub get |
| 74 | + dart analyze --fatal-infos |
| 75 | + dart format --set-exit-if-changed ./ |
| 76 | +
|
| 77 | + package-analysis: |
| 78 | + runs-on: ubuntu-latest |
| 79 | + timeout-minutes: 20 |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v2 |
| 82 | + - uses: axel-op/dart-package-analyzer@v3 |
| 83 | + id: analysis |
| 84 | + with: |
| 85 | + githubToken: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + relativePath: dart/ |
| 87 | + - name: Check scores |
| 88 | + env: |
| 89 | + TOTAL: ${{ steps.analysis.outputs.total }} |
| 90 | + TOTAL_MAX: ${{ steps.analysis.outputs.total_max }} |
| 91 | + run: | |
| 92 | + PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX )) |
| 93 | + if (( $PERCENTAGE < 100 )) |
| 94 | + then |
| 95 | + echo Score too low! |
| 96 | + exit 1 |
| 97 | + fi |
0 commit comments