|
| 1 | +name: Dart CI |
| 2 | + |
| 3 | +on: |
| 4 | + # Run on PRs and pushes to the default branch. |
| 5 | + push: |
| 6 | + branches: [ master ] |
| 7 | + pull_request: |
| 8 | + branches: [ master ] |
| 9 | + schedule: |
| 10 | + - cron: "0 0 * * 0" |
| 11 | + |
| 12 | +env: |
| 13 | + PUB_ENVIRONMENT: bot.github |
| 14 | + |
| 15 | +jobs: |
| 16 | + # Check code formatting and static analysis on a single OS (linux) |
| 17 | + # against Dart dev. |
| 18 | + analyze: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + sdk: [dev] |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v2 |
| 26 | + - uses: dart-lang/[email protected] |
| 27 | + with: |
| 28 | + sdk: ${{ matrix.sdk }} |
| 29 | + - id: install |
| 30 | + name: Install dependencies |
| 31 | + run: dart pub get |
| 32 | + - name: Check formatting |
| 33 | + run: dart format --output=none --set-exit-if-changed . |
| 34 | + if: always() && steps.install.outcome == 'success' |
| 35 | + - name: Analyze code |
| 36 | + run: dart analyze --fatal-infos |
| 37 | + if: always() && steps.install.outcome == 'success' |
| 38 | + |
| 39 | + # Run tests on a matrix consisting of two dimensions: |
| 40 | + # 1. OS: ubuntu-latest, (macos-latest, windows-latest) |
| 41 | + # 2. release channel: dev |
| 42 | + test: |
| 43 | + needs: analyze |
| 44 | + runs-on: ${{ matrix.os }} |
| 45 | + strategy: |
| 46 | + fail-fast: false |
| 47 | + matrix: |
| 48 | + # Add macos-latest and/or windows-latest if relevant for this package. |
| 49 | + os: [ubuntu-latest] |
| 50 | + sdk: [dev] |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v2 |
| 53 | + - uses: dart-lang/[email protected] |
| 54 | + with: |
| 55 | + sdk: ${{ matrix.sdk }} |
| 56 | + - id: install |
| 57 | + name: Install dependencies |
| 58 | + run: dart pub get |
| 59 | + - name: Run VM tests |
| 60 | + run: dart test --platform vm |
| 61 | + if: always() && steps.install.outcome == 'success' |
| 62 | + - name: Run Chrome tests |
| 63 | + run: dart test --platform chrome |
| 64 | + if: always() && steps.install.outcome == 'success' |
| 65 | + |
| 66 | + # Run tests on a matrix consisting of two dimensions: |
| 67 | + # 1. OS: ubuntu-latest, (macos-latest, windows-latest) |
| 68 | + # 2. release: 2.1.0 |
| 69 | + test-legacy-sdk: |
| 70 | + needs: analyze |
| 71 | + runs-on: ${{ matrix.os }} |
| 72 | + strategy: |
| 73 | + fail-fast: false |
| 74 | + matrix: |
| 75 | + # Add macos-latest and/or windows-latest if relevant for this package. |
| 76 | + os: [ubuntu-latest] |
| 77 | + sdk: [2.1.0] |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@v2 |
| 80 | + - uses: dart-lang/[email protected] |
| 81 | + with: |
| 82 | + sdk: ${{ matrix.sdk }} |
| 83 | + - id: install |
| 84 | + name: Install dependencies |
| 85 | + run: pub get |
| 86 | + - name: Run VM tests |
| 87 | + run: pub run test --platform vm |
| 88 | + if: always() && steps.install.outcome == 'success' |
| 89 | + - name: Run Chrome tests |
| 90 | + run: pub run test --platform chrome |
| 91 | + if: always() && steps.install.outcome == 'success' |
0 commit comments